Linux ubuntu 切换阿里更新源
查看codename
首先查看自己的ubuntu系统的codename,直接导致你更新的源是否对你的系统起效果,查看方法: lsb_release -a
benny@benny:/etc/apt$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
benny@benny:/etc/apt$
我的系统显示:Codename: bionic
确认阿里源支持
登陆以下网页:http://mirrors.aliyun.com/ubuntu/dists/ 该网页显示了阿里云支持的ubuntu系统下各个Codename版本,确保自己的Codename在该网页中存在(一般都会有的)
备份系统源
cd /etc/apt
sudo mv sources.list sources.list_bak
添加新的源文件
sudo vi sources.list
并添加以下内容:注意,每一行的trusty应该用第一步查看得到的Codename来代替
deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
保存并且更新成功
sudo apt-get update,