Package Management In Debian(.deb) Based Linux Distributions
This post was last updated on January 27th, 2020 at 09:46 am
A software package is an archive file of compiled and built source code with necessary metadata for its deployment. The metadata of the package consist of dependencies, package version, and about the software. For example – the .deb packaging is used for Debian based Linux Distributions while .rpm packaging is used in Red Hat, Fedora, and other related distributions.
A package manager is a collection of software tools that automate the process of installation, configuration, up-gradation and removal of software packages in an operating system. It keeps the information about dependencies and software version to avoid the inconsistency and version mismatch. These are designed to increase the user-friendliness of the system as it removes the need for manual installation, update and removal of a software package.
Advanced Packaging Tools (apt)
The apt provides a command-line interface to interact with core libraries of OS for the installation, up-gradation, and removal of a package. It can be considered as the front end to dpkg which is used in Debian, Ubuntu, and its derived Linux distributions. A .deb packaged software is used in these systems. Some important commands related to apt are given below:
apt-get install package_name – This command is used to install package(s) along with dependencies
apt-get remove package_name – Used to remove the installed packages
apt-get autoremove – Remove the dependencies that are no longer needed
apt-get clean – Remove the downloaded software files that are already installed
apt-get purge package_name – This will remove the software and clean modified user configuration files that were left after the removal of software.
apt-get update– Used to download the package information from the all configured sources.
apt-get upgrade – Used to install available upgrades of all packages currently installed on the system form the source configured via source.list which resides in /etc/apt directory it should run after update.
apt-cache search package_name – Search performs a full-text search on all available package lists and shows a list of related packages and their description
apt-cache show package_name – Shows description of dependencies, version, size, origin, etc.
apt-cache pkgnames – Shows the complete list of installed software on the system
apt-cache depends package_name – Shows the listing of each dependency a package has and all the possible other packages that can fulfill that dependency
apt-cache rdepends package_name – Shows a listing of each reverse dependency a package has.
Difference between apt and apt-get commands-
The first version of apt binary was introduced in Debian Jessie(version 8), the functionality of apt-get and apt-cache get merged into the new apt tool which has fancier colored output and is more pleasant for the end-users. That means some popular commands like apt-get update, apt-get install, apt-cache search or apt-get remove now can also be simply called as apt update, apt install, apt search or apt remove. The following is an overview of the old and their equivalent new commands:
|OLD COMMANDS||NEW COMMANDS|
Please note that for usage in scripts or advanced use cases, apt-get is still preferable or needed. It is the preferred program for package management from console to perform system installation and major system upgrades.
It is also used to install, remove and perform such other operations on .deb file. The dpkg is a low-level tool it works with downloaded files unlike apt which can fetch the packages from a remote location and can resolve dependencies.
dpkg -i downloaded_package_name.deb – Install a .deb file that is stored in systems memory.
dpkg --list string_to_search – list the related packages that are installed on a system
dpkg --unpack package_file_name – Unpack the downloaded file but not configure it
dpkg --configure package_name – Configure a package which has been unpacked but not yet configured
dpkg --reconfigure package_name – It will reconfigure the installed package.
For more such command you can access the dpkg manual page in your terminal by using
$man dpkg command.
Aptitude is a high-level interface to the package manager. It provides a terminal menu interface that is not provided by apt. It is a transaction based package management service. If you consider only command-line interfaces apt and aptitude are quite similar to each other. Installation, removal, up-gradation of a package can be performed with a single key command. To access the aptitudes terminal menu type the command
$sudo aptitude into your terminal and press the enter.
Now the terminal menu will look something like this-
To install updates select from the menu and press u, to quit from the aptitude menu press q and select yes it will bring you to the command prompt.
You might also like
When you are starting to learn Linux programming or Device driver development, then the first thing you need is the Linux Kernel which is available in a zipped archive format
This post was last updated on January 22nd, 2019 at 11:06 amSometimes you need to unload a kernel module to load your own written code or you want to replace
This post was last updated on November 6th, 2016 at 12:32 amSometimes you wanted to change the Hostname on a Linux machine like on your Ubuntu PC or a Fedora