The Deb package file is the official file format of an installable software bundle in Debian and Debian-based Linux distributions. A
.deb is the extension of these package files and dpkg (Debian package manager) is the utility to install these packages.
A Deb package contains files required by the specific software and metadata files. Metadata files contain information like the version number, dependencies, etc.
In Ubuntu, the standard way of installing packages is not using ‘dpkg‘ though, but instead, it uses the apt package manager, which downloads the package, and also downloads packages for all its dependencies, indirectly calls ‘dpkg‘ and then installs the package and all its dependencies.
Let us see how we can take a single
.deb package and install it properly in Ubuntu and other Debian-based Linux distributions.
Installing .deb Package in Ubuntu
Run dpkg command with the
'-i' (Install) an argument to install a particular package.
$ sudo dpkg -i deb_package_filename.deb
After running this command, one of two things can happen:
- The package installs successfully without errors. This is the case when the dependencies for the package are already installed in your Ubuntu system.
- The package installs with failed status as dependencies for the package are not met completely. This is the more likely scenario, as most packages are dependent on things that are rarely used for any other purpose.
Let’s take the example of the
.deb package for ‘Cython‘ (A wrapper for C programming language in Python). This package depends on two packages: Python and LibC.
$ sudo dpkg -i cython_0.29.2-2_amd64.deb
Notice the error messages. It says that Cython could not be configured due to missing dependency ‘Python‘. If Python were already installed, the installation would not give any errors.
In such case, run the following apt command to install all missing dependencies for a package:
$ sudo apt -f install
It is pretty clear from the log that apt identified the missing dependency Python, installed and configured it, and also finished the configuration step for Cython (last line of the log).
Verify if the package is installed by calling with
'--version' argument (to show the version).
$ cython --version
We learned about the simple command
'dpkg -i' to install a
.deb package in Ubuntu, and the command ‘apt -f install‘ to install unmet dependencies automatically.
Find out more about various options in ‘dpkg‘ in its command line manual page by running:
$ man dpkg
Thanks for reading and do let us know your thoughts in the comments below!