On Linux, a package is a collection of compressed files and instructions that, when installed, alter some system settings. Although, the main use of these is to install applications on a system. But how to do it? What options do I have? Well, in this post, you will learn how to install a Debian (DEB) package.
Briefly, what is a package?
A software package on a GNU/Linux Operating System is generally a compressed file with a clear file structure containing main files and instructions to be used on the system.
Mostly, a Linux package is used to install applications so by taking a brief look at the structure, you might deduce that it contains the binary for the system, but also the instructions on how to install it.
As I said before, it is through packages that most of the current Linux distributions are installed. These packages have different formats according to the distribution to be used.
In the case of Debian and its derivatives the format is DEB which is a clear reference to Debian which was the distribution that gave it the impulse. But there are other formats like RPM that are used in other distributions.
Installing a package is not much of a risk in Linux thanks to the presence of package managers. They do the dirty work for you. However, if you are a novice user, you may need some help at first.
Installing a Debian package (DEB)
Either the graphical interface or the command line can be used to perform the installation process of a Debian package (DEB). The latter is much faster than the former, but in reality it all depends on taste, preferences and above all needs.
Installing a Debian package from the terminal
For the terminal, you have more tools than you think because package installation is often done using the terminal or configuration scripts.
This process is faster and more stable. But keep in mind that root permissions will always be required.
1.- The dpkg command
The dpkg command comes by default in all Debian based distributions. So, you don’t have to install or configure anything to use it.
To install a Debian package from the terminal using the dpkg command, you can run
sudo dpkg -i [package-name.deb]
Of course, you can replace it with the package’s name or absolute path along with its
.deb extension. For example:
sudo dpkg -i sample.deb
One of the main drawbacks of this command is that by default, it does not handle package dependencies. This can lead to some problems. And you will even get an on-screen output indicating that there was an error during installation.
To resolve these problems and get the dependencies installed, you have to run
sudo apt-get install -f
-f option refers to fix. That is, it tells
apt to fix the missing dependencies.
2.- The APT command
apt is a package manager for Debian and derivatives that makes the whole process of installing, upgrading and uninstalling packages simple and fast.
One of the features of apt that make it easy to use is that it will handle the package dependencies itself. So, there is not much to do.
dpkg, apt can also install packages from the distribution’s official repositories. So, it becomes a fairly logical option to use.
In this case, the procedure is quite similar to the above.
sudo apt install ./[package.deb]
sudo apt install ./sample.deb
In that case, it is located in the same folder as the prompt and thus avoids many problems because if it is not in the same folder, it will try to install packages from the official repositories.
As I said, apt will handle all the dependencies that may be needed and will usually require no further user intervention.
3.- The gdebi command
GDebi is another fairly simple and minimalistic tool that helps with the task of installing Debian packages. It also comes installed on many distributions, so there is no need to install or configure anything extra.
The syntax is simple to follow. To complete this, run.
sudo gdebi [package.deb]
Unlike dpkg, gdebi takes care of resolving the dependencies for the package in question, so there should be no issues using it either.
In conclusion, gdebi is also a fairly simple tool.
Installing a Debian package from the graphical interface
In the case of the graphical interface, the question changes a bit because it will depend on the distribution, but also on the desktop environment.
Normally, each archive browser or distribution integrates it by simply double-clicking on a DEB package or with the right mouse button.
This makes it easier for novice users. But the process can vary a bit.
Learning how to install a Debian package can be useful for novices and any Linux user. This process is simple but still gives a bit of curiosity to learn new things.
I hope you liked the post and help us to share it, so it can grow.