blog posts

Linux: Package Management In Linux

This post teaches you how to install, remove, Update, and search for software packages using the apt-get and apt-cache commands in Debian-based Linux distributions, such as Ubuntu, Debian, and Mint.
In this post, we provide proper instructions to help you manage packages in Debian and Ubuntu systems.

What is apt-get?

Apt-get software is a compelling and free command-line program for package management. Moreover, people use this software to work with the APT Library in Ubuntu, which stands for Advanced Packaging Tool.
Runs new software packages, deletes existing software packages, updates existing software packages, or even upgrades the entire operating System.
Users use the apt-cache Command to search the cache of the apt software package. Users use this tool to search for software packages, collect package information, and find existing packages ready to install for the Ubuntu or Debian operating System

$ apt-cache pkgnames

esseract-ocr-epo
pipenightdreams
mumudvb
tbb-examples
libsvm-java
libmrpt-hmtslam0.9
libboost-timer1.50-dev
kcm-touchpad
g++-4.5-multilib

5 Useful basic commands from apt-cacheLinux

How to list all available packages in LinuxLinux

How to find the package name and software description

To find the package name along with the description before installing it, we must use the search option. Using apt-cache, a search will display a list of matching packages along with a brief description. For example, to find the description of the vsftpd package, run the following Command:

PHP code:

$ apt-cache search vsftpd

vsftpd - a lightweight, efficient FTP server written for Security

ccze - A robust, modular log coloriser

ftpd - File Transfer Protocol (FTP) server

Yasat - simple, stupid audit tool

Moreover, run the following Command to find and list all packages starting with vsftpd:

PHP code:

$ apt-cache pkgnames vsftpd

vsttpd

How to check the package information

In the beginning, if we want to check the package information along with short descriptions (version number, summary, size, installation size, group, etc.), we must execute the following Command:
PHP code:

$ apt-cache show netcat

Package: netcat
Priority: optional
Section: universe/net
Installed-Size: 30
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Ruben Molina <rmolina@udea.edu.co>
Architecture: all
Version: 1.10-40
Depends: netcat-traditional (>= 1.10-39)
Filename: pool/universe/n/netcat/netcat_1.10-40_all.deb
Size: 3340
MD5sum: 37c303f02b260481fa4fc9fb8b2c1004
SHA1: 0371a3950d6967480985aa014fbb6fb898bcea3a
SHA256: eeecb4c93f03f455d2c3f57b0a1e83b54dbeced0918ae563784e86a37bcc16c9
Description-en: TCP/IP Swiss Army Knife -- transitional package
This is a "dummy" package that depends on Lenny's default version of
 netcat, to ease upgrades. It may be safely removed.
Description-md5: 1353f8c1d079348417c2180319bdde09
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

How to check the dependencies of a particular package

The showpkg option for the apt-cache Command checks the prerequisite packages for the desired software. Also, whether these prerequisite packages are installed on the System or not. To do this, run the following Command:

PHP code:

$ apt-cache showpkg vsftpd

Package: vsftpd
Versions:
2.3.5-3ubuntu1 (/var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_quantal_main_binary-i386_Packages)
 Description Language:
                 File: /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_quantal_main_binary-i386_Packages
                  MD5: 81386f72ac91a5ea48f8db0b023f3f9b
 Description Language: en
                 File: /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_quantal_main_i18n_Translation-en
                  MD5: 81386f72ac91a5ea48f8db0b023f3f9b

Reverse Depends:
  ubumirror,vsftpd
  harden-servers,vsftpd
Dependencies:
2.3.5-3ubuntu1  - debconf (18 0.5) debconf-2.0 (0 (null)) upstart-job (0 (null)) libc6  (2 2.15) libcap2 (2 2.10) libpam0g (2 0.99.7.1) libssl1.0.0 (2 1.0.0)  libwrap0 (2 7.6-4~) adduser (0 (null)) libpam-modules (0 (null)) netbase  (0 (null)) logrotate (0 (null)) ftp-server (0 (null)) ftp-server (0  (null))
Provides:
2.3.5-3ubuntu1 - ftp-server
Reverse Provides:

How to check the cache

In Linux

First, the stats option will display all cache statistics. For example, the following Command will display the total number of package names in the cache:

PHP code:

$ apt-cache stats

Total package names: 51868 (1,037 k)
Total package structures: 51868 (2,490 k)
  Normal packages: 39505
  Pure virtual packages: 602
  Single virtual packages: 3819
  Mixed virtual packages: 1052
  Missing: 6890
Total distinct versions: 43015 (2,753 k)
Total distinct descriptions: 81048 (1,945 k)
Total dependencies: 252299 (7,064 k)
Total ver/file relations: 45567 (729 k)
Total Desc/File relations: 81048 (1,297 k)
Total Provides mappings: 8228 (165 k)
Total globbed strings: 286 (3,518 )
Total dependency version space: 1,145 k
Total slack space: 62.6 k
Total space accounted for: 13.3 M