...making Linux just a little more fun! |
By Rob Tougher |
APT stands for the Advanced Packaging Tool - it is a package management system for Debian GNU/Linux. In Part 1 of this series, I described how to use APT to install Debian software on your machine. If you are unfamiliar with APT, you should read that first.
Part 1 focused on installing only released versions of Debian's software packages. Besides the released versions, Debian provides unreleased packages for people who need the latest versions of software. This article describes how to install these unreleased packages.
In the last article I introduced two concepts: the package, and the package cache. Now I am introducing a third: the distribution. A distribution is a collection of packages, installation scripts, user documentation, and configuration applications unique to Debian.
There are three Debian distributions:
stable
- the released version.
testing
- the candidate for the next release.
unstable
- the development version.
The stable
distribution is the released version of Debian. The packages in stable
have been tested thoroughly. Most of the packages installed on my machine come from the stable
distribution.
The testing
distribution is the candidate for the next release.
Packages in this distribution have undergone some testing, but require more testing before they can
be released.
When testing
is ready, it becomes the stable
distribution, and the
old stable
distribution is moved to archives.
The unstable
distribution is the development distribution. Debian volunteers update it continuously.
The packages in unstable
may not have been tested at all, and may not work.
After a package has undergone some testing, it gets moved to the testing
distribution.
A software package can exist in one or more of these distributions. For example, the php4
package is contained in all three. In stable
its version is 4.1.2,
in testing
its version is 4.1.2, and in unstable
its version is 4.2.3.
I currently have version 4.1.2 installed on my machine - if I needed version 4.2.3, I could install it
from the unstable
distribution.
To get your machine ready to install software packages from testing
or unstable
, you have to perform the following steps:
/etc/apt/sources.list
to include the distribution
/etc/apt/apt.conf
to make
the stable
distribution the default
apt-get update
sources.list
keeps a list of sources for Debian software.
In the last article we had 7 CDROM sources and 2
HTTP sources. Now let's add two more HTTP sources - one for the
testing
distribution and one for the unstable
distribution.
My sources.list
file now looks like the following:
# Two new sources deb http://http.us.debian.org/debian unstable main contrib non-free deb http://http.us.debian.org/debian testing main contrib non-free # Sources from last article deb http://security.debian.org/ stable/updates main deb http://http.us.debian.org/debian stable main contrib non-free deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-6 (20020718)]/ unstable contrib main non-US/contrib non-US/main deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-7 (20020718)]/ unstable contrib main non-US/contrib non-US/main deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-5 (20020718)]/ unstable contrib main non-US/contrib non-US/main deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-4 (20020718)]/ unstable contrib main non-US/contrib non-US/main deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-3 (20020718)]/ unstable contrib main non-US/contrib non-US/main deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-2 (20020718)]/ unstable contrib main non-US/contrib non-US/main deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-1 (20020718)]/ unstable contrib main non-US/contrib non-US/main
Next you modify apt.conf
so that you still
use packages from stable
by default. My
apt.conf
file looks like the following:
# Make 'stable' the default distribution APT::Default-Release "stable";
To finish the initial setup call apt-get update
. This will download the
latest package information, and update your local package cache.
Let's continue our example from last section. The stable
distribution contains version
4.1.2 of the php4
package. Let's say you wanted version 4.2.3 - maybe
it contained some new feature you needed. You could install this package using the following command:
prompt$ apt-get -t unstable install php4
This would install version 4.2.3 of the php4
package. Note the -t switch on the command line -
this is telling APT that it is allowed to use packages from the unstable
distribution. If
you didn't include the -t switch, APT would be unable to install version 4.2.3 of the package, because the
stable
distribution is your default.
You can upgrade your testing
and unstable
packages by
using the apt-show-versions
command:
prompt$ apt-get install `apt-show-versions -u -b | grep testing`
You can downgrade packages on your machine. This means that if you have a testing
or
unstable
package installed, and you don't want it any more, you can downgrade the package
to the latest stable
version.
Before being able to downgrade, you must make an entry in your
/etc/apt/preferences
file. The entry
looks like the following:
Package: php4 Pin: release a=stable Priority: 1001
Once you make this entry you can run the following command to downgrade a package:
prompt$ apt-get update
APT is a powerful package management system. It allows you to install, maintain, and remove
software applications from your Debian system. In this article I focused on installing software from
Debian's unreleased distributions, testing
and unstable
.
Rob is a software developer in the New York City area.