Having a good package manager is crucial for one to have a good Linux experience. After all, package managers help you install, manage, and remove software off of your device. Without software, a PC is little but a heap of metal connected with 0’s and 1’s.
Because of this, today, we’ve decided to list our top Linux package managers and answer some common questions related to packages in general.
Here’s our list of the best Linux package managers:
- APT (Advanced Packaging Tool) Made by the Ubuntu Foundation, the people that made Linux’s most popular distro, APT is nothing short of a great package manager. There are various GUIs to choose from, but it doesn’t force one upon you. It’s great for beginners while still having depth, all in all, and it’s simply the most solid pick on the list.
- Pacman Made for Arch Linux by its creator, Pacman is mighty and has very efficient functionalities.
- Aptitude A package manager that is often compared to APT. You can think of it as APT’s higher-level, more complex cousin.
- Portage Made for Gentoo Linux, the tool has a lot of depth if you want to get into it.
What Is a Package?
A package is a set of files tasked to perform a given duty. For example, GIMP, one of the most popular image editing programs, is distributed through a package. Inside that package are all of the files you need to run GIMP. Furthermore, packages also have a small file letting you see crucial metadata about the program you’re installing.
Packages are used to install and maintain new software across different Linux distros. This is very similar to how Windows uses .exe installers. The entire Linux ecosystem revolves around packages shared via software repositories.
Why Are Packages Used?
Since every Linux device has different software, including a different kernel, there’s no way for a Linux developer to make sure that a program made for Linux will run correctly on all devices. To alleviate this issue, packages have various dependencies, meaning prerequisites (such as a list of programs that you need to have pre-installed) for the application within the package to function.
How Do Package Managers Work?
If a package needs a resource (like a library or a different package), that means it has a dependency because it depends on that resource to function. Any modern package manager will give you some way to resolve dependency issues so that whenever you install a package, you also install its dependencies.
The Best Package Managers
Pretty much all software installed on a Linux device these days originates on the internet. Regardless of whether it is given by a vendor through a central repository (which is a composite of packages, sometimes numbering up to over 1000 packages) or available as source code so that you can download and install it manually.
Now, because different Linux distributions use other systems for packaging (for example, Debian uses *.deb, and openSUSE uses *.rpm) usually, packages will not be compatible with different distributions. With that being said, most Linux distros fall into one of three families in the LFCS certification.
1. APT (Advanced Packaging Tool)
APT has pretty much everything you might need from a package manager. It’s free, it’s got a blossoming community, and it has an excellent command-line interface. Its only “weakness” is the lack of an in-built GUI. With that being said, most distributions in the Debian family have a graphical interface available for them.
On Ubuntu, its interface is slick, intuitive, and gives you all the information you need. So if you’re looking for a package management tool for your Debian-based device, there’s no reason to look any further than APT.
Its two most commonly used command-line utilities are “apt-get” and “apt-cache.”
What is apt-get?
The apt-get command-line tool is used to install, upgrade or remove software packages. Furthermore, this simple line can also be used to put into place upgrades to the whole OS. Due to these versatile functionalities, apt-get sits firmly as the most used APT command-line tool.
What is apt-cache?
Apt-cache is an APT utility used to search the apt software package cache. Put simply, the utility searches for and through packages, in addition to gathering information about them. It can also point out what packages you’ve got available that are ready to install.
Find Help On How To Use APT
$ apt help
This command will print out all the different ways you can use APT from the command line.
Install A Package
$ sudo apt install packagename
Using this command, the APT will immediately install the given package, and you can even install a list of packages by inputting all of their names.
List All Files In A Package
$ sudo apt content packagename
This command will make it so that APT lists all the files within the package packagename.
Display All Package Dependencies
$ sudo apt depends on packagename
This command will print out all of the dependencies of the package packagename.
Look For A Package
$ sudo apt search apache2
This command will search your device for a package by the given name and display all packages that match it.
View Package Information
$ sudo apt show packagename
This command will print out information about the package or packages you’ve named. The command does support you writing multiple package names.
Look For Any Broken Dependencies
$ sudo apt check packagename
Occasionally, a broken dependency will slip through the cracks while installing a package. This will lead to errors talking of broken package dependencies. The above command will look for what dependencies those are.
There are a couple of different GUIs available for APT:
- Synaptic Package Manager: A GTK+ based GUI, probably the most popular as it gives you the most clarity while still maintaining depth.
- Ubuntu Software Center: Also made with GTK+, this GUI was made by the Ubuntu Foundation
- Aptitude: A simple console client with CLI
- KPackage: A project made by KDE
Completely Remove A Package
$ sudo apt-get purge vsftpd
Usually, when you remove a package, its config files will stay on your device. To remove a package and its configuration files, use the command above.
Pacman is a software package manager made by the same person that made the Arch Linux distro- Judd Vinet. Pacman is made as part of Arch itself, and the package manager is one of the essential pillars of the distribution. However, Pacman is also available on some other distributions like ArkOS, ArchOne, and so on.
Pacman has no problems resolving dependency issues, and in fact, it’s capable of automatically downloading and installing everything you need. Theoretically (and sometimes even in practice), Pacman should let you update your whole system with a single command.
The way Pacman keeps your system up to date is through synchronizing package lists with its master server. Using this client/server model lets Pacman streamline installing packages with all of their dependencies to a single command.
This package manager uses .tar archives for all of its packages. There are various ways to download packages using Pacman, through FTP, HTTP, or even local files. It can also create packages from source code.
Pacman is a very streamlined package manager. It doesn’t try to “do everything,” as its creator put it; instead, it simply performs the fundamentals of package management superbly.
It has a couple of different GUIs available, with tkpacman being one of the most used while maintaining both the depth and simplicity of Pacman. With that being said, it’s a far cry from APT’s best GUI in terms of aesthetic and general intuitiveness.
Installing A Package
pacman -S _packagename1_ _packagename2_ _packagename3_…
This simple line will let you install as many packages as you want. Finally, the -S refers to synchronization, meaning Pacman first synchronizes with the master server.
There are two categories of installed packages in Pacman:
- Explicitly installed: These packages are those that you’ve intentionally installed through a generic -S or -U command.
- Dependencies: These are the packages Pacman installed for no other reason than they were required for an explicitly installed package to function.
Removing A Package
pacman -R packagename1
If you’d like to remove a package through Pacman, it’s as simple as writing the command above; take note though this leaves all of its dependencies in your system.
Removing A Package With All Of Its Dependencies
pacman -Rs packagename1
This command removes not only the package but all of the dependencies that came with it too. However, it won’t remove any dependencies multiple packages rely on (unless you remove those packages too.)
Upgrading Packages And Your System
Pacman makes updating Arch Linux and all of the packages on it a breeze. You can instantly update all of your installed packages using just one command. However, take note that this can take quite a bit of time if you haven’t done it in a while.
This command will synchronize the repository database and update your system’s packages accordingly. Of course, this doesn’t include any local packages, not in said repositories.
We can break down this command into three components:
- S: as we’ve already mentioned, this stands for synchronization
- y: This refreshes your local cache
- you: Signifies a system update
In essence, these three make it so that you synchronize to the central repository, then refresh your local copy of it. Then, finally, it updates all of the packages that it finds a newer version for.
Often compared to APT, Aptitude is a Package manager available to Debian and RPM users. It’s a front-end advanced package manager with an in-built UI. The UI is based on the ncurses library, giving it various elements usually seen in GUIs.
It can emulate most APT’s command-line arguments; however, it’s a bit more complicated. On the other hand, it’s higher-level than APT is, and they can even work in conjunction with each other quite well.
It offers a lot more depth than APT does, and if you’re looking for a package manager with features you’ll keep discovering years into using it, Aptitude might be the one for you.
A free and open-source tool, Portage is a GPLv2 package manager. It is available on the Gentoo Linux distribution.
The Portage package manager is made up of two parts:
- Ebuild system: This is the part of Portage that works on building and installing packages.
- Emerge: Emerge is tasked with giving an interface for ebuild; it resolves dependencies, manages ebuild repositories, etc.
Portage has a GTK+ based GUI called Porthole. Although it isn’t the most intuitive GUI in the world, it’s better than nothing if you’re someone that likes having a GUI. There’s another, called Himerge (Haskell Interface for eMerge); however, it’s prettyspecialized and very unfriendly to newbies.
The main function of Portage is compiling the packages you want to install on your device from the source code. Doing this gives you access to a lot of customization when it comes to the compiler and target application options so that you can fit your installations to your preferences.
Portage has three pre-set levels of stability for its ebuilds:
- Stable – This means that the software is operating as intended and doesn’t have any known security issues
- Keyword Masked – This is mainly used for those packages that haven’t gotten enough testing on your system architecture for Portage to consider them stable
- Hard Masked – These are either unfunctional or extremely insecure packages.
If you’re looking for a tool that has a lot of depth when you get to grips with it, is pretty specialized, and don’t mind putting in a bit of time to learn it, Portage is a great choice. However, its most significant downside is that Gentoo Linux isn’t exactly the most popular distribution out there.
What Do I Do With Packages?
Linux offers support for a variety of different kinds of package managers. Although all package managers essentially do the same task- helping you install and manage various programs, every package manager has a different architecture and UI. Furthermore, some won’t work quite as well (or at all) on distros they aren’t intended for.
Are There Any Alternatives To Packages?
While packages have been the go-to method of sharing Linux software, lately, there has been progressing in creating tools that simplify Linux software management. An example of this is the brand new “Snap” format which treats every program as a self-contained object running in its own space. This makes them dependency-free in turn.
A more old-school way of installing software on Linux is compiling it from the source. Although this way of installing programs has fallen by the wayside lately, long-time Linux users and Slackware lovers ensure the method is kept alive. In essence, to install a program by compiling it from the source, you’ll need to get the exact code for the program you’re looking to install. Then, you’ll input it into a compiler and install it on your PC. Although this should be more efficient in theory, this is mainly insignificant as the installation is optimized for your PC. Because of this, it’s pretty rarely used, seen most commonly among software developers themselves.
If you’re a beginner at using Linux and feel overwhelmed with choices and decisions seeing all of these package managers, don’t fret. Most of them will do just fine for a newer user, with APT ideal for beginners due to its simplicity.
Although package alternatives have been cropping up lately, packages still reign supreme as the most dominant software-sharing method on Linux. It’s unlikely they’re going to phase out anytime soon, so you might as well get to grips with a good package manager.
Did we miss your favorite package manager?
Do you think packages will stand the test of time?
Let us know in the comments below!