本文简单记录一下Ubuntu修改软件源的方法和中间遇到的问题,以便以后查阅。但是本人需要稍微提醒一下,现在Ubuntu原生的源速度也不会太慢,如果可以尽量使用原生的源,我就曾经因为换用国内的源升级系统导致桌面无法启动,百般折腾以后不得不重装系统。
Ubuntu软件源的修改比较简单,一种方法是直接修改软件软列表:只需要把所需的软件源添加到或直接替换原来的系统源列表就可以,列表文件就是/etc/apt/sources.list 。
在终端执行以下命令:
#进入所在目录:
cd /etc/apt/
#备份源列表:
sudo cp sources.list sources.list.bak
#编辑源列表:
sudo gedit /etc/apt/sources.list
如果希望把某一个软件源添加到列表,则只需要一个命令就好,比如在Ubuntu上安装搜狗输入法的时候,可能需要更新Fcitx,需要通过下面的命令添加其软件源:
sudo add-apt-repository ppa:fcitx-team/nightly
最后面的就是Fcitx的官方源了。
下面是一些国内比较好的源,请按照第一种方法添加。从以下各服务器列表内容中选择一段替换文件中的所有内容,也可以加在后面或前面,甚至可以添加多个。请根据自己网络环境设置更新服务器,以达到最快的速度。
在这里要说明一下,关于有些人使用下面的源后,更新软件列表时提示下面这样的错误:
W: Failed to fetch http://debian.ustc.edu.cn/ubuntu/dists/raring-updates/restricted/binary-i386/Packages 404 Not Found [IP: 202.141.160.110 80]
W: Failed to fetch http://debian.ustc.edu.cn/ubuntu/dists/raring-updates/universe/binary-i386/Packages 404 Not Found [IP: 202.141.160.110 80]
W: Failed to fetch http://debian.ustc.edu.cn/ubuntu/dists/raring-updates/multiverse/binary-i386/Packages 404 Not Found [IP: 202.141.160.110 80]
原因在于选用的源已经停止支持,大家要注意软件源列表中的信息,每一个版本都有对应的软件源,比如 deb http://mirrors.163.com/ubuntu/ precise main restricted是12.04的软件源,而 deb http://mirrors.163.com/ubuntu/ raring main universe restricted multiverse是13.04的软件源,建议大家尽量选用长期支持版的软件源,当然更建议大家使用长期支持版的系统。
如果下面的源和你的版本不匹配也没关系,把precise替换成相应的版本号就好,不过有些非长期支持版可能还是不能用,提示404错误,我也是突然发现我使用了13.04的源,而且网易和中科大的源都不能用了才发现这一点。
下面这个是网易的12.04的源。具体大家可以参考网易的手册:
http://mirrors.163.com/.help/ubuntu.html
#网易163的源,ubuntu12.04,更新很快
deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
#中国科学技术大学,我一直用,真的很快
deb http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-backports restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
#台湾源
deb http://tw.archive.ubuntu.com/ubuntu/ precise main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ precise main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ precise-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ precise-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-updates universe main multiverse restricted
#骨头源,骨头源是bones7456架设的一个Ubuntu源 ,提供ubuntu,deepin
deb http://ubuntu.srt.cn/ubuntu/ precise main universe restricted multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ precise main universe restricted multiverse
deb http://ubuntu.srt.cn/ubuntu/ precise-security universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ precise-security universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ precise-updates universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ precise-proposed universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ precise-proposed universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ precise-updates universe main multiverse restricted
#mirror.lupaworld.com的源,速度很快
deb http://mirror.lupaworld.com/ubuntu/archive/ precise main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ precise-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ precise-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ precise-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ precise main restricted universe multiverse
#ubuntu.cn99.com源(推荐):
deb http://ubuntu.cn99.com/ubuntu/ precise main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ precise-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ precise main restricted universe multiverse
#电子科技大学
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
#北京理工大学
deb http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
#上海交通大学
deb http://ftp.sjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu-cn/ precise main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe