Though most of the packages are available to download directly on Ubuntu systems, there are times when you’d need to take up a Debian package file (.deb file) for installation. In this tutorial we will learn certain ways to install .deb files on Ubuntu.
Using the dpkg Command to Install deb Files
In short for “Debian Package Manager”,
'dpkg' has the sole purpose of installing and managing Debian (.deb) packages in Linux. After having successfully downloaded or transferred a Debian package on our system, comes the installation part.
Install deb files on Ubuntu using the dpkg command
We can install it by:
sudo dpkg -i [FILE-NAME].deb
Here the option
'-i' refers to installing the specified file.
While running the above command, the user has to keep in mind that the current working directory is the one having the .deb file. Otherwise, using a relative or absolute path along with the name of the file works too.
sudo dpkg -i [PATH]/[FILE-NAME].deb
Solving Dependency problems
It may happen that Ubuntu might not have certain dependencies to properly configure the application. Then while installation, the terminal looks like this:
To solve the dependency issues, we can use the following command:
sudo apt install -f
'--fix-broken' option fixes the broken dependencies of the system.
Uninstallation of deb files
Suppose the application installed is not worth the user’s time, they can uninstall it using
'dpkg' command by:
sudo dpkg -r [APPLICATION-NAME]
Installing .deb files using the apt command
apt command is one of the most powerful tool in Ubuntu. Not only does it install local Debian packages, but it is also used to install packages from remote repositories. It also comes into play when upgrading the Linux system.
Installation of deb files
To install a .deb file on our system, we run the following command:
sudo apt install [PATH]/[FILE-NAME].deb
'apt' command goes one step further than installing the application, it first checks for any latest versions of the application in its repository. Before using
'apt', we can check for available version in the repository by:
apt-cache policy [APPLICATION-NAME]
In the above figure, we can see the
'apt' command prioritising the latest version.
Uninstallation of deb files on Ubuntu
To uninstall an application using
'apt' command, we type:
sudo apt remove [APPLICATION-NAME]
Along with uninstalling the application,
'apt' command also displays the dependencies that are not required.
In the figure, these are mainly those dependencies that were necessary for running Steam. After uninstalling it,
'apt' suggests the removal of the dependencies as well. It can be safely done by
'sudo apt autoremove'.
Using the gdebi command to install deb files
If we are too tired of the hassle of checking dependencies for installing Debian packages, then Ubuntu supports the
'gdebi' command. This command takes care of any issues of installing libraries and background files.
To make use of this command, we must first install it using:
sudo apt install gdebi-core
'gdebi' command, we can easily install the .deb files by:
sudo gdebi [PATH]/[FILE-NAME].deb
As seen in the output,
'gdebi' itself notifies the packages that the .deb file depends upon. After mentioning the background information, the command asks the user for the final decision.
GUI Installation of Debian Package Files on Ubuntu
Instead of following the command line way of installing .deb files, Ubuntu provides a graphics-based installation application in the name of “Ubuntu Software”. It can be accessed by right-clicking on any .deb file in Ubuntu.
After selecting the option, the Ubuntu Software Installer looks like this.
Not only does it allows us to install a .deb file, but it also provides basic information about the application. Pressing the install button and entering the password, does the job for us.
Honestly, there is not much into the installation of Debian packages on Ubuntu. We hope this article provides you the runway to a fruitful Linux experience. If we have missed some techniques, do let us know. We hope this article was up to your expectations. In case, you are stuck in any installation using the above commands, feel free to ping us through the comments.