How to install packages on Debian 10

The installation of software or a package on a Linux system using the command line is somehow difficult as compared to other operating environments. Therefore, you need some guidance while installing any package using the terminal.

So in this article, we will discuss how to install packages using dpkg, apt, gdebi, and aptitude package manager on Debian 10 buster. We will give you a brief overview of each command in this guide.

Installing a package using dpkg on Debian 10

Dpkg is a popular command-line package manager for the Linux Debian system. Using this package manager tool, users can easily install, remove, and manage the Debian packages. But, it can’t download automatically the package dependencies while you install any software. This package manager is installed by default on the Debian 10 system.

To install a .deb package, you will run the dpkg command with the flag -i along with the package name. The basic syntax of the command is given below:

$ sudo dpkg -i <package-name>

Here, we have downloaded the .deb file of TeamViewer for giving you a demo. So, use the following command to install any using dpkg:

$ sudo dpkg -i  teamviewer_15.7.6_amd64.deb

In case of any dependency errors when you install and launch the software, you can run the following apt command to resolve the dependencies issues. Use the following command to install package dependencies:

$ sudo apt-get install –f

In the above command, the flag -f is used to fix the broken dependencies.

Using dpkg command with -l option, you can list all installed packages.

$ dpkg -l

Remove package using dpkg command

You can also remove the installed packages using the dpkg command with -r flag, and if you want to delete or remove all its configuration files, then to use the purge option, you can do this.

Use the following command to remove the installed packages from your Debian 10 system:

$ sudo dpkg -r teamviewer

To remove the install package with all its configuration files, use the command as follows:

$ sudo dpkg --purge teamviewer

Install the package using apt command 

The apt package manager is an advanced command-line utility, which allows users to install the new software package, upgrade the existing packages, update the list index of packages, and even upgrade the whole Linux mint or Ubuntu system. Using the apt-cache and apt-get package manager, you can manage the packages interactively on the Debian 10 buster system.

The apt and apt-get command does not understand the .deb files. They can only handle the primary package names(for example, MariaDB, TeamViewer, etc.)

To install or download a package on Debian, the apt command directs to package repositories that are placed in  /etc/apt/sources.list file. Therefore, the only good option is to install a local Debian package using the apt package manager is by specifying the absolute or relative path using ‘./’ to the package. On the other hand, it will try to get this package from remote access, and the action will be failed.

Use the following command to install a package using the apt command:

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

Remove package using apt command

You can also remove the unwanted installed packages from your system using the following command:

$ sudo apt remove <package-name>

To remove the package including the configuration files, use the following command:

$ sudo apt purge <package-name>

Install the package using gdebi

The gdebi is a command-line utility that is used for installing local Debian .deb packages. It is used to install and resolve the package dependencies. By default, the gdebi is not already installed on Debian 10 buster. You need to install the gdebi tool, use the following command.

$ sudo apt install gdebi

Once the installation is complete, you can install any package using this tool. Execute the following command to install a package using the gdebi package manager.

$ sudo gdebi <package-name>

Install the package using aptitude command

The aptitude is a package manager that is similar to apt. It offers to download and install packages using the terminal. It has an interactive mode through which you can see the complete status of install and remove packages. Aptitude package manager’s options are quite similar to apt and use the same repositories as apt does. To see the interaction mode, you will use just an aptitude command without any options in the terminal.

By default, the aptitude is not already installed on Debian 10. But, you can install it using the following command:

$ sudo apt install aptitude

To install any package using the aptitude package manager, use the following syntax:

$ sudo aptitude install <package-name>

Remove package using aptitude

You can also remove any installed package using the following command:

$ sudo aptitude remove <package-name>

That’s all about the package installed on the Debian 10 buster.

The dpkg, apt or apt-get, gdebi, and aptitude are some useful package manager that helps you to install, remove and manage any software or package on your Linux Ubuntu, Debian distributions. In this tutorial, we have explored how to manage, install packages on Debian 10 buster. I hope you enjoyed this tutorial.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn.