Operations 5 min read

Master yum: Install, Remove, and Manage Packages on CentOS Efficiently

This guide explains how to use the yum command on CentOS to install, verify, list, and remove packages, manage repository configurations, and perform offline downloads, providing practical tips for both beginners and experienced Linux administrators.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master yum: Install, Remove, and Manage Packages on CentOS Efficiently

yum is a powerful command‑line tool for managing packages on CentOS and other RPM‑based systems. You can install a package such as the C++ compiler with yum install gcc-c++, then verify the installation using rpm -qa | grep gcc-c++.

To see all available versions of a package, run yum list *gcc-c*, and to remove it, use yum remove gcc-c++.

yum Repositories

A yum repository (repo) is a storage location for RPM packages. The configuration files for repos are stored in /etc/yum.repos.d/ with a .repo extension. Each file can define multiple repositories, each identified by a unique name inside square brackets.

Key configuration items include: enabled=1 – enables the repo (0 disables it). gpgkey – location of the GPG key used to verify package signatures. baseurl – the URL of the repository. name – a human‑readable description.

Disabling a repository (e.g., setting enabled=0) prevents yum from using it, which can be useful when troubleshooting dependency issues.

Offline Package Download

If a machine cannot access the internet, you can download RPMs and their dependencies on another system and copy them locally. Install the yum-plugin-downloadonly plugin if needed, then run:

yum install --downloadonly --downloaddir=/tmp/pzqu gcc-c++

The --downloaddir option specifies where the packages are saved.

Postscript

Caching every repository is impractical for most users, but you can create a private repository for your own projects. This allows you to package and distribute your software in an offline environment, a practice that aligns with continuous integration workflows.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

package managementCentOSrepositoriesyumoffline installation
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.