跳转至

Ubuntu16.04安装生产环境

设置国内源

清空 /etc/apt/sources.list

填充如下文本

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

重启

sudo apt update
sudo apt upgrade

安装pip

安装

sudo apt-get install python3-pip

指定pip源

cd ~/
mkdir ./.pip
gedit ./.pip/pip.conf
#插入
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
#保存退出

升级pip

pip3 install --upgrade pip

安装virtualenv

安装

pip3 install virtualenv
pip3 install virtualenvwrapper
export WORKON_HOME=~/.Envs #设置环境变量路径 (在~/路径下的.Envs)
mkdir -p $WORKON_HOME # 创建虚拟环境管理目录 (在~/路径下创建.Envs)
sudo find / -name virtualenvwrapper.sh #找到virtualenvwrapper.sh的路径
sudo gedit ~/.bashrc  #打开终端的配置文件在最下面添加
......
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/home/zhangy233/.local/bin/virtualenv
export WORKON_HOME=~/.Envs
# 下面的路径替换成上面找到的路径
source /home/zhangy233/.local/bin/virtualenvwrapper.sh
......
source ~/.bashrc  #重启终端
sudo rm -r ~/.virtualenvs/ # 删除默认的环境变量文件夹

前端

安装nodejs和npm

sudo    apt-get    install    nodejs-legacy
sudo    apt-get    install    npm

安装用于安装nodejs的模块n

sudo    npm    install    -g    n

通过n模块安装指定的nodejs

sudo    n    latest
sudo    n    stable
sudo    n    lts

升级npm为最新版本

sudo    npm    install    npm@latest    -g

查看版本

sudo    node    -v

sudo    npm    -v

安装vue-cli

npm config set registry https://registry.npm.taobao.org
sudo npm install -g @vue/cli # sudo安装