Package Management on Linux: A guide

Linux software and package management is the process of installing, updating, removing, and maintaining software on your system using package managers. Unlike Windows or macOS where software is often downloaded from websites, Linux uses structured systems called repositories. These are trusted sources that store pre-built software packages. Each Linux distribution comes with its own default package manager—tools that make it easy to work with these packages from the command line.

In this guide, you will learn how to manage software using popular tools like apt, yum, and dnf, and understand how to install applications, update your system, and manage repositories safely and efficiently.

If you are new to working in the Linux terminal, make sure to check out our earlier article, Command Line & Shell Usage, to understand how to navigate and run commands with confidence.


Understanding Linux Package Managers

A package manager is a tool that automates software management. It tracks which packages are installed, checks for dependencies, fetches updates, and installs or removes programs from your system.

Each Linux distribution family has its own default package manager:

In this article, we will focus on the most commonly used ones: apt, yum, and dnf.


apt vs yum vs dnf: Key Differences Between Linux Package Managers

Let us compare the three most common package managers: apt, yum, and dnf.

  • apt (Advanced Package Tool) is used in Debian and Ubuntu-based systems. It is known for simplicity and has a huge number of packages.
  • yum (Yellowdog Updater, Modified) is used in older versions of Red Hat-based systems like CentOS 7. It has now been replaced by dnf.
  • dnf (Dandified YUM) is the next-generation version of yum, used in Fedora and RHEL 8+. It is faster, resolves dependencies better, and uses less memory.

While the syntax varies slightly, the purpose and usage are mostly the same. Once you understand one, it is easy to adapt to another.

Installing Software on Linux

To install software in Linux, you typically use the package manager for your distribution. On Ubuntu or Linux Mint, you can install software with apt.

sudo apt update
sudo apt install gimp
Installing Gimp With The Apt Command
Installing Gimp With The Apt Command

The first command updates your package list. The second command installs GIMP, a graphics editing tool. The package manager will handle dependencies, download the required files, and set everything up.

On Red Hat-based systems using dnf, the process is similar:

sudo dnf install gimp

Sometimes, software is not available in your default repository. In that case, you can download and install .deb or .rpm files manually, or add new repositories (we will cover that shortly).

If you are using a GUI-based distribution like Linux Mint or Ubuntu, there is usually a graphical software manager, but the terminal offers more control and speed.

Updating Packages in Linux

Keeping your software up to date is important for security and performance. Linux provides quick ways to update all installed packages.

For Debian-based systems:

sudo apt update
sudo apt upgrade
Updating Packages Using Apt Command
Updating Packages Using Apt Command

The update command refreshes the list of available packages. The upgrade command installs the newest versions of all installed packages.

For Fedora, CentOS, or RHEL systems:

sudo dnf update

This single command updates everything that is installed. You can also use dnf upgrade which performs the same function in most cases.

If you want to upgrade your entire system to a new version (such as from Ubuntu 22.04 to 24.04), that process is called a distribution upgrade, which involves a different set of steps and commands.


Managing Repositories in Linux

Repositories are collections of software packages that your package manager downloads from. Your system already has default repositories set, but you can add third-party or custom ones.

To view all repositories on Debian-based systems:

cat /etc/apt/sources.list
Viewing Repositories On Linux Mint
Viewing Repositories On Linux Mint

Or check the contents of /etc/apt/sources.list.d/ for additional entries.

To add a new repository:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

This adds the Graphics Drivers PPA, which provides newer versions of NVIDIA drivers for Ubuntu-based systems.

On RHEL-based systems, repositories are managed with .repo files located in /etc/yum.repos.d/. You can add a new repo by creating a new .repo file, or by installing a release package from the software vendor.

For example, to enable the EPEL repository on CentOS:

sudo dnf install epel-release

After adding repositories, you can search for and install packages that were not previously available.


Performing Linux System Updates

System updates in Linux include core components, kernel patches, security fixes, and application updates. These are essential to maintain system health and avoid vulnerabilities.

In Debian-based systems:

sudo apt update
sudo apt upgrade
sudo apt full-upgrade
Upgrading Using Linux Mint
Upgrading Using Linux Mint

The full-upgrade command handles package removals and installations that are necessary to complete an update, such as kernel changes.

In Fedora and RHEL-based systems:

sudo dnf update

After updates, especially kernel updates, you may be prompted to restart your system. Always save your work and reboot when necessary.

It is good practice to check for updates regularly. On servers, updates can be automated using tools like unattended-upgrades or system timers. On desktops, graphical software managers will often notify you when updates are available.

Summary

Linux package management is a core skill every user needs to master. Using tools like apt, yum, and dnf, you can install, update, and remove software quickly and safely. Understanding how to manage repositories gives you access to more software choices, and regularly updating your system keeps it secure and efficient.

Now that you know how to install and manage software, the next topic will focus on learning the basic Linux commands, which will help you navigate the filesystem of Linux from the terminal!