Ubuntu自带的数据源在国外,受某墙的影响,会出现无法访问的情况,这就需要我们通过修改数据源来获取软件及更新。今天我们就讲解一下修改Ubuntu系统的数据源。我们以阿里云数据源为例,需要其他的可自行百度获取其他网站的数据源。
一、进入apt文件夹
cd /etc/apt
二、备份原来的源文件,要养成良好的习惯
sudo cp sources.list sources.list_backup
三、将之前的源全部删除
echo '' > sources.list
四、编辑新源文件
nano sources.list
五、加入新的数据源(阿里云)
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ xenial partner
deb http://extras.ubuntu.com/ubuntu/ xenial main
六、更新数据源
sudo apt-get update
注:修改sources.list 需要root权限。因此在修改时,需要提前切换到root用户。