Master RPM and YUM: Naming Conventions, Core Commands, and Repository Setup
This guide explains the RPM package naming rules, essential rpm commands for installing, erasing, querying, verifying, and upgrading packages, as well as YUM configuration, repository definition, and common YUM commands for managing software on Red Hat‑based Linux systems.
Overview
In Red Hat based distributions, the RPM Package Manager (originally Red Hat Package Manager) is used to package compiled applications, allowing easy install, upgrade, and removal; YUM is a front‑end tool for RPM.
RPM package naming and basic usage
1. RPM naming format – core and functional packages
Core packages: name-version-release.arch.rpm where version is major.minor.release, e.g., GeoIP-1.5.0-9.el7.x86_64.rpm.
Functional packages: name-function-version-release.arch.rpm, e.g., GeoIP-devel-1.5.0-9.el7.x86_64.rpm.
2. Basic rpm commands
rpm provides install, erase, upgrade, query, verify, and database maintenance.
General syntax: rpm [option] [package_name] (1) Install rpm -i, --install [option] package_name Common options: -v, -vv (verbose), -h (progress bar), --test, --nodeps, --replacepkgs.
(2) Erase rpm -e, --erase [option] package_name Common options: --allmatch, --nodeps, --test.
(3) Query rpm -q, --query [option] package_name Common options: -a, --all (list all installed), -f (find owning package), -l, --list, -i, --info, -c, --configfiles, -d, --docfiles, -R, --require, --provides, --scripts.
(4) Verify rpm -V, --verify [option] package_name Option -a checks package integrity; you can also import the maintainer’s GPG key and verify with rpm --import /etc/pki/rpm-pgp/RPM-GPG-KEY-CentOS-6 and rpm -k package_name.
(5) Upgrade rpm -U, --upgrade [option] package_name or rpm -F, --freshen [option] package_name Options: -U (upgrade or install), -F (freshen), --force.
(6) RPM database management
The RPM database resides in /var/lib/rpm. Use --initdb to initialize and --rebuilddb to rebuild.
YUM usage
YUM (Yellowdog Updater Modified) is the front‑end for RPM. It reads configuration files to locate repositories and install packages.
1. YUM configuration files /etc/yum.conf – global settings; /etc/yum.repos.d/ – repository definitions.
2. Defining a repository
Example entry:
[base]
name=CentOS-$releasever – Base – 163.com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=1Mounting a CD as a local repo: mount -t iso9660 /dev/cdroom /media/cdroom Creating a custom repo file:
[my_yum_repo]
name=local repo
base=/media/Packages
gpgcheck=0
enabled=13. YUM commands
General syntax: yum [option] <command> [package] Common options: -y (assume yes), --noplugins, --nogpgcheck, --disablerepo=repo_name, --enablerepo=repo_name.
Common commands: install, update, remove, list, info, clean, makecache, search, reinstall, repolist, groupinstall, groupinfo.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
