How to Install and Uninstall .deb Files on Ubuntu 22.04

All Debian-based distributions. like Debian, Ubuntu and Linux-Mint utilize the Deb installation package format.

Thousands of deb packages are available in the Ubuntu repository, that can be installed via Ubuntu Software Center or the apt and apt-get programs from the command line.

Unfortunately, not all applications are available through Ubuntu or third-party repositories. Those applications must be manually downloaded and installed from the developer's websites. You should especially be cautious when installing deb packages from unauthorized sources to avoid cyber threats.

In this article, you will learn all the different ways you can install the deb packages on your Ubuntu system.

Prerequisites

  • Ubuntu or any other Debian Linux-based system
  • The terminal access
  • Internet access
  • A user account with root or sudo privileges.

Note: Although the commands used in this tutorial are for the Ubuntu system, all the methods are also valid for any other Linux-based system.

Command Line Methods for Installing Deb Files/Packages

There are multiple package management systems, you can use to install the deb packages. You can see them in the following with their pros and cons.

Note: This tutorial uses the slack deb package file as a sample.

Install Deb Files with apt

You can install the deb files with apt by appending the full deb file path followed by the “./" symbol.

sudo apt install ./slack-desktop-4.15.0-amd64.deb

The apt command resolves all the dependencies by itself, so you do not need to worry about such complications.

Install Deb Files with gdebi

gdebi is a tool used for installing deb files, but it does not come installed in Ubuntu, so you have to install it separately to use it.

To install gdebi, run the following command.

sudo apt install gdebi

After gdebi is installed, you can use the following command to install the deb package.

sudo gdebi slack-desktop-4.15.0-amd64.deb

Like apt, gdebi also resolves package dependencies on its own.

Install the Deb Files with dpkg

You can install deb packages by running dpkg with the -i option.

sudo dpkg -i ./slack-desktop-4.15.0-amd64.deb

dpkg does not resolve package dependencies, so if any dependency errors occur, you have to resolve them manually using the following command.

sudo apt install -f

Command Line Methods for Uninstalling Deb Files/Packages

You can remove the deb package installation with the following apt command.

sudo apt remove slack-desktop

To uninstall deb packages that are installed through dpkg, run the following command.

dpkg -r slack-desktop

Graphical User Interface Method For Installing & Uninstalling Deb Files/Packages

To install the deb packages directly through the GUI, click on the deb file.

You will see your file open in a window like the following. Click on Install and authenticate.

Similarly, open the deb file to uninstall the file and click on Remove.

Confirm the action by clicking on Remove in the following prompt.

Conclusion

This article discusses multiple methods you can use to install deb files on your Ubuntu system. Each method has its pros and cons.

For example, it is preferred to use apt or gdebi packages to install deb files as they can automatically resolve any dependency issues that arise during installation. While you have to resolve package dependency issues manually while installing deb files with dpkg.

As opposed to that, the direct method of deb package installation is through the Ubuntu Software Center.

This article also includes uninstallation methods for deb files, as removal methods differ depending on their installation. Using the apt command will not remove the application if it is installed through its dpkg method.

Leave a Comment