Ubuntu如何配置源?

写道
Ubuntu和Debian一样使用Apt高级包管理系统,可以很方便的进行在线安装、升级、卸载。但是Ubuntu和Debian所使用的源(source)是不同的。

Ubuntu安装完后,默认使用的可能是国外的源,速度可能比较慢。现在国内也有很多服务器提供国外源的镜像,可以使得Ubuntu软件包的安装、升级快很多。

源可以在ubuntu的菜单:系统管理=>软件源配置中图形化的配置。但是用命令行配置可以说的更清楚一些。使用一个编辑工具打开/etc/apt/sources.list文件(比如这里的gedit):

1. sudo gedit /etc/apt/souces.list

复制代码
也可以用其他编辑器,在纯字符模式下可以用:

1. sudo gedit /etc/apt/sources.list

复制代码
这个文件里面的内容可以放心的全部删除,然后用如下的内容代替(以7.04 feisty版为例):

1. ## cn.archive.ubuntu.com
2. deb http://cn.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse
3. deb http://cn.archive.ubuntu.com/ubuntu/ feisty-proposed main restricted universe multiverse
4. deb http://cn.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse
5. deb http://cn.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
6. deb http://cn.archive.ubuntu.com/ubuntu/ feisty-security main restricted universe multiverse

复制代码
其他版本的ubuntu可以把其中的feisty替换成相应版本的名字,比如dapper、edgy、gutsy等。

也可以用如下的cn99的源:

1. deb http://ubuntu.cn99.com/ubuntu/ gutsy main restricted universe multiverse
2. deb http://ubuntu.cn99.com/ubuntu/ gutsy-proposed main restricted universe multiverse
3. deb http://ubuntu.cn99.com/ubuntu/ gutsy-updates main restricted universe multiverse
4. deb http://ubuntu.cn99.com/ubuntu/ gutsy-backports main restricted universe multiverse
5. deb http://ubuntu.cn99.com/ubuntu/ gutsy-security main restricted universe multiverse

复制代码
两个源选一个就可以了。以上配置的是Ubuntu官方的源。而中国的ubuntu社区根据中国用户的一些需要,把中国用户一些常用的软件放在ubuntu- cn的源当中。但是这个源当中的很多软件包有版权问题,所以不能进入官方的源。要添加ubuntu-cn的源,可以在前面内容的基础上再添加一行:

1. deb http://cn.archive.ubuntu.com/ubuntu-cn/ feisty main restricted universe multiverse

复制代码
或者

1. deb http://ubuntu.cn99.com/ubuntu-cn/ feisty main restricted universe multiverse

复制代码
如果需要下载源代码,可以加上源代码的源,就是将每行开头的deb改成deb-src就可以了,比如

1. deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse
2. deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-proposed main restricted universe multiverse
3. deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse
4. deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
5. deb-src http://cn.archive.ubuntu.com/ubuntu/ feisty-security main restricted universe multiverse

复制代码
如果还有其他的第三方的源,可以在这个文件里面继续添加。比如要安装google提供的picasa或者googleearth可以添加如下的一行就可以了:

1. deb http://dl.google.com/linux/deb/ stable non-free

复制代码
注意不要轻信第三方的源,因为恶意制作的源服务器可能存在恶意软件,随意添加他们可能会给系统带来安全问题。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值