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.

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

Get Learning Debian GNU/Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.