Ubuntu更换apt源

2020-05-09 14:56:03 浏览数 (1)

步骤

查看系统版本

代码语言:javascript复制
lsb_release -c

Codename: bionic

备份原配置

代码语言:javascript复制
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

修改配置

代码语言:javascript复制
sudo rm -rf /etc/apt/sources.list
sudo vi /etc/apt/sources.list

修改为

代码语言:javascript复制
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

更新软件列表

代码语言:javascript复制
sudo apt-get update

安装nodejs

代码语言:javascript复制
sudo apt install -y nodejs
sudo apt install -y npm

查看版本

代码语言:javascript复制
sudo node -v
sudo npm -v

更新npm的包镜像源,方便快速下载

代码语言:javascript复制
sudo npm config set registry https://registry.npm.taobao.org
sudo npm config list

0 人点赞