How to install package on Debian Linux

If you are new to Debian Linux, one of the first things you will be wondering how to do is install a software package. Although Debian usually comes with all the essential software installed out of the box, you will inevitably want to extend the operating system’s functionality even further, which can only be done through installing more software. Debian gives us a lot of options to do so, including through the system package manager, software center, or installing a .deb file.

In this tutorial, you will learn how to install a software package on Debian Linux. This will include several different methods in order to cover every possible scenario. You will also learn essential related commands, such as how to uninstall software or keep it up to date. Read on to learn how.

In this tutorial you will learn:

  • How to install a package with apt package manager
  • How to install offline .deb file
  • How to use the GUI to install a software package
  • How to search for new software packages to download
  • How to keep a package up to date or uninstall it
How to install package on Debian Linux
How to install package on Debian Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian Linux
Software apt, dpkg, gdebi
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install package on Debian Linux



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!


There are several methods that can be used to install a package on Debian. The one you use will mostly depend on the scenario at hand and whether you are comfortable with using the command line. Choose the appropriate method for you below.

Install package with apt package manager

Most users will want to use the apt package manager to retrieve software from Debian’s package repositories and have it automatically installed. While there are thousands of packages that can be downloaded, the only potential downside to this method is that not everything you want to install may be available.

Take the following command for example where we install the apache2 package:

$ sudo apt install apache2

This same command can also be used to update the package in the future.

In case you need to update your package cache so that you download the latest version of the software, you can first execute the apt update command:

$ sudo apt update

In case you need to search for a package to download, use the apt search command followed by your query.

$ apt search "http server"

If you want to remove the package later on, use apt remove or apt purge. The latter option will also remove configuration files.

$ sudo apt remove apache2
OR
$ sudo apt purge apache2

Install .deb package with apt package manager




apt package manager can also be used to install an offline .deb file that you have already downloaded on your system.

$ sudo apt install ./google-chrome-stable_current_amd64.deb

Notice we prepend ./ in the above file name, or the location of wherever the file resides on the system.

Depending on the package you install, you can ordinarily use apt again to keep the package up to date. It depends whether or not the software added its own repository to your apt configuration file.

$ sudo apt update
$ sudo apt install google-chrome-stable

Install .deb package with dpkg

dpkg is another package manager available by default on Debian. It is the backend program that apt relies on to perform some installation and removal functions. It, too, can be used to install an offline .deb file on the command line with the -i (install) flag.

$ sudo dpkg -i ./google-chrome-stable_current_amd64.deb

Install .deb package with gdebi

gdebi is another common package manager that users like on Debian. It will install dependencies automatically and works very similarly to apt. Note that it is not installed by default on Debian so must be installed first:

$ sudo apt install gdebi

Then it can be used to install a package:

$ sudo gdebi ./google-chrome-stable_current_amd64.deb

Another nice feature of gdebi is that it can install software packages directly from the GUI. Simply right click on any .deb file and you should see an option for “Open with gdebi package installer.”

Installing a .deb package via GUI with gdebi
Installing a .deb package via GUI with gdebi



Install a software package via Software application GUI

Of course, Debian does not force us to use the command line for everything. If you would rather use the GUI to browse for and download software packages, you can open up the app called “Software.”

Find the software package you would like to download, then just click the Install button.

Downloading a software package via GUI
Downloading a software package via GUI

Closing Thoughts

In this tutorial, we saw how to install a package on Debian Linux. As you can see, Debian provides us with a lot of options for this task, with the most common one being the apt package manager. It can be used to search for and download packages online, or to install offline files. In case you prefer the GUI, you also saw how to browse for and install packages in the Software Center, or install an offline .deb file.