On Debian based Linux distributions such as Debian GNU/Linux, Ubuntu, Linux Mint and others, APT package manager is used. The package format of APT package manager is DEB archive. The extension of a DEB archive is .deb.
These days, most of the common software packages are available in the official package repository of the Linux distribution we are using. So we can easily install it using the package manager, in case of Ubuntu/Debian the APT package manager. But there are still times when a software we want is not available in the official package repository and we have to download the DEB package file from the official website of that software and install it on our Ubuntu/Debian operating system manually.
In this article, I am going to show you how to install a DEB file on Ubuntu. I am going to use Ubuntu 18.04 LTS for the demonstration. Let's get started.
Installing DEB File from the Command Line:
You can use the dpkg command on Ubuntu to install a DEB file.
I downloaded the Apache 2 web server DEB file from https://packages.ubuntu.com just for the demonstration. Of course you can install it with APT package manager very easily. But I will show you how to install the it from the DEB file.
Now open a Terminal in the same directory as your DEB file. As you can see, the DEB file is available in the directory.
Now install it with the following command:$ sudo dpkg -i apache2_2.4.29-1ubuntu4.1_amd64.deb
As you can see, the installation failed because the dependencies could not be resolved. The DEB package apache2 depends on apache2-bin, apache2-utils, apache2-data none of which are installed.
Now to resolve the dependencies, you have to install these packages first before you can install apache2 package.
Luckily for us, the dependency packages are available in the official package repository of Ubuntu. So all we need to do is run the following command:$ sudo apt -f install
As you can see, the APT package manager resolved all the dependencies automatically. Now press y and then press
The package apache2 should be installed.
As you can see, Apache 2 works.
At times, the dependency packages won't be available in the official package repository of Ubuntu. In that case, you have to find the required DEB packages on the internet and install it using dpkg as well. You will also have to resolve any dependency these dependency packages will have as well. This gets harder and harder as dependency increases and is very impractical for DEB files that has many dependencies.
Installing DEB File Using Ubuntu Software Center:
You can also install a DEB file using Ubuntu Software Center. Just right click on the DEB file and click on Open With Software Install.
Now click on Install.
Now type in your password and click on Authenticate.
The dependencies should be automatically resolved if it is available in the Ubuntu package repository and the software should be installed.
Once the installation is complete, you should see the following window.
If any dependency package is not available in the official package repository of Ubuntu or in any of the packages repositories you added through PPA, then the installation will fail. In that case, you will have to find and install the dependency packages manually as well.
So that's how you install a DEB file on Ubuntu. Thanks for reading this article.