如何修改 Ubuntu 源列表

by LauCyun Apr 7,2016 01:55:30 8,060 views

不同的网络状况连接以下源的速度不同, 建议在添加前手动验证以下源的连接速度( ping下就行),选择最快的源可以节省大批下载时间。

 

图形界面配置(新手推荐)

依次打开:系统设置,软件和更新。在 下载自 中选择 其他站点 ,然后在中国的条目 下选择 mirrors.ustc.educ.cn 。

下面是 Ubuntu 16.04 的操作示意图:

 

手动更改配置文件

操作前请做好相应备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

一般情况下,将 /etc/apt/sources.list 文件中 Ubuntu 默认的源地址 http://archive.ubuntu.com/ 替换为 http://mirrors.ustc.edu.cn 即可。

也可以使用如下命令:

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

当然也可以直接编辑 /etc/apt/sources.list 文件(需要使用 sudo)。

sudo gedit /etc/apt/sources.list

从下面列表中选择合适的源,替换掉文件中所有的内容,保存编辑好的文件。以下是 Ubuntu 16.04 参考配置内容:

# deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

更改完 sources.list 文件后请运行 sudo apt-get update 更新索引以生效,注意一定要执行刷新:

sudo apt-get update

另外,也可以使用 snullp 大叔开发的 配置生成器 。

小技巧:使用 HTTPS 可以有效避免国内运营商的缓存劫持。

 

源列表

Ubuntu 官方(欧洲,国内较慢,无同步延迟)

http://archive.ubuntu.com/ubuntu/

Ubuntu 官方中国(目前是阿里云)

http://cn.archive.ubuntu.com/ubuntu/

网易(广东广州电信/联通千兆双线接入)

http://mirrors.163.com/ubuntu/

搜狐(山东联通千兆接入)

http://mirrors.sohu.com/ubuntu/

阿里云(北京万网/浙江杭州阿里云服务器双线接入)

http://mirrors.aliyun.com/ubuntu/

中科大 LUG(合肥,电信/联通/移动/教育网自动分流,同时也是 Deepin 官方)

https://mirrors.ustc.edu.cn/ubuntu/ (v4/v6)

http://mirrors4.ustc.edu.cn/ubuntu/ (v4)

http://mirrors6.ustc.edu.cn/ubuntu/ (v6)

清华 TUNA(教育网核心节点百兆接入,已计划提高到千兆)

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://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8

Tags