Installing packages means making the programs ready to use, in Debian 11 (the latest version of Debian; bullseye) we can install the new package using a tool known as package manager. This tool helps to install, delete, configure or upgrade different packages, these package managers can either be a command-line or can be a GUI (graphical user interface). There were different package managers used in Debian 11 to install packages like apt, snap, gdebi, aptitude, and dpkg, some of them are by default in Debian and others have to be installed.
In this article, we will discuss all the ways of installing the packages in Debian 11 with the help of examples.
Installing a package using apt
Apt (advanced packaging tool) is the default tool of the command-line used to install the different packages, remove, update and upgrade them.
Apt do not install the files with extensions name like .deb, it installs the packages with their primary name like MongoDB, VLC, because apt command updates the /etc/apt/sources.list file and install the packages included in it, so if we want to install any package with the extension like .deb, specify its path using “./” with the name.
The general syntax of using the apt command to install packages is.
To install the package, let’s say, vlc, use:
To install the deb package, for example, Visual Studio Code, use:
We can also use the apt command to remove the unwanted packages from Debian. The general syntax of removing the package is:
To remove a package with its dependencies use:
For example, to remove the package VLC we can use an apt statement.
Installing a package using dpkg
Dpkg can also be used to install the packages in Debian 11, not only it is used to install but also for the upgrade, configuration, and removal of the packages. The dpkg is also a default command-line package management interface just like the apt command, but it slightly differs from the apt such as dpkg does not install the dependencies of the package (if needed) but apt can install the dependencies too while installing the package. Similarly, dpkg does not install the packages from remote addresses, it only installs the packages whose installation files are downloaded. It is used mostly to install Debian packages.
The general syntax of the dpkg command to install using any package using i flag (i flag is used to install the package)
For example, we install the package code.deb using the dpkg command:
The general syntax of removing the unwanted package from the Debian 11 is
For example, we want to remove “code” using the dpkg command.
If we want to remove the package along with its configuration files, then we can use flag “p”, the general syntax of removing the package along with its configuration file will be
Installing a package using aptitude
Aptitude is also a command used to install packages, it works similar to the apt command but the difference is that the aptitude command is not available by default in Debian, so we have to install it.
To install aptitude we can run the following command
The general syntax of installing a package using the aptitude is
The difference between the apt and aptitude is level difference such as aptitude is a higher-level and apt is a lower-level package manager which means apt can be used in higher-level packages. We will install the python3-nacl using the aptitude command.
We can see it is showing the progress of the installation:
Aptitude command also has the ability to display and retrieve the changelog of the official packages of Debian. If we want to remove the unwanted package using the aptitude command, the general syntax will be.
For example, if we want to remove the package python3-nacl, using the aptitude command.
Installing a package using gdebi
In Debian 11, the gdebi utility can also be used to install the packages, it works similar to the apt but the difference is apt installs the dependencies of packages from remote only like HTTPS, whereas the gdebi installs local packages resolving the dependencies of the package. Gdebi is not a default package manager in Debian, so we can install it as:
To install the package using gdebi, the general syntax will be:
For example, we install visual studio using gdebi.
However, gdebi has no command to remove the unwanted packages.
Installing a package using flatpak
Sandbox applications can be installed on Debian 11 using the flatpak command. The flatpak is not the default application, we have to install flatpak in Debian 11 to use it. For the installation, first, run the following statement in the terminal to enter the root user mode:
Run the following command to install flatpak.
Install the GNOME plugins for the flatpak by command.
Also, enable the flatpak by adding the repository of flatpak repo from the flathub, so its applications can be installed.
Now will install the application of gnome recipes using the flatpak
To run this application.
The output will as:
Conclusion
Some commands have been obsoleted in the newer version of Debian 11 like apt-get, but there are many other commands which can be used as an alternative to apt-get to install the packages in Debian 11. In this article, we have discussed different commands to install packages in detail in Debian 11 like apt, dpkg, gdebi, aptitude, and flatpak. We also explain the general syntax of these commands and explain with the help of examples how these commands are used to install and remove packages from Debian 11.