Debian installs it’s software in the form of .deb files.  These .deb files contain software, configuration files, documentation, and dependency information.

First, we’ll get some of the common terminology taken care of, then we’ll discuss package management using apt-get, and finally, package management using deb files.

 

Packages

Packages in this case refers to software in the form of .deb bundles.  Packages contain compressed archives with files, documentation, management scripts, and dependency information.

Sources

Sources refer to a location containing software packages.  Apt-get uses software repository locations to automatically install the correct package or series of packages.

Dependencies

Dependencies refer to libraries or other pieces of software necessary for any given software to run.  For example, you want to install somepackage-0.123-4.i386.deb.  In order for this software to install, any software that it needs to run will need to be installed either automatically through apt-get or by manually installing a .deb file.

Package Naming Conventions

Proper deb packages adhere to a standard naming convention.  The name may seem a bit long, but knowing how to identify a package based on it’s naming convention helps considerably when trying to find the correct software.  Packages are usually referred to using the following naming convention, in this example we’re using the package “screen”

 

packagename_version_architecture.deb

 

in our example, the package “screen” is

 

screen_4.0.3-0.3+b1_i386.deb

 

Working with Debian Packages

 

There are two main considerations for package management in Debian:  dpkg and apt.  The dpkg command is used to manipulate (create, query, install, etc) .deb packages.  The apt command set allows you to install packages from remote sources, whereas dpkg is used on .deb files that are already downloaded to your system.  The best way to think about apt versus dpkg is that apt extends dpkg so that if a package requires dependencies, apt will attempt to fetch and install them in order to install the requested package.  Here I will show you some examples of common package management in Debian:

 

First update your apt-cache sources

apt-get update

 

Update all available pacakages on your system

apt-get upgrade

 

To install a pacakge, in this case screen

apt-get install screen

 

To remove screen but keep it’s configuration files

apt-get remove screen

 

To completely remove screen including it’s configuration files

apt-get –purge remove screen

 

To list all pacakages installed on a system

dpkg -l

 

To list the current version of a particular pacakge on a system, in this case screen

dpkg -l | grep ‘screen’

 

To search for pacakages that match a description, in this case ‘nids’

apt-cache search ‘nids’

 

To show general information about a package, in this case “harden-nids”

apt-cache showpkg harden-nids

 

To install a .deb file already downloaded to your server

dpkg -i package.deb

 

To remove a .deb file

dpkg -r package.deb


To remove all leftover .deb files after updates/upgrades

apt-get autoclean

 

For more information on Debian package management check the Debian FAQ – Basics of Debian package management system by accessing the URL as follows:

http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html