RPM and YUM Installation in Linux
By Pooja | 23rd July 2025
Introduction
DevOps thrives on automation, speed, and efficiency, and package management plays a crucial role in achieving these goals. In Linux-based environments, particularly those based on Red Hat Enterprise Linux (RHEL) and its derivatives like CentOS, AlmaLinux, and Rocky Linux, two essential tools for managing packages are RPM and YUM.
Understanding how to install, update, remove, and query software using RPM and YUM is vital for DevOps professionals who regularly configure build agents, deploy applications, automate infrastructure, and manage large fleets of servers. This article will cover both RPM and YUM comprehensively from a DevOps perspective.
What is RPM?
RPM stands for Red Hat Package Manager. It is a low-level package management system used for installing, updating, verifying, and removing software packages in .rpm format.
Key characteristics:
- Does not resolve dependencies automatically.
- Works directly with .rpm files.
- Provides robust command-line tools.
- Preferred when working in air-gapped environments or with custom-built software.
What is YUM?
YUM (Yellowdog Updater, Modified) is a higher-level front-end tool built on top of RPM. It simplifies package management by:
- Automatically resolving dependencies.
- Fetching packages from online or local repositories.
- Providing group installations and update management.
DNF (Dandified YUM) is the modern replacement for YUM in newer RHEL-based systems, offering better performance and dependency resolution.
Importance of RPM and YUM in DevOps
In DevOps workflows, RPM and YUM are critical for:
- Automating software installation during server provisioning.
- Creating reproducible environments in CI/CD pipelines.
- Patching and securing systems through package updates.
- Customizing application stacks on bare-metal or virtual machines.
- Managing software versioning and dependencies effectively.
For configuration management tools like Ansible, Chef, or Puppet, YUM modules are commonly used to install required packages before application deployment.
RPM vs. YUM: Key Differences
Feature |
RPM |
YUM |
Dependency Handling |
Manual |
Automatic |
Usage |
Low-level, granular |
High-level, user-friendly |
Source |
Local .rpm files |
Remote repositories or local |
Speed |
Faster but limited |
Slower but more powerful |
Use Case |
Custom packages, scripting |
Regular updates, automation |
Both tools can be used together, but YUM is usually preferred for ease and automation.
Installing Software with RPM
Downloading a .rpm File
Example: Install Docker using RPM
bash
CopyEdit
wget https://download.docker.com/linux/centos/docker-ce.rpm
Installing with RPM
bash
CopyEdit
sudo rpm -ivh docker-ce.rpm
- -i: Install
- -v: Verbose
- -h: Print hash marks (progress)
Upgrading a Package
bash
CopyEdit
sudo rpm -Uvh docker-ce.rpm
Removing a Package
bash
CopyEdit
sudo rpm -e docker-ce
Checking Installed Packages
bash
CopyEdit
rpm -qa | grep docker
Common RPM Commands
Command |
Purpose |
rpm -i package.rpm |
Install a package |
rpm -U package.rpm |
Upgrade a package |
rpm -e package |
Remove a package |
rpm -qa |
Query all installed packages |
rpm -qi package |
Get detailed package information |
rpm -ql package |
List installed files from package |
rpm -V package |
Verify integrity |
These commands are useful for scripting package audits and ensuring system consistency.
YUM Basics and How It Works
YUM reads repository metadata to perform package management. Repositories are configured under:
bash
CopyEdit
/etc/yum.repos.d/
Each .repo file contains:
ini
CopyEdit
[docker-ce]
name=Docker CE Repository
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable
enabled=1
gpgcheck=1
YUM uses this metadata to resolve dependencies and fetch packages.
Installing Software with YUM
Installing Packages
bash
CopyEdit
sudo yum install git
YUM resolves and installs all required dependencies.
Installing Multiple Packages
bash
CopyEdit
sudo yum install nginx mysql vim -y
Removing Packages
bash
CopyEdit
sudo yum remove mysql
Upgrading All Packages
bash
CopyEdit
sudo yum update -y
This is often used in patch management automation for security.
More deep into this Linux Server Installation
Managing Repositories with YUM
You can enable or disable repositories as needed:
bash
CopyEdit
sudo yum-config-manager –disable epel
sudo yum-config-manager –enable extras
You can also add custom repositories by creating .repo files in /etc/yum.repos.d/.
Example (local repo):
ini
CopyEdit
[localrepo]
name=Local Repository
baseurl=file:///mnt/repo/
enabled=1
gpgcheck=0
YUM Groups and Modules
YUM supports installing software groups (meta-packages):
bash
CopyEdit
sudo yum group list
sudo yum groupinstall “Development Tools”
This is useful for installing build environments or desktops.
Modular Repos
Some packages have multiple versions available via modules.
bash
CopyEdit
sudo yum module list php
sudo yum module enable php:7.4
sudo yum install php
This allows precise version control in automated environments.
Security and Updates
Keep systems secure by regularly updating packages:
bash
CopyEdit
sudo yum update
You can also install security-only updates (RHEL/CentOS with subscription):
bash
CopyEdit
sudo yum update –security
Regular patching is essential for compliance and reducing vulnerability.
Automation with YUM in DevOps
Using Ansible:
yaml
CopyEdit
– name: Install required packages
 yum:
   name: “{{ item }}”
   state: present
 loop:
   – nginx
   – git
   – python3
Using Shell Script:
bash
CopyEdit
#!/bin/bash
yum update -y
yum install nginx -y
systemctl enable nginx
systemctl start nginx
This kind of automation is integrated in Jenkins jobs, Terraform scripts, and cloud-init processes.
Real-World Use Cases
- Provisioning CI Agents: Use YUM to install Java, Docker, Node.js.
- Security Updates: Automate with cron and yum-cron.
- Offline Installations: Download .rpm and use RPM for air-gapped VMs.
- Immutable Infrastructure: Bake .rpm installs into Packer images.
- Custom Repositories: Set up internal repos for enterprise packages.
Best Practices
- Always use -y for automated scripts to avoid prompts.
- Avoid using RPM unless dependency resolution is handled.
- Clean YUM cache regularly:
bash
CopyEdit
sudo yum clean all
- Use yum history to audit changes:
bash
CopyEdit
yum history list
yum history undo <transaction-id>
- Secure repos by enabling GPG signature verification.
Conclusion
RPM and YUM are foundational tools in the DevOps toolkit for managing packages on RHEL-based Linux distributions. Whether it’s provisioning build agents, automating deployments, or applying security patches, RPM and YUM provide the flexibility, control, and power required in modern DevOps workflows.
YUM, with its repository integration and dependency resolution, makes large-scale system management and automation easy. RPM, on the other hand, gives you fine-grained control when needed. Understanding both empowers DevOps professionals to build robust, repeatable, and secure infrastructure across physical, virtual, and cloud environments.
Explore Our Recent Blogs
RPM and YUM Installation in Linux
CloudJuly 23, 2025
Linux Administration Commands in Linux
CloudJuly 23, 2025
Networking Commands
CloudJuly 22, 2025
File Permissions in Linux
CloudJuly 22, 2025
Importance of Linux in DevOps
CloudJuly 21, 2025