Install packages on Debian is possible by using commands if you wish to do this without installing packages. In this way, you are even able to copy the commands to a USB drive and put them on another same Linux distribution. Using a package tool allows you help to install, delete, configure or upgrade different packages. If you have migrated from Windows to Ubuntu or Linux Mint, you will find this tutorial so useful since installing local software on the system might be an issue. In this article, you will learn How to Install Package on Debian.
If you are preparing to buy your own Linux VPS, visit the available packages of OperaVPS to purchase the best.
Before going through this guide, consider a non-root user with
sudo privileges as the prerequisites to help a complete and successful installation.
Tutorial Install Package on Debian [Full Guide]
Debian and its derivatives such as Ubuntu and Linux Mint have their own Graphical Software Center for easy software installation. This guide will teach you different useful ways to install packages through the terminal. There are different package managers used in Debian to install packages. However, some of them are by default on Debian and others have to be installed.
This article will present installing software using Gdebi, Apt, Dpkg, Flatpak, and aptitude.
5 Command Line Tools to Install Packages on Debian
Join us with this article to start learning how to install local software packages (.DEB) on Debian. In the end, you know how to use 5 different command line tools to do this.
Do not forget to replace your considered software with [package name]
1. Installing a Package Using Gdebi Command
The first command to introduce is Gdebi which would resolve and installs package dependencies on the package. It is not a default package manager on Debian. You just need to use the command below to use this tiny command-line tool to install local deb packages.
sudo apt install gdebi
The general syntax while using gdebi to install a package would be like this:
sudo gdebi [package name]
Note: Gdebi has no command to remove unwanted packages.
Remove a Package Installed from Gdebi
If you wish to delete the package you have installed using gdebi Command, you can run any one of the following commands to do this:
sudo apt purge [package name]
sudo apt-get purge [package name]
sudo dpkg --purge [package name]
2. Installing a Package Using Apt Command
Advanced packaging tool is capable to install, remove, and update software packages. Apt also offers to upgrade software packages and even upgrade the whole Ubuntu or Linux Mint system. To manage packages more interactively on Debian and its derivatives such as Ubuntu and Linux Mint systems, you can use its apt-get and apt-cache command-line tools.
Since the apt-get or apt does not understand .deb files, and it installs the packages with their primary name like MongoDB, or VLC, they will handle packages names to retrieve and install .deb archives associated with a package name, from a source specified in the /etc/apt/sources.list file.
To install a local Debian package using apt-get or apt without a failure, you need to specify a local relative or absolute path (./ if in current dir) to the package.
Here is the general syntax of using the apt command to install packages.
sudo apt install [package name]
For example, if you need to install VLC, run:
sudo apt install vlc -y
Remove a Package Installed from Apt
Similar to other command tools, you can remove any unwanted packages from Debian using the apt command. So, run:
sudo apt remove [package-name]
Use the following command to remove a package with its dependencies.
sudo apt autoremove [package-name]
3. Installing a Package Using Dpkg Command
The second command you can use to install, build, upgrade, remove and manage .deb packages, is Dpkg. It is a package manager for Debian and its derivatives. Dpkg only installs the packages whose installation files are downloaded. But unlike other Linux package management systems, Dpkg will not download and install packages with their dependencies automatically.
To install a local package using the dpkg command, run:
sudo dpkg -i [package]
This is how dpkg does syntax generally.
Note: i flag is used to install the package.
In the case of facing any error while installing, use the following command to resolve and install dependencies.
sudo apt-get install -f
Remove a Package Installed from Dpkg
Anytime you need to remove an unwanted package from Debian, the general syntax of deleting a package installed from dpkg is:
sudo dpkg -r [package]
You can also remove the package along with its configuration files. So, type:
sudo dpkg -p [package name]
sudo dpkg --purge
4. Installing a Package using Flatpak Command
The flatpak command is not a default application on Debian. So, you have to install it first. It enables you to install Sandbox applications. To start the installation, use the command below to enter the root user mode:
Then, to install flatpak, run:
apt install flatpak
To let flatpak applications be installed, you need to enable the flatpak by adding the repository of flatpak repo from the flathub.
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
For example, to install GNOME plugins for the flatpak, use the command below:
apt install gnome-software-plugin-flatpak
Then, you are ready to install the application of gnome recipes using the flatpak:
flatpak install --from https://git.gnome.org/browse/recipes/plain/flatpak/gnome-recipes.flatpakref
And finally, to run this application:
flatpak run org.gnome.Recipes
5. Installing a Package Using aptitude Command
Same as the apt command, the aptitude command is used to install packages. To display and retrieve the changelog of the official packages of Debian, you can use the aptitude command.
Apt and Aptitude are different in level. Aptitude is a higher-level and apt is a lower-level package manager.
Since aptitude is not available by default on Debian, you can run the command below to install it.
sudo apt install aptitude
The command below is the general syntax of installing a package using the aptitude:
sudo aptitude install [package name]
Remove a Package Installed from aptitude
To remove any unwanted package using the aptitude command, run the command below:
sudo aptitude remove [package name]
In this article, you learned how to install the package on Debian. Five different command-line tools were explained, and you reviewed all their general syntax. On Debian 11, apt-get is obsoleted, and you can use other alternatives you read in this guide. Now, you know how to install and remove packages from Debian. Share your experiences about using any one of the commands to use a package and ask your questions as well.