Search the Catalog
Learning Debian GNU/Linux

Learning Debian GNU/Linux

By Bill McCarty
1st Edition September 1999
1-56592-705-2, Order Number: 7052
360 pages, $34.95 , Includes CD-ROM

Previous: C.4 Using dselect Appendix C
The Debian Package Management Utilities
Next: C.6 Package Contents and Installation Commands
 

C.5 Using apt-get

The dselect program is useful, because it lets you browse a list of available packages, viewing their descriptions and dependencies, and selecting desired packages for installation. However, if you know the name of a package you want to install, apt-get is often the easiest way to install it. Before using apt-get, you must configure the sources.list file. This same file is used when you choose the apt access method of dselect. Even if you don't plan on using apt-get, you'll find the information in the following subsection useful.

C.5.1 Configuring the sources.list File

The sources.list file resides in the /etc/apt directory. Like most other Linux configuration files, it can be revised by using an ordinary text editor, such as ae.

The file contains a series of lines, each specifying a source for packages. The lines are consulted serially, so it's usually advantageous to place lines that specify local sources - such as a CD-ROM - ahead of lines that specify remote sources. Doing so can save many minutes of download time.

Each line has the form:

deb 
uri distribution components

The uri is a universal resource identifier (URI) the specifies the computer on which the packages reside, the location of the packages, and the protocol used for accessing the packages. It has the following form:


protocol://
host/
path

Four protocols - sometimes called URI types - are recognized:

cdrom

A local CD-ROM drive.

file  

A directory of the local filesystem.

http

A Web server.

ftp  

An FTP server.

The host part of the URI and the preceding pair of slashes (//) are used only for the http and ftp protocols. There, the host part of the URI gives the name of the host that contains the packages.

The path part of the URI always appears, with the preceding slash (/). It specifies the absolute path of the directory that contains the packages.

Here are some examples of typical URIs:

cdrom:/cdrom
cdrom:/mnt/cdrom
file:/mnt
file:/debian
http://www.us.debian.org/debian
http://non-us.debian.org/debian-non-US
ftp://ftp.debian.org/debian
ftp://nonus.debian.org/debian-non-US

The distribution part of a sources.list line specifies the distribution release that contains the packages. Typical values include:

stable

The latest stable release; that is, one that is commonly regarded as having sufficiently few serious bugs for everyday use.

unstable

The latest unstable release. This release sometimes contains serious bugs and should not be installed by users who require high levels of system availability or reliability.

The components part of a sources.list line specifies the parts of the distribution that will be accessed. Typical values include:

main

The main set of packages.

contrib

Packages not an integral part of the distribution, but which may be useful.

non-free

Packages that contain software distributed under terms too restrictive to allow inclusion in the distribution, but which may be useful.

A typical sources.list file might contain the following entries:

deb file:/cdrom stable main contrib
deb http://www.us.debian.org/debian stable main contrib non-free
deb http://non-us.debian.org/debian-non-US stable non-US

This configuration allows rapid access to the distribution packages contained on the local CD-ROM. It also allows convenient access via the network to other packages and more recent package versions stored on web servers.

C.5.2 Using apt-get

Once you've configured sources.list, you can use apt-get to update information on available packages, to install a package, or to upgrade installed packages.

C.5.2.1 Updating Information on Available Packages

To update information on available packages, issue the following command:

apt-get update

C.5.2.2 Installing a Package

To install a specified package, issue the following command:

apt-get install 
package

where package specifies the name of the package to be installed.

C.5.2.3 Upgrading Installed Packages

To automatically upgrade all installed packages to the latest available version, issue the following command:

apt-get upgrade 

Previous: C.4 Using dselect Learning Debian GNU/Linux Next: C.6 Package Contents and Installation Commands
C.4 Using dselect Book Index C.6 Package Contents and Installation Commands

Back to: Learning Debian GNU/Linux


O'Reilly Home | O'Reilly Bookstores | How to Order | O'Reilly Contacts
International | About O'Reilly | Affiliated Companies

© 1999, O'Reilly & Associates, Inc.


HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека