Ubuntu软件源添加方法

Ubuntu软件源

对于Ubuntu的在线更新设计,相信您一定觉得十分方便,因为这可以提高系统安装的速度,并节省下载安装CD/DVD的大量时间(目前的Linux 发行版安装都需要多张CD或DVD,对于上网带宽不足的用户,这常会造成下载的困难)。

不知您是否想过,这些软件到底存放在哪里?是否可以指定下载的位置?解决此类问题,就必须提及Ubuntu使用的“软件源”(Software Repositories)。

在Ubuntu中所谓的“软 件源”,是指在世界上许多服务器上放置的软件数据库。就目前而言,软件源中大概有17 000个不同的软件包。由于软件源是开放给所有的Ubuntu用户进行更新,所以只要在软件源中定期上传最新版本的软件,便可确保所有用户都用到最新发布 的软件包。

默认软件源

Ubuntu安装时,系统会根据选择的时区来指定默认的软件源,以加快用户下载更新时的速度。例如,在安装时,如果选择的时区为上海,则系统就会指定使用中国的Ubuntu软      件源。

如果希望了解目前系统所用的软件源列表,首先需要打开/etc/apt/sources.list文件。下面的范例是笔者目前的计算机设置,其中会列出不同用途的软件源网址:

## Major bug fix updates produced after the final release of the

## distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ edgy-updates main restricted multiverse universe

deb-src http://cn.archive.ubuntu.com/ubuntu/ edgy-updates main restricted multiverse universe #Added by software-properties

## Uncomment the following two lines to add software from the 'universe'

## repository.

## 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

## universe WILL NOT receive any review or updates from the Ubuntu security

## team.

# deb http://cn.archive.ubuntu.com/ubuntu/ edgy universe

# deb-src http://cn.archive.ubuntu.com/ubuntu/ edgy universe

## Uncomment the following two lines to add software from the 'backports'

## repository.

## 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://cn.archive.ubuntu.com/ubuntu/ edgy-backports main restricted universe multiverse

# deb-src http://cn.archive.ubuntu.com/ubuntu/ edgy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu edgy-security main restricted multiverse universe

deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted multiverse universe #Added by software-properties

# deb http://security.ubuntu.com/ubuntu edgy-security universe

# deb-src http://security.ubuntu.com/ubuntu edgy-security universe

deb http://archive.canonical.com/ubuntu dapper-commercial main

deb http://archive.ubuntu.org.cn/ubuntu-cn dapper main universe multiverse restricted

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

deb http://archive.ubuntu.com/ubuntu/ edgy-proposed universe main multiverse restricted

deb-src http://archive.ubuntu.com/ubuntu/ edgy-proposed universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu/ edgy-backports universe main multiverse restricted

deb-src http://archive.ubuntu.com/ubuntu/ edgy-backports universe main multiverse restricted

deb http://static.audacious-media-player.org/ubuntu dapper main

deb-src http://static.audacious-media-player.org/ubuntu dapper main

更改软件源

不过有时若遇到某些突发状况,例如因为地震而引起的国际电缆线断裂,或到国外出差或旅行,此时如果仍尝试连接默认的软件源,可能会引起软件更新的失败。

因此需视实际情况来更改软件源的位置,当然,可以直接编辑/etc/apt/sources.list文件的内容,不过为了避免使用错误的语法,以及不正确的软件源地址,因此一般都建议使用图形界面的软件源设置程序——synaptic。

要打开synaptic程序,可以单击“系统”/“系统管理”/“新立得软件包管理器”选项。输入密码后,系统即会打开“新立得软件包管理器”窗口,如图3-8所示。

然后在出现的“新立得软件包管理器”窗口上方,单击“设置”/“软件库”选项,系统会打开“软件源”窗口,如图3-9所示。

图3-8 “新立得软件包管理器”窗口

图3-9 “软件源”窗口

在图3-9所示的画面中,除了可以从“下载自”下拉列表中选择软件源的位置外,也可以决定更新时包含的软件包类型。此处可供选择的软件包类型如下:

    Universe:没有官方维护的开源软件

    Main:官方维护的开源软件

    Mulitverse:非官方维护的非开源软件(具有版权或限制使用)

    Restricted:官方维护的非开源软件

    Source Code:源代码

更改Internet更新属性

如果希望更改Internet更新的软件包属性和频率,首先需要单击上方的“Internet更新”标签,然后再按照实际需求勾选适当的选项,如图3-10所示。

图3-10 单击“Internet更新”标签

自行添加软件源

若要增加软件源的个数,也可以使用手动添加的方式。首先需要单击上方的“第三方”标签,然后单击左下方的“添加”按钮,系统将弹出一个信息窗口,并要求输入软件源的位置,如图3-11所示。

图3-11 自行添加软件源

输入时需使用“类型 位置 软件包类型”语法。下面是本书提供的范例行,供读者   参考:

deb http://hk.archive.ubuntu.com/ubuntu main

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值