Surely we all know the typical Windows “EXE” or “MSI” files. These are the executables that allow us to install programs on the computer through a simple wizard. However, when we leave the Microsoft ecosystem, things change, and it is that these file formats are no longer used, but we can find other different ones that can lead us to confusion, as is the case of .DEB packages . What are these files, and why are they so important in Linux?
What is a DEB file
The name “DEB” comes from shortening the name of the first distro that introduced and started using them: Debian. These packages are basically the .EXE of Debian-based Linux distributions , such as Debian itself, Ubuntu or Linux Mint, among others. Thus, these are storage files (or packages) that contain all the files to be able to install a program in the distro, in addition to the scripts necessary to carry out this installation and configuration of the program in question.
It is very easy, fast and comfortable to install these programs on our computer, since we don’t even have to learn a single command. However, this file format has some limitations. For example, within a DEB package it is possible that not all the dependencies necessary for the program to function normally are found. Therefore, if this happens, we will have to download and install these necessary dependencies by hand.
Within one of these files we can find three files:
- debian-binary , which tells us the version of the package that we are going to install. The latest, currently, is 2.0.
- control.tar.gz , where we will find all the meta-information of the package.
- data.tar, data.tar.gz, data.tar.bz2 or data.tar.lzma , all the files that we have to process and install on the system.
To see its content, we can use any file compressor for Linux. Even the one that comes installed as standard in the distros, such as Ubuntu, will allow us to see the interior of these files.
Some of the Linux distributions that use this file format by default to install programs are:
- Ubuntu (and flavors, like Kubuntu, Lubuntu, etc).
- Linux Mint.
The main alternative to this type of packages to install programs on Linux are RPM files. And furthermore, we can convert DEB to RPM , and vice versa, using a tool called “alien”, so although different, they are compatible with each other.
As a curious fact, iOS , the iPhone operating system, uses these containers (although its internal structure is different from that of Linux packages).
How to install a DEB file on Linux
In general, most distros prepared to use DEB files come standard with the DPKG package manager . This will be the one that allows us to install programs through these packages using the terminal. However, there are many graphical interfaces that will allow us to work with them from the desktop, such as Synaptic, PackageKit, Gdebi, and even the classic Ubuntu Software Center. To install these programs, we will simply execute:
- sudo apt install gdebi
- sudo apt install synaptic
- sudo apt install packagekit
As we have already explained, there are several ways to install these programs. The first that we are going to see is through DPKG, since, if our distro is compatible with this format, it will have this tool installed by default yes or yes. To do this, the first thing we must do is download the DEB file from the web we want (from a GitHub repository, for example). Once we have it saved on our hard drive, we open a terminal and, using the “CD” command, we will place ourselves in the folder where we have it saved (for example, the desktop or the downloads folder). Once there, what we will do is execute the following commands:
In the case of wanting to use DPKG, we will execute:
dpkg -i paquete.deb
When the process is finished, the program will already be installed on our computer. We can check it, in a similar way, also using DPKG as follows:
dpkg -l | grep 'paquete'
To uninstall a program installed from its original DEB, we can do it by executing the following command in the terminal:
dpkg -r paquete.deb
And, in the same way, if we also want to eliminate the program and all the data that it has saved on the PC, we must change the “-r” parameter of the previous command to “-P”, and thus perform a completely complete uninstall.
APT is the well-known command that we use to find, download and install programs on most Debian-based Linux distros. This tool, in addition to allowing us to search for programs in the lists of repositories added to the system, will also allow us to install local DEB files that we have downloaded from web pages. And, in addition, it will do it with a higher success rate than DPKG, since it will allow us to search and satisfy dependencies. Of course, below the “APT” command, this same DPKG that we have just seen is executed.
To install these programs with this terminal package manager, what we must do is execute the following command:
sudo apt install ./paquete.deb
Once installed, the program will already be part of our system. In case we want to uninstall it, this time we will not have to know where the original DEB was stored, but by knowing the name of the package we can delete it as follows:
sudo apt remove <paquete>
And, if we change “remove” to “purge” we can also delete all the program data that has been saved in the system.
With a package manager
In case we have any of the DEB-compatible file managers installed on the system (such as the Ubuntu software center), we can install these files simply by double-clicking on them. The file manager will take care of everything else, both completing its installation and telling us that we are missing a dependency.
When the package manager finishes its installation tasks, we can already find the program in the menu where all the software of our Linux appears.
How to update these programs
Depending on the program in question, to update the programs that we have installed through these packages we will have to do it one way or another. For example, some applications have automatic updates , as is the case with Google Chrome or Discord (two very clear examples that are installed from DEB packages), so we will not have to do anything more than be connected to the Internet so that, when launch update, it will arrive automatically on the PC.
On the other hand, if these programs don’t have automatic updates, then we won’t be able to do much more. The only way to update the programs is to download the new DEB package when there is a new version and install it again on our Linux. Generally the new version will replace the previous one, so we should not have problems or old versions on the PC. But, as we say, it is a process that we must carry out by hand. And do not forget about it if we want to have our computer with good basic maintenance.