Package Managers

There are many advantages that full Unix-like operating systems offer over the traditional appliance computing paradigm. One such advantage is the use of package managers for software installation, updates and upgrades.

Introduction to Package Managers

Most people who are new to Linux come with a similar approach to application installation and maintenance. For system-level software, they expect an automated updates to run periodically without asking or asking only in the event that the device needs to reboot. For user-level applications, they expect to download an installer, which then may or may not update itself moving forward.

For example, the user wants to install Firefox. On a new system, their approach would be to open Internet Explorer or Apple Safari to download the Firefox installer from Mozilla. Once it’s installed, Firefox maintains itself by periodically checking in with Mozilla for updates and alerting the user if there’s a need.

This feature of checking for updates can be disabled in the application preferences or even ignored altogether. While the operating system may continue to receive bug fixes and security updates, the annoyance of a separate update system can lead to Firefox left to lag behind.

In Linux, the approach to application installation typically goes through a package manager. Instead of going to a web browser, the user opens a terminal window and tells the package manager to install Firefox.

# dnf install firefox

In the background what follows is fairly similar to the above example. The package manager DNF checks in with the available software repositories, until it finds one that carries the firefox package. It then downloads a binary and installs it on the system.

The difference is that in addition to installing the package, DNF also registers it at a system-level. So, later on when you decide to install updates for your operating system,

# dnf upgrade

the command not only checks in to update system-level software like the Linux Kernel, OpenSSH, or DNF itself, but also installs updates for Firefox and anything else available that you’ve installed through DNF.

See also

For more information on the Fedora package manager, see DNF: Dandified YUM.

Introduction to Software Repositories

What happens when you tell DNF to install Firefox?

When you want it on Windows, you navigate through a web browser to the Mozilla website and download the installer. In doing so, you place a great deal of trust in Mozilla to provide you with clean and reliable software. The kind that does not contain viruses or similar malicious code that may damage your system.

Mozilla is a company that is most certainly worthy of that trust, but you aren’t going to get very far provisioning a Windows or Mac system before you begin to encounter less reputable sources.

Package managers follow a similar procedure in the background. The application connects to a resource on the internet, downloads a binary package, then installs that package on the system. Unlike the above example, however, the resource it connects to is a software repository, (called repos, for short), rather than a normal website.

Linux distributions and FreeBSD ship preconfigured to utilize a handful of official repositories. Whenever you tell a package manager to install a package, it checks to see if any of these repos have the package you want to install. When it finds one, it then connects, downloads the binary and installs it on your system.

When you issue an upgrade command, the package manager checks in with each of the configured repos and says I have this version of this package, do you have a more up to date version? If the answer is yes, it installs the update.

Similar to the situation on Windows and Mac, there is still a degree of trust that you have to place in the repository. This is especially the case since system-level installations and updates require root or sudo privileges. However, unlike Windows and Mac, you can get much further along in provisioning Linux or FreeBSD without downloading random software from unreliable sources. In some cases, you can even get to that point by only using the official repositories of the distribution.

Available Package Managers

In Fedora Linux, the official package manager for system-level installations is DNF. It deprecates the older application, YUM, which is still used by other related distributions, such as CentOS and Red Hat Enterprise Linux. In addition to DNF, in cases where you do have to download a package from a website, you also have the RPM package utility available.

Running DNF and RPM requires root access or sudo privileges on the system. This may not be available to you in certain restricted environments and deployments. For user-level installations, there are a handful of additional package managers available, which are specific to particular programming languages or tasks.

For instance, pip and gem for installing modules from the Python Package Index and Ruby Gems. Alternatively, package.el, which allows you to manage extensions from within GNU Emacs.

< Prev Next >