安装Ubuntu后,使用国外源太慢了,修改为国内源会快很多。
1、修改过程
1.1 备份
备份/etc/apt/sources.list,命令如下:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
1.2 修改Ubuntu的源列表
修改 /etc/apt/sources.list
文件下的列表,特别需要说明的是这些列表和当前的Ubuntu系统的版本有关,不同版本使用不同的配置。例如:
1.2.1 官方中国 Ubuntu 18.04 更新源
deb http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
1.2.2 官方中国 Ubuntu 16.04 更新源
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
# Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ xenial partner
deb http://extras.ubuntu.com/ubuntu/ xenial main
1.3 最后执行更新源命令
更新源命令如下:
sudo apt-get update
sudo apt-get upgrade
2、国内比较有名的Ubuntu镜像网站
可将官方中国 http://cn.archive.ubuntu.com/ubuntu/ 替换为下面任意的服务器:
- 阿里云
http://mirrors.aliyun.com/ubuntu/
Ubuntu 18.04 更新源如下:
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
- 网易
http://mirrors.163.com/ubuntu/
Ubuntu 18.04 更新源如下:
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
教育网
-
中科大
https://mirrors.ustc.edu.cn/ubuntu/ (v4/v6)
http://mirrors4.ustc.edu.cn/ubuntu/ (v4)
http://mirrors6.ustc.edu.cn/ubuntu/ (v6) -
中科院 OpenCAS
http://mirrors.opencas.cn/ubuntu/ -
清华
http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ (v4/v6) http://mirrors.4.tuna.tsinghua.edu.cn/ubuntu/ (v4) http://mirrors.6.tuna.tsinghua.edu.cn/ubuntu/ (v6) -
上海交通大学
http://ftp.sjtu.edu.cn/ubuntu/ (v4/v6)
http://ftp6.sjtu.edu.cn/ubuntu/ (v6)
3、参考资料
-
Ubuntu 16.04 source
http://wiki.ubuntu.org.cn/模板:16.04source -
Ubuntu 18.04修改默认源为国内源
https://www.linuxidc.com/Linux/2018-08/153709.htm