How to install .deb files on Ubuntu?

Ubuntu and it’s derivative Linux distributions usually have a very simple way of installing packages. Just look up the application name you want to install in the official Software Center and hit the big green install button. However, not every application is available in the official, or Universe repositories of Ubuntu, and hence several developers have started to provide a DEB file on their application’s official website as a method of installing their application. So, how do you install .deb files on Ubuntu? In this tutorial, we’re taking the example of the Steam application, however you can install any application in a similar manner.

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 on Debian based Linux distributions like Ubuntu, Linux Mint and PopOS. 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
Dpkg Install Filename
Installing Steam application

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
Dpkg Install Path
Using relative path for installation

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:

Dpkg Depend Prob
Dependency issues while installing

To solve the dependency issues, we can use the following command:

sudo apt install -f
Dpkg Dep Soln
Fix dependency issue

The '-f' or '--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]
Dpkg Remove
Removing application by ‘dpkg’

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 Install Deb
Installing steam using ‘apt’

'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]
Apt Available Version
Steam versions available

In the above figure, we can see the 'apt' command prioritising the latest version.

Apt Install
Selection of latest version

Uninstallation of deb files on Ubuntu

To uninstall an application using 'apt' command, we type:

sudo apt remove [APPLICATION-NAME]
Apt Remove
Removing steam using ‘apt’

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

Using the 'gdebi' command, we can easily install the .deb files by:

sudo gdebi [PATH]/[FILE-NAME].deb
Gdebi Install 1
Installing Steam using ‘gdebi’

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

Note that this method only works on Ubuntu version 23.04 and below. For newer releases, consider GDebi GUI or use APT or DPKG commands to install the DEB files.

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.

Gui Install
Selecting Ubuntu Software

After selecting the option, the Ubuntu Software Installer looks like this.

Gui Install Main
Details regarding Steam

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.


Conclusion

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.