[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ 16 ] [ 17 ] [ 18 ] [ A ] [ B ] [ C ] [ D ] [ next ]

Debian Tutorial
Chapter 14 - Removing and installing software


14.1 The dpkg package utility


14.2 What a package maintenance utility does

An application or utility program usually involves quite a few files. It might involve libraries, data files like game scenarios or icons, configuration files, manual pages and documentation. When you install the program, you want to make sure you have all the files you need in the right place.

You'd also like to be able to uninstall the program. When you uninstall, you want to be sure all the associated files are deleted. However, if a program you still have on the system needs those files, you want to be sure you keep them.

Finally, you'd like to be able to upgrade a program. When you upgrade, you want to delete obsolete files and add new ones, without breaking any part of the system.

The Debian package system solves these problems. It allows you to install, remove, and upgrade software packages, which are neat little bundles containing the program files and information that helps the computer manage them properly. Debian packages have filenames ending in the extension .deb, and they're available on the ftp site or on your official Debian CD-ROM.


14.3 Apt


14.3.1 Configuring Apt

Debian now supplies a tool named Apt (for "A Package Tool") to help the administrators to add or remove software more easily. Your first task will be to customize the /etc/apt/sources.list configuration file. This package resource list is used to locate archives of the package distribution system in use on the system. The source list is designed to support any number of active sources and a variety of source media. The file lists one source per line, with the most preferred source listed first. The format of a sources.list entry is:

     deb uri distribution [component1] [component2] [...]

The URI for the deb type must specify the base of the Debian distribution, from which APT will find the information it needs. distribution can specify an exact path, in which case the components must be omitted and distribution must end with a slash (/). This is useful for when only a particular sub-section of the archive denoted by the URI is of interest. If distribution does not specify an exact path, at least one component must be present. The currently recognized URI types are cdrom, file, http, and ftp.

file
The file scheme allows an arbitrary directory in the file system to be considered an archive. This is useful for NFS mounts and local mirrors or archives.
cdrom
The cdrom scheme allows APT to use a local CDROM drive with media swapping. Use the apt-cdrom(8) program to create cdrom entires in the source list.
http
The http scheme specifies an HTTP server for the archive. If an environment variable $http_proxy is set with the format http://server:port/, the proxy server specified in $http_proxy will be used. Users of authenticated HTTP/1.1 proxies may use a string of the format http://user:pass@server:port/. Note that this is an insecure method of authentication.
ftp
The ftp scheme specifies an FTP server for the archive. APTīs FTP behavior is highly configurable; for more information see the apt.conf(5) manual page.
copy
The copy scheme is identical to the file scheme except that packages are copied into the cache directory instead of used directly at their location. This is usefull for people using a zip disk to copy files around with APT.

A few examples:

     deb http://www.debian.org/archive stable main contrib

Uses HTTP to access the archive at www.debian.org, and uses the stable/main and stable/contrib areas.

     deb ftp://ftp.debian.org/debian unstable main contrib non-free

Uses FTP to access the archive at ftp.debian.org, under the /debian directory, and uses the unstable/main, unstable/contrib and unsunstable/non-free areas.

     deb ftp://ftp.debian.org/debian stable main

Uses FTP to access the archive at ftp.debian.org, under the /debian directory, and uses the stable/main area.

If this line appears as well as the one in the previous example in sources.list, a single FTP session will be used for both resource lines.

     deb file:/home/vincent/debian stable main contrib non-free

Uses the archive stored locally (or NFS mounted) at /home/vincent/debian for stable/main, stable/contrib, and stable/non-free.


14.3.2 Using apt-get.

apt-get is the command-line tool for handling packages, and may be considered the user's "back-end" to apt. apt-get is very straightforward to use.

     apt-get [options] [command] [package ...]

Where command is one of:

update
update is used to resynchronize the package overview files from their sources. The overviews of available packages are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and updated packages is available. An update should always be performed before an upgrade dist-upgrade.
upgrade
upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An apt-get update must be performed first so that apt-get knows that new versions of packages are available.
dist-upgrade
dist-upgrade, in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files.
install
install is followed by one or more packages desired for installation. Each package is a package name, not a fully qualified filename (for instance in a Debian GNU/Linux system, lsdo would be the argument provided, not ldso_1.9.6-2.deb). All packages required by the package(s) specified for installation will also be retrieved and installed. The /etc/apt/sources.list file is used to locate the desired packages. If a hyphen is appended to the package name (with no intervening space), the identified package will be removed if it is installed. This latter feature may be used to override decisions made by apt-get's conflict resolution system.
remove
remove is identical to install except that packages are removed instead of installed. If a plus sign is appended to the package name (with no intervening space), the identified package will be installed.
check
check is a diagnostic tool; it updates the package cache and checks for broken packages.
clean
clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.

The most usefull options are:

-m
Ignore the missing packages if any.
-d
Only downloads the necessary packages, but don't install them.
-f
Fix broken dependancies; Run apt-get -f install to just automagically repair the dependancy problems on your system.

14.4 Using dselect.


14.5 Using dpkg manually

The simplest way to install a single package you've downloaded is the command dpkg -i (short for dpkg --install). Say you've downloaded the package icewm_0.8.12-1.deb and you'd like to install it. First log on as root, then type:

     dpkg -i icewm_0.8.12-1.deb

and icewm version 0.8.12 will be installed. If you already had an older version, dpkg will upgrade it rather than installing both versions at once.

If you want to remove a package, you have two options. The first is most intuitive:

     dpkg -r icewm

This will remove the icewm package (-r is short for --remove). Note that you give only the 'icewm' for --remove, while --install requires the entire .deb filename.

--remove will leave configuration files for the package on your system. A configuration file is defined as any file you might have edited in order to customize the program for your system or your preferences. This way, if you later reinstall the package, you won't have to set everything up a second time.

However, you might want to erase the configuration files too, so dpkg also provides a --purge option. dpkg --purge icewm will permanently delete every last file associated with the icewm package.


14.6 Compiling software yourself

You'll have to have -dev packages installed.

Put it in /usr/local, /opt, or your home directory.

The configure --prefix; make; make install routine.


14.7 Proprietary software not in .deb format

What to do with this annoying stuff (wrapper packages, /usr/local)


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ 16 ] [ 17 ] [ 18 ] [ A ] [ B ] [ C ] [ D ] [ next ]

Debian Tutorial


17 June 2006

Havoc Pennington [email protected]