ubuntu如何添加软件源

最近在ubuntu群里有人提出任何添加软件源的问题,其实网上有很多添加源的文章,本站有类似的文章,在这里我在将一下如何添加源,ubuntu添加源有两种方式:
一、是最常见的添加源的方式,就是使用命令,这种方式可以一次性添加很多源,很方便:
1 首先备份源列表:
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
2 而后用gedit或其他编辑器打开:
sudo gedit /etc/apt/sources.list
可我遇到有些初学者在运行命令后terminal提示找不到 gedit 这个命令,那就是系统默认没有安装gedit(尽管这种情况很少发生),解决办法
安装gedit#sudo apt-get install gedit
或者选择其他的文字编辑器,如vim、pico等
3 从网上选择合适的源,加入到文件中:
注意:一定要选对版本
4 然后,刷新列表:
sudo apt-get update
注意:一定要执行刷新
二、。也许你会问这么多的源哪个才适合自己呢?一是根据自己的网络情况,看自己是电信的还是网通的抑或是其他的……实在弄不清楚可以资讯当地的网络提供商
另外我要介绍的是apt-spy这个软件,它可以自动为你找到适合自己的源(spy可是间谍的意思哦。)
#dpkg -l apt-spy
查看系统是否已安装apt-spy ,若未安装请到http://packages.debian.org/zh-cn/lenny/apt-spy 下载
以下讲讲apt-spy的使用方法
apt-spy使用方法: apt-spy [options]
选项:
-d distribution 选择 debian 的发行版本,例如 stable 。除升级外,必须使用此参数。
-a area 选择进行测试的区域,例如 Aisa 。
-c config 指定配置文件。
-e number 指定测试的服务器数量。
-f file 测试时抓取制定的文件(文件相对 debian base 的路径)。
-i file 指定输入的文件,配合 -w 参数使用。
-m mirror-list 指定要升级的镜像列表文件。
-o output-file 重定向输出到指定文件。
-p proxy 指定使用的代理服务器,需要遵从 [server]:[port] 的格式。
-s country_list 指定要进行测试的国家。不能和 -a 参数同时使用。
-t time 指定进行测试时每台服务器的超时时间,只能是正整数。
-u update-URL 从指定的 URL 获得镜像列表更新。
-w file 输出 -i 参数提供的服务器列表中速度最快的前几台镜像服务器(缺省是前 5 台)。
-n number 制定 -w 参数输出的服务器数量。
-v 输出版本信息。
-h 输出当前帮助信息
update 升级镜像站点列表。
用例:
在亚洲区寻找速度最快的testing版镜像(每台服务器的超时时间20秒),并生成 sources.list文件
apt-spy -d testing -t 20 -A Asia
三、图形界面添加源,这种方式适合于初学者,容易掌握
如图所示步骤:系统/系统管理/软件源 还可以将光盘作为源
点击看大图
最后附上一些常用的源列表:
Ubuntu.cn99.com更新服务器(江苏省常州市电信,推荐电信用户使用):
deb http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse
Archive.ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):
deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
Mirrors.shlug.org更新服务器(电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):
deb http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
Mirror.lupaworld.com更新服务器(浙江省杭州市双线服务器):
deb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse
厦门大学更新服务器(教育网服务器):
deb ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-backports restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
deb ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-backports main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-security main restricted universe multiverse
deb-src ftp://ubuntu.realss.cn/ubuntu/ hardy-updates main restricted universe multiverse
成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
== 如果无法解析uestc.edu.cn域名,请使用以下地址 ==
deb http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
deb http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://ubuntu.dormforce.net/ubuntu/ hardy-updates main multiverse restricted universe
上海市上海交通大学更新服务器(教育网,推荐校园网和网通用户使用):
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://ftp.sjtu.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
中国科学技术大学更新服务器(教育网,推荐校园网和网通用户使用):
deb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe
北京市清华大学更新服务器(教育网,推荐校园网和网通用户使用):
deb http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
deb http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-backports main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-security main multiverse restricted universe
deb-src http://mirror9.net9.org/ubuntu/ hardy-updates main multiverse restricted universe
沈阳市东北大学更新服务器(教育网,推荐校园网和网通用户使用):
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
deb ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-backports main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-security main multiverse restricted universe
deb-src ftp://ftp.neu.edu.cn/mirror/archive.ubuntu.com/ubuntu/ hardy-updates main multiverse restricted universe
中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse
Mirror.vmmatrix.net更新服务器(上海市电信,推荐电信网通用户使用):
deb http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-updates main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-backports main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-security main restricted universe multiverse
deb http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://mirror.vmmatrix.net/ubuntu/ hardy-proposed main restricted universe multiverse
ubuntu.cnsite.org更新服务器(福建省福州市 电信):
deb http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-backports main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.cnsite.org/ubuntu/ hardy-proposed main restricted universe multiverse
mirror.rootguide.org更新服务器(上海市 电信):
deb http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy-updates main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy-backports main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ hardy-security main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://mirror.rootguide.org/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu-cn/ hardy main restricted universe multiverse
台湾的官方源速度也相当不错,有时甚至快于内地的:
deb http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
本站原创文章请注明文章出处:Linux119.Cn,文章作者:Chinacnd

posted @ 2011-09-19 23:18  吴超文  阅读(16189)  评论(0编辑  收藏  举报