6. yum and apt

Package managers are essential tools in Linux that simplify installing, updating, and removing software. They automatically handle dependencies, ensuring that all required libraries and components are installed correctly. Two of the most prominent package management systems are yum and apt.

Yum vs Apt

The primary difference between these two systems lies in the Linux distributions they serve. The yum (Yellowdog Updater, Modified) package manager is used by RPM-based distributions like Red Hat, CentOS, and Fedora. In contrast, apt (Advanced Package Tool) is the standard for Debian-based distributions, including Ubuntu. While both yum and apt achieve the same goals, their command syntax differs.

Installing and Removing Packages

To install a new piece of software from a repository, you use the install command.

Debian: $ apt install package_name
RPM: $ yum install package_name

To remove a package, the commands are also straightforward. apt uses remove, while yum uses erase.

Debian: $ apt remove package_name
RPM: $ yum erase package_name

Updating and Inspecting Packages

It is a best practice to update your local package index before installing or upgrading software. This ensures you are getting the latest available versions.

For Debian systems, this is a two-step process: apt update refreshes the package list, and apt upgrade installs the new versions. For RPM systems, yum update handles both actions with a single command.

Debian: $ apt update; apt upgrade
RPM: $ yum update

If you need to get more details about a specific package, you can use the following commands to display information like its version, size, and description.

Debian: $ apt show package_name
RPM: $ yum info package_name

Sign in to save your learning progress

Sign in

Exercises

Practice makes perfect! Here are some hands-on labs to reinforce your understanding of Linux package management:

  1. Query and Update Packages with YUM in Linux - Practice managing software packages on RHEL-based Linux systems using YUM, including inspecting, updating, and exploring repositories.
  2. Software Installation on Linux - Learn various methods to install and manage software on Ubuntu systems, including using apt, dpkg, and handling .deb files.
  3. Installing and Removing Packages - Practice updating the system, installing and removing packages, and optimizing software configuration on a Debian-based system using apt.

These labs will help you apply the concepts in real scenarios and build confidence with Linux package management.

Quiz

What command is used to show package information on a Debian system? Please answer in English, paying attention to case sensitivity.