There are many ways to install a package on Linux. From using the terminal to graphic interfaces and even all these packages are summarized in programs within a store. All these methods are valid and efficient to install a package. However, in this post, you will learn different ways to install a DEB package from the terminal. This way you can choose the safest method for you.
What is a DEB package?
Before we start, it’s a good idea to explain what a DEB package is.
A DEB package is a package format for certain Linux distributions that are derived from Debian, which is the distribution it was made for. A DEB package can be a library, an installable script, or a complete program. In any case, it requires special permissions to be installed on the system.
These DEB packages are compatible with a large percentage of distributions such as Debian, Ubuntu, Linux Mint, ElementaryOS. This means that DEB packages are very well known and popular. I say that they are not entirely compatible between various distributions because a developer can prepare a program in DEB format but with specific instructions for Ubuntu. So, this package would not be exactly compatible with Debian. Although there are few cases where this happens, it’s good to know.
Finally, it is possible to convert DEB packages to RPM by using other applications such as Alien. In case you don’t know it, RPM is another package format compatible with RHEL, Fedora, OpenSUSE, and CentOS.
Installing a DEB package from the terminal is very easy but there are several ways to do it with different commands.
How to install a DEB package from the terminal
1.- Using the APT command
The first form is perhaps the most generic and is using APT. As it is well known APT is the package manager of Debian, Ubuntu, and derivatives.
This command is incorporated in all these Linux distributions and is quite easy to use.
To install a DEB package with APT, just invoke it with the install sub-command and specify the absolute path of the downloaded package in the following way:
sudo apt install ./[deb_path]
sudo apt install ./home/angelo/Downloads/package.deb
After entering your password, the installation will start. And if the package also has some dependencies, APT will try to solve them.
2.- Install a DEB package from the terminal using GDebi
Another utility that allows you to install DEB packages in our distribution is
Gdebi is not installed by default because it has many dependencies, but the behavior of the command is even a bit higher than APT. That is, it is faster.
So, to install
gdebi in Debian, Ubuntu and derivatives just run the following command:
sudo apt install gdebi
And to use
gdebi to install a package, just invoke it and define the path to the DEB file.
sudo gdebi [deb_file_path]
And then, the installation will start as soon as you enter the password.
One advantage of
gdebi is that it has a very simple graphical interface that can be invoked by simply double-clicking on a DEB package.
3.- Command dpkg
There is a command called
dpkg that is truly the engine of everything. And it is possible to invoke it as a single command.
If you want to know more about this command you can invoke help from the terminal.
And there you will see so many options that can overwhelm you but to install a package you just need to add the -i option and the package path.
sudo dpkg -i [package_path]
The only bad thing about using this method is that it doesn’t handle the package’s dependencies. This means that it is very prone to errors and bugs that have to be solved manually.
Let’s say that this method is very efficient but requires more work and is oriented to advanced users.
This post although quite easy can help many when we have to use the terminal as in servers or computers without many resources. Also, it is necessary to say that many programs for Debian, Ubuntu, and derivatives that are not available in the repositories are distributed using packages DEB and to know how to install them can remove us from an immediate problem.