What is Package Management ?

Things you should know

deb [web address] [distribution name] [options]

deb http://in.archive.ubuntu.com/ubuntu breezy main restricted

Managing software in Debian

Dpkg, and Advanced Packaging Tools or APT

Dpkg - The low level package management tool

dpkg -i <package-name>

# dpkg -i gedit-2.12.1.deb

dpkg [-r | -P] <program name>

# dpkg -r gedit

# dpkg -P gedit

# dpkg -c gedit-2.12.1.deb

# dpkg -I gedit-2.12.1.deb

# dpkg -s gedit

# dpkg -L gedit

Advanced Packaging Tool (APT)

apt-get

# apt-get update

This is a short tutorial (Primer) on usingandtools toin Debian and, Debian-based Linux distributions such as Ubuntu.A 'Package Management System' or 'Package Manager' is a collection of tools used to automate the process of installing, updating, configuring, and removing of software packages for a computer's operating system in a consistent manner. Different operating systems have their own package managers. For instance, this is a list of package management tools used by different operating systems. [Courtesy: Wikipedia]Debian uses thepackage format for packing together files belonging to an application. You can look at it as something like the Setup installer (Eg: Installshield) in Microsoft Windows.Software meant to be installed in Debian Linux has the file extension ''.Debian, (and most other Linux distributions), use a publicly accessible place on the Internet - called a- to store all their software packages.The filecontain a list of web addresses pointing to the Debian repository.The web address has the following syntax :An example of a web address pointing to the Ubuntu repository is shown below.Debian (and related) Linux (distributions) use two important command line tools to manage deb packages. They are -Here are a few ways of using dpkg in Debian Linux.Example : Let's say you want to install Gedit text editor in Debian and you have downloaded its deb package from the Gedit website. The package is named gedit-2.12.1.deb. To install it in Debian, open a terminal and move to the directory containing the deb file and execute the command :You can also useinstead ofTo remove an installed package, the syntax is :- Will remove the program but leave its configuration files intact. You can also useinstead of -r.- Will completely remove the package including the configuration files. You can also useinstead of -P.Continuing with the previous example, to remove Gedit (but not its configuration files) from Debian -To remove Gedit completely -To see the contents of a deb package (Eg: gedit-2.12.1.deb), use theoption.To get more information about a deb package such as - the authors name,the year of compilation, a short description of its use, and so on, use theoption.To check if a program is installed in Debian, use theoption.The above command also provides other details about the program such as the package maintainer, dependencies, installed version, a small description of the package and so on.To know where all the files associated with a program are installed, use theoption.APT is the Advanced Package Tool and provides theprogram.provides a simple way to retrieve and install packages from multiple sources using the command line.Unlike dpkg, apt-get does not understand .deb files, it works with the packages proper name and can only install .deb archives from a source specified in '/etc/apt/sources.list'.apt-get will call dpkg directly after downloading the .deb archives from the configured sources.Some common ways to using apt-get are shown below :To update the list of packages known by your system, do the following :

You should update your package lists regularly by running the above command.

# apt-get upgrade

# apt-get install gedit

# apt-get remove gedit

# apt-get --purge remove gedit

# apt-get dist-upgrade

# apt-get clean

# apt-get autoclean

apt-cache

$ apt-cache search editor

apt-cache show <package name>

apt-cache depends <package name>

apt-cache showpkg <package name>

$ apt-cache stats

To upgrade all the installed packages on your system -To install the gedit package and all its dependencies -To remove the gedit package from your system -To remove gedit and also its configuration files -Upgrading Debian to a new version can be done with the command -Each time you install an application using apt-get, the corresponding deb package is downloaded and stored in a location on your hard disk - usually in the directory '/var/cache/apt/archives/'.The following command will remove all the archives and free up hard disk space -To delete only those packages in the cache which are found useless or partially complete, do -Another tool in the APT tool suite istool can be used to search for and find packages, and it supports use of regular expressions.To find all packages that contain the word "editor", do the following -To print detailed information about a package, the syntax is -To print the packages that a given package depends on, the syntax is -To print detailed information of the versions available for a package and the packages that reverse-depends on it -To get statistics of the packages available in the repositories -I hope you have enjoyed reading this concise tutorial on apt-get and dpkg which will help you manage the packages in Debian Linux.