Apt stands for the Advanced Package Tool, and is the tool of choice of most Debian users. The apt system is comprised of:
- The configuration file
- /etc/apt/sources.list
- apt-get, apt-cache and apt-cdrom
A typical entry looks like:
deb ftp://ftp.ca.debian.org/debian/ woody main non-free contrib
You can make apt aware of debian packages that are on your cdrom by using apt-cdrom. When you useapt-cdrom addapt-cdrom will mount your cdrom drive (assuming that /dev/cdrom is linked correctly), scan it and create the correct entry in /etc/apt/source.list.
apt-get is prolly the tool of choice among most people. To install a package an automatically meet its dependencies, use apt-get install pkg-name. If there are other packages to be installed because of dependencies, apt will let you know before downloading them. If you install a deb without meeting the requirements, or a problem is encountered during install or removal, very often you won't be able to work with dpkg until the problem is resolved. If that happens, you can use apt-get -f install, which will work everything out and ask questions as it goes along.To remove a package, use apt-get remove pkg-name.
To download the source code of a package, use apt-get source pkg-name. You can even compile it by using aptget source --build pkg-name.
If you want to clean out hte archives, there are two options. To remove all archives, the command is apt-get clean. You'll want to do that if you find /var filling up, since apt-get caches packages when it downloads them. If you want to remove only the old archives, apt-get autoclean.
To upgrade your system to the newest versions of the packages, do apt-get upgrade (first perform apt-get update. To upgrade to a new version of debian, it's apt-get dist-upgrade. It will automatically work out dependencies for packages whose names might have changed. You may need to run apt-get dist-upgrade a few times till apt-get doesn't download anything new. This is to work out dependencies and configuration requirements. There's no way to downgrade.
A few other command-line options are helpful when using ap-get. -d only downloads archives, but doesn't try to unpack or install them. -s is for simulation; it's good for situations where you want to see what would happen if you did something, but don't actually want the operation performed. -y answers yes to all questions and -b tries to build a source package after downloading it.
apt-get also understands regex. For example:
- apt-get install '.*mame.*'
- apt-get install '^pilot.*'
apt-cache is used to garner information about packages which aren't installed on your system.There are command line options like
- apt-cache show package: Print various information about the package, including dependencies, full name, what it provides, size when unpacked and the long and short descriptions.
- apt-cache depends package: What other packages need to be installed for this package to work correctly.
- apt-cache pkgnames: List all packages that are currently available.
- apt-cache search string: Search thourgh all package names and descriptions for the string.
- -i: List only important dependencies.
- -f: Print full records after a search
- --names-only: Limit searches to package names.
There are a number of front ends to apt-get and apt-cache.
dselect is a frontend to dpkg that uses the console based ncurses library for an interface. Most people prefer apt/dpkg to dselect; even the man page for dselect mentions that the dselect interface is confusing or even alarming. Running dselect puts you in the main menu that has various options.The first option, "Access", selects how dselect will access the packages you want to install. It should be straight forward. Most of the time you'll want apt (if you have a net connection) or cdrom (if you don't).
The next option, "Update" is used to update dselect's knowledge of what packages and package versions are available. You don't actually need to use the interface to update dselect's knowledge of the package database. From a command line, you can simply type dselect update and dselect will update its database without starting the ncurses interface. It'll exit as soon as the database is updated.
The third option, "Select", lets you choose which packages you want to install or remove. Unless you run dselect with the "--expert" command line option, immediately after choosing this option, dselect will display a rather confusing help screen (in fact, I would recommend running dselect with "--expert" whether you're an expert or not. If you ever want to look at the help screen, you can always press "?" to view it). To exit out of the help screen and enter the package selection/deselection screen, press <space>. Now you're ready to select. Here are some useful keystrokes for the the select/deselect screen:
Even the man page claims that dselect doesn't handle "Recommends" very well. It's easy to get into a situation where dselect undoes what apt-get just did. It's somewhat tyrranical with regard to what it thinks is a dependency conflict. You can always force the issue, but it's hard getting past dselect's melodrama. Frankly, I would highly recommend not using dselect. Just pretend it doesn't exist.
- /: Search
- \: Repeat the last search
- ?: Brings up the help screen
- d: Scrolls down the package information
- u: Scrolls up the package information
- +: Install or upgrade the currently highlighted package
- -: Remove the currently highlighted package
- =: Leave the currently highlighted package in its current state.
This is a very simple way to recompile your kernel. One of the main benefits is that the kernel itself now belongs to the Debian package management system. The first thing you need to do is make sure that kernel-package is installed. Here is a description of that package:This package provides the capability to create a debian kernel-image package by just running make-kpkg kernel_image in a kernel source directory tree. It can also build the kernel source package as a debian file, the kernel headers package. In general, this package is very useful if you need to create a custom kernel, if, for example, the default kernel does not support some of your hardware, or you wish a leaner, meaner kernel.If you are running on an intel x86 platform, and you wish to compile a custom kernel, then you may need the package bin86 as well. (This is not required on other platforms).
- Install the kernel-package package by apt-get install kernel-package.
- Download the latest kernel source from www.kernel.org to /usr/src.
- Unpack the source; go into the top level directory.
- Create your kernel configuration as usual with a make oldconfig and/or make menuconfig.
- Execute make-kpkg kernel_image. The kernel will begin to compile automatically. Get some coffee.
- Assuming the compilation was succesful, you'll find a .deb package in /usr/src. Install it with dpkg -i.
- Follow the instructions. Don't forget to edit /etc/lilo.conf and run /sbin/lilo. You may need to make a link to /boot/System.map, but it's not crucial.
Prev: dpkg | Up: Peter's Debian Notes | Next: None |
Mail corrections, suggestions and kudos to: p@dirac.org