Repositories/Ubuntu
出自Ubuntu中文
原文作者:UbuntuWiki
授权许可:创作共用协议Attribution-ShareAlike 2.0
翻译人员:5451vs5451
校对人员:
贡献者:
适用版本:
文章状态:等待翻译
[编辑] What are Repositories? 什么是软件仓库
There are thousands of programs available to install on Ubuntu. These programs are stored in software archives (repositories) and are available for installation over the Internet. This makes it very easy to install new programs. It is also very secure, because each program you install is thoroughly tested and built specifically for Ubuntu.
Ubuntu系统下有成千上万的程序可供使用。这些程序存放在软件仓库中,并且可以通过网络进行安装。这使得安装新程序变得十分简单,而且十分安全,因为您安装的每一个程序都是为Ubuntu量身定制并经过了严格测试的。
The Ubuntu software repository is organised into four "components", on the basis of the level of support Ubuntu can offer them, and whether or not they comply with Ubuntu's Free Software Philosophy. The components are called Main (officially supported software), Restricted (supported software that is not available under a completely free license), Universe (community-maintained, i.e. not officially supported software) and Multiverse (software that is "not free"). You can find more information about the Ubuntu Repositories here.
Ubuntu软件仓库中的软件被划分为四大类,这样划分的依据是看Ubuntu能够在多大的程度上为这些软件提供支持,以及它们是否符合Ubuntu所倡导的自由软件的价值观念。这四大类分别是Main(官方软件),Restricted(),Universe(由社区提供技术支持的非官方软件)和Multiverse(非自由软件)。您可以从here获得更多关于Ubuntu软件仓库的信息。
The Ubuntu Install CDs contain software from the Main and Restricted components. Once your system is made aware of the Internet-based locations for these repositories, many more software programs are made available for installation. Using the software package management tools already installed on your system, you can search for, install and update any piece of software directly over the Internet, without the need for the CD.
Ubuntu安装光盘提供了Main和Restricted类别的软件。只要告诉系统软件仓库的位置,您就可以安装更多的软件。使用系统自带的软件包管理工具,您可以网络搜寻、安装或者升级任何软件,而不必再依靠光盘了。
[编辑] Adding Repositories in Ubuntu 在Ubuntu中添加软件仓库
attachment:IconsPage/eyes.png This page describes how to manage software repositories in Ubuntu 6.06 (Dapper Drake). For Kubuntu 6.06 please see Kubuntu repository management. For earlier versions of Ubuntu please see this wiki page.
attachment:IconsPage/eyes.png 本页介绍如何在Ubuntu 6.06 (Dapper Drake)中管理软件仓库。Kubuntu 6.06的用户请阅读在Kubuntu中管理软件仓库。Ubuntu早期版本的用户请阅读此维基页面。/Breezy
attachment:IconsPage/terminal.png The operations described on this page modify the software repositories configuration file located at
/etc/apt/sources.list
Software sources can also be managed by making direct modifications to this file using the command line. If you prefer to use the command line instead of a graphical user interface, see Managing Repositories from the Command Line instead. attachment:IconsPage/terminal.png 本页中涉及的操作会修改软件仓库配置文件,这个文件位于
/etc/apt/sources.list
- 软件源也可以通过在命令行下直接修改此配置文件的方式进行处理。如果您更喜欢在命令行而不是图形方式下工作,您应该阅读使用命令行管理软件仓库。
[编辑] Adding the Universe and Multiverse Repositories 添加Universe和Multiverse仓库
- Navigate to "System" > "Administration" > "Software Properties".移动到 "系统" > "系统管理" > "软件源" attachment:menu-sw.png
- 一个软件源或者“频道”的列表就会被显示出来。向下滚动到第三个选项,这里显示着和A list of repositories or "Channels" will be shown. Scroll down to the three entries that share the Community 社区维护' (Universe)'maintained (Universe) and Non-free (Multiverse) attributes: attachment:activate-repos.png
- Activate all three entries by clicking on the checkboxes next to them.
- Click Close to save your changes. A dialog box should appear, asking whether you'd like to update the list of repositories. Click Reload to apply your changes.
- 打开“系统”>“系统管理”>“更新管理器”。
- 这会打开一个软件仓库列表。(奇怪的是,在我的中文Ubuntu 6.06系统中,该列表只能从新立得包管理器'设置菜单中的软件库选项得到——译者注)。在此列表中找到标有Community maintained (Universe) and Non-free' (Multiverse) 字样的三个表项:
- 选中左侧的方框以激活这些选项。
- 点击关闭按钮来保存您的设置。此时将弹出一个对话框,询问您是否要更新软件仓库列表。选择刷新使您作出的修改生效。
attachment:IconsPage/info.png Integration with Synaptic Package Manager
- The next time you use the Synaptic package manager, click on the Reload button to make it aware of the new software repositories. attachment:reload.png
- 当您再次进入新立得包管理器时,请点击刷新按钮以使得包管理器可以从新加入的仓库中获得软件。
- You can also manage software repositories from within Synaptic by selecting "Settings" > "Repositories". attachment:synaptic-repos.png
- 您也可以使用新立得中“设置”菜单下的“软件库”选项来管理软件库。
[编辑] Adding Canonical Commercial Repositories
[编辑] 添加 Canonical 商业仓库
To launch the Synaptic Package Manager hit System -> Administration -> Synaptic Package Manager .
运行新立得软件包管理器,点击 系统 -> 系统管理 -> 新立得软件包管理器。
attachment:RepositoriesUbuntu01.png
Next you will be prompted for your password to be able to launch Synaptic as super user.
下一步你将被需要输入密码来作为一个超级用户而加载新立得。
attachment:RepositoriesUbuntu02.png
一旦完毕,你的屏幕上就会显示新立得软件包管理器。在屏幕的菜单上你将要点击 设置 -> '''''软件库
Once that's all done you should now have the Synaptic package manager on your screen. On the menu of this screen you will want to click on Settings -> Repositories
attachment:RepositoriesUbuntu03.png
This is were you will be able to add the Canonical commercial repositories. on the left of the screen click on the button Add.
attachment:RepositoriesUbuntu04.png
The Add Channel screen will come up. On this screen select the Custom option.
attachment:RepositoriesUbuntu05.png
On this screen type the following line and then click on Add Channel.
deb http://archive.canonical.com/ubuntu dapper-commercial main
attachment:RepositoriesUbuntu06.png
Now hit Close. From the main Synaptic window, hit Reload. Once this finishes, you will now be able to get packages from the Canonical commercial repositories using the Synaptic Package Manager.
[编辑] Adding Other Repositories添加起它的软件库
attachment:IconsPage/warning.png Note: There are some (but not many) good reasons for which you might want to add non-Ubuntu repositories to your list of software sources. For example, some software cannot be distributed by Ubuntu due to patent and licensing restrictions in some countries (see the RestrictedFormats page for examples). You might want to add repositories that offer such software. Make sure that all repositories you add in this way have been tested and are known to work on Ubuntu systems. Repositories that are not designed to work with your version of Ubuntu can introduce inconsistencies in your system and might force you to re-install.
-
- Anchor(add)
- You can add custom software repositories by adding the apt repository line of your software source to the list of repositories. To do so, click on the Add button next to the Channel list in the Software Preferences panel, then select Custom.
- Anchor(add)
- attachment:add-custom.png
- Enter the apt line into the dialog box. It should look something like this:
deb http://mirror3.ubuntulinux.nl/ dapper-seveas freenx
attachment:IconsPage/info.png For an explanation of the different parts of the apt line, see the edit Editing Repositories section below.
[编辑] Managing Local Repositories管理本地的软件库
[编辑] Disable the CD-ROM Repository禁用光驱软件库
If you have installed Ubuntu from one of Ubuntu's CD-ROMs, the CD will be included in the list of repositories used by the package managment tools. When you install a new package, Synaptic will check whether the package is available locally (i.e. on the CD-ROM). Synaptic may then ask for the CD-ROM. This can help reduce the size of downloads and speed up the installation process. If you would like Synaptic to rely solely on the internet repositories for package management, you can disable the CD-ROM entry with a few steps:
- Launch Synaptic and navigate to "Settings" > "Repositories".
A list of software repositories or "Channels" will be shown. - Locate the entry for the CD-ROM (it may say something like CD disk with Ubuntu 6.06 LTS). Click on the checkbox next to it to disable the CD-ROM as a software source.
- Click the Close button to save the changes you have made.
- You can re-enable the CD-ROM at any time using the checkbox next to its entry.
[编辑] Removing Repositories移除软件库
To remove software sources ("Channels") from the list, select the source and click on the Remove button. (If you only want to disable the repository temporarily, uncheck the checkbox next to the source instead.)
attachment:IconsPage/eyes.png Use with caution: At present, you will not be asked to confirm the remove action. This is not a problem with the Ubuntu repositories as you can simply add add them again, but you may have to look up a custom repository line if you mistakenly delete it. (It is always a good idea to back up your sources.list)
[编辑] Editing Repositories编辑软件库
To make changes to a software source, select it in the list and click the Edit button. A dialog box displays the apt line, broken up into its components.
- attachment:edit-channel.png
- Type Software sources may contain software in binary or source code format. Select the option that corresponds to the repository. attachment:IconsPage/eyes.png The corresponding apt line has deb for binary repositories and deb-src for source code repositories.
- URI Enter a valid Uniform Resource Indicator or URI for the software repository. Here's a list of examples:
- cdrom
- cdrom
cdrom:[description_of_cd]/
- ftp
- ftp
ftp://ftp.domain.ext/path/to/repository
- http
- http
http://www.domain.ext/path/to/repository
- smb (works only when the computer is connected to a Samba share)
- smb (works only when the computer is connected to a Samba share)
file://path/to/repository
- nfs (works only if the computer is connected to a NFS share)
- nfs (works only if the computer is connected to a NFS share)
file://path/to/local/directory
- Distribution
Select the name of the distribution or the name of the distribution version.
(dapper-seveas aptline in the example above.)
- Components
Select the repository section to access. Add more sections separated by spaces.
(The aptline example repository has a freenx section.)
- Comment
Add a comment to describe the repository for easier reference.
attachment:IconsPage/info.png Repositories defined using the Software Preferences panel are available to Update-Manager and will be periodically checked for updates.
[编辑] Managing Authentication Keys管理认证密匙
Authentication keys are usually obtained from the maintainer of the software repository. The maintainer will often place a copy of the authentication key on a public key server such as www.keyserver.net. The key can then be retrieved using the command
gpg --keyserver [name of keyserver] --recv-keys [keyhash]
- In our example above, you would import the maintainer's authentication key as follows:
gpg --keyserver subkeys.pgp.net --recv-keys 1135D466
- Then, add the key to Ubuntu's apt trusted keys database with the following command
gpg --export --armor 1135D466 | sudo apt-key add -
- Note there's a dash at the end of the line
attachment:IconsPage/info.png For more on apt and authentication keys, see SecureApt on the Debian Wiki.
[编辑] See also参阅
- Managing Software Repositories from the Command Line
- Managing Software Repositories in Kubuntu
- Chapter 2 of the Ubuntu Desktop Guide, Adding, Removing and Updating Applications
- An automatic sources.list generator
- The Debian Apt User Manual
- man pages
- sources.list
