使用ubuntu16.04时,默认软件更新源是国外的,在国内下载很慢,可能会出现网络无法到达、无法定位软件包等错误
1.备份原始文件sources.list
Ctrl+Alt+t
打开终端,执行命令:sudo /etc/apt/sources.list /etc/apt/sources.list.bk
2.修改源文件
-
终端执行命令:
sudo chmod 777 /etc/apt/sources.list
更改文件权限 -
执行命令:
sudo gedit /etc/apt/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-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports 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-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
3.更新源
执行终端命令,sudo apt update
更新软件列表,完成换源。