How To Install .deb Packages (GUI& Command Line)?

Linux distributions like Debian, Ubuntu, Mint, Kali, etc. uses .deb packages in order to install new software. These .deb packages can be provided via different ways like a central repository, file server, USB, web page, etc. After acquiring a .deb package it should be installed into the current system. Even in most cases centralized package managers like apt and apt-get is preferred some applications are provided via .deb packages for compliance and license issues. In this tutorial, we will learn how to install .deb packages or extensions to install via command line or terminal or graphical user interface (GUI).

What Is .deb Package?

.deb package or .deb format is a simple compressions format which is created to store multiple installation, executable, configuration and help files in a single file. The dpkg command is used to list contents of a .deb packages where also can be used to install a .deb package.

Actually central Ubuntu, Debian, Mint and Kali repositories distributes applications as .deb package but they are generally installed via commands like apt and apt-get in order to calculate dependencies and install these dependencies properly.

Applications like Google Chrome, TeamViewer, AnyDesk, etc. provided as .deb packages where they can be downloaded from their web sites. In this example we will download and install TeamViewer .deb package via the following URL.

https://www.teamviewer.com/en/download/linux/

Download TeamViewer .deb Package

The downloaded .deb package is named as teamviewer_15.9.5_amd64.deb and the contents can be listed with the following dpkg command.

Install .deb Package with dpkg Command

The first and most straight forward method is using the dpkg command in order to install a .deb package. dpkg command is a command-line tool that is also used by apt and apt-get commands under the hood. As package installation requires root privileges it should be used as the root user or sudoer user with sudo command like below. We will provide the -i option in order to install the specified package.

$ sudo dpkg -i teamviewer_15.9.5_amd64.deb
Install .deb Package with dpkg Command

Dependencies are required in order to install and run a package where generally libraries are listed as dependencies. dpkg command does not install dependencies automatically and if required dependencies for the currently installed package are not installed you will see errors and warnings like above. We can see that following error is printed to the terminal.

dpkg: error processing package teamviewer (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...

In order to install a deb file these errors should be resolved by installing all related dependecy packages by using the apt or apt-get command. We will install these dependencies with the following command.

$ sudo apt install gnome-menus desktop-file-utils mime-support hicolor-icon-theme

Even we have installed these dependencies as the previous .deb package interrupted. So we can complete the TeamViewer deb package installation with the --fix-broken option and install. This will also automatically complete the .deb package installation. If there is no dependency error non of these steps are required because dpkg installation will be enough for .deb package installation.

$ sudo apt --fix-broken install

Install .deb Package with apt or apt-get Command

apt or apt-get commands are the most popular package management commands in deb based distributions. They can be also used to install a .deb package where actually both of the apt and apt-get commands use the dpkg under the hood. But there is a big advantage about using the apt or apt-get command over the dpkg command. The dependency installation will be done automatically and installed via central repositories if any dependency is not installed currently. We will specify the absolute or relative path of the .deb package like below in order to install with apt or apt-get command.

$ sudo apt install ./teamviewer_15.9.5_amd64.deb

#Install with apt-get
$ sudo apt-get install ./teamviewer_15.9.5_amd64.deb
Install .deb Package with apt install or apt-get install

Alternatively we can specigy the full or absolute path of the .deb package like below.

$ sudo apt install /home/ismail/Downloads/teamviewer_15.9.5_amd64.deb


$ sudo apt-get install /home/ismail/Downloads/teamviewer_15.9.5_amd64.deb

Install .deb Package with Ubuntu Software Center

Ubuntu Software Center or related GUI based software management tool can be used to install a .deb package. Installation can be done via GUI without any command or terminal. But this operation also requires root privileges which will be asked during installation. First, navigate to the .deb package with your favorite file manager. But keep in mind that some file managers can not associate the .deb extension as a package and start installation so stick to the Ubuntu default package manager.

READ  How To Save A File In Vim/Vi?

The .deb package will be automatically opened with the Ubuntu Software Center in this case and some information about the package will be listed like below. We can start the .deb package installation by clicking to the Install button like below.

We will see the following Authentication Required where the current user password will be provided.

If the password is correct and the user has sudo privileges the installation will start automatically like below.

Install .deb Package with Ubuntu Software Center GUI

Install .deb Package with Gdebi

Gdebi is a simple GUI and command-line tool in order to install .deb packages. Before the apt, apt-get, Ubuntu Center Software it was used as a popular way to install .deb packages. Gdebi has a big advantage over the Ubuntu Software Center where is can resolve dependencies and install them automatically without any error. Gdebi can be also used from the command line in order to install a .deb package. Gdebi is generally not installed on Debian, Ubuntu, Mint, and Kali boxes by default. Gdebi can be installed with the following command.

$ sudo apt install gdebi

Gdebi provides both command line and GUI to install a .deb package. The TeamViewer .deb package can be installed from the command line using gdebi like below. During the installation, all dependencies will be solved and installed automatically which is a lot better and easier than dpkg command.

$ sudo gdebi teamviewer_15.9.5_amd64.deb
Install .deb Package with gdebi Command Line

We can also use the GUI with the gdebi-gtk command or from the Menu of the current desktop environment.

$ sudo gdebi-gtk teamviewer_15.9.5_amd64.deb

We will see the followin screen where click to the Install Package for install .deb package.

Install .deb Package with gdebi GUI

Remove .deb Package

An installed .deb package can be removed in different ways like command-line or GUI. Even the centralized package management command apt or apt-get can be used. In the following example we will remove the TeamViewer package which is installed as .deb package with the apt remove command. The package name should be provided properly.

$ sudo apt remove teamviewer
Remove .deb Package with apt remove or apt-get remove

We can also remove the installed .deb package via Ubuntu Software Center GUI tool without using any command. Just navigate to the package in the Software center and click to the Remove button like below. The removal of the .deb package will also require root privileges where the current user password with sudo privileges can be provided.

READ  Vim/Vi Copy Line
Remove .deb Package with Ubuntu Software Center

Gdebi GUI can be used to remove or uninstalled a .deb package by opening with the following command. We will also used the sudo for root privileges.

$ sudo gdebi-gtk teamviewer_15.9.5_amd64.deb

Leave a Comment