RPM
Ever wondered how software gets installed, updated, and removed on your Linux server? If you’re using a distribution like AlmaLinux, Rocky Linux, or older CentOS systems on your Liquid Web VPS or Dedicated Server, chances are you’re dealing with RPM!
This guide will walk you through the basics of RPM, helping you understand what it is and how it works.
Introduction to RPM
RPM stands for RPM Package Manager. It’s two things in one:
- A Package Format: Think of an
.rpmfile as a neatly packed box. This box contains all the necessary bits for a piece of software: the compiled programs, any configuration files, documentation, and information about what other software it needs to run (dependencies). - A Command-Line Tool: The
rpmcommand is the tool you can use to interact with these package files. It lets you install, query (get information about), verify, update, and uninstall software packages.
Many of the Linux operating systems we offer on our servers like AlmaLinux, Rocky Linux, and CentOS use RPM. It’s a reliable way to manage the software that makes your server tick.
Understanding an RPM file name
You’ll often see RPM files with names like this: mysoftware-1.2.3-1.el9.x86_64.rpm
Let’s break that down:
mysoftware: This is the name of the software package.1.2.3: This is the version number of the software.1: This is the release number of the package. Sometimes, a package needs to be rebuilt even if the software version hasn’t changed (e.g., to include a fix or update build parameters).el9: This often indicates the Linux distribution version it’s built for (e.g., “el9” for Enterprise Linux 9, like AlmaLinux 9 or Rocky Linux 9).x86_64: This is the architecture the package is built for (64-bit in this case, which is standard for most servers). You might also seenoarchfor packages that are not architecture-specific (like documentation or scripts)..rpm: This is the file extension, telling you it’s an RPM package.
Knowing this structure helps you identify exactly what you’re looking at when you download or manage a package.
Using the RPM command
The rpm command is powerful, but for everyday software installation and updates, you’ll more commonly use tools like yum (on older systems like CentOS 7) or dnf (on newer systems like AlmaLinux, Rocky Linux 8+).
Why yum or dnf First? Dependency Handling!
Software often depends on other pieces of software (libraries or other tools) to function correctly. These are called dependencies.
- yum and dnf are smart: When you ask them to install a package, they automatically check for dependencies, download them from configured software repositories (including Liquid Web’s mirrors!), and install everything in the correct order. This makes your life much easier and your system more stable.
- rpm is more direct: The rpm command will try to install a package you give it, but if dependencies are missing, the installation will usually fail, and you’ll have to hunt them down manually. This can be tricky!
So, when would you use the rpm command directly?
It’s mainly for querying and verifying packages, or for installing a specific .rpm file you’ve downloaded manually and you’re sure all dependencies are met.
Here are some common rpm commands that are useful for beginners:
Common rpm command usage
Check if a package is installed and its version
rpm -q httpdThis example checks for the Apache web server package, httpd. It will return the package name if it is installed.
List all installed packages
rpm -qaThis list can be very long! You can filter it using grep, e.g., rpm -qa | grep openssl
Get detailed information about an installed package
rpm -qi httpdThis shows the version, release, install date, size, summary, and description
List the files installed by a package:
rpm -ql httpd(See exactly where all the files for httpd are located on your server)
Find out which package a specific file belongs to
rpm -qf /etc/httpd/conf/httpd.confUseful if you find a file and wonder what software installed it
Install an RPM:
If you’ve downloaded an RPM file (e.g., mycustomsoftware.rpm) and you’re certain about its dependencies:
sudo rpm -ivh mycustomsoftware.rpmHere’s a breakdown of the command:
i: installv: verbose (shows more detailed output)h: hash (shows a progress bar)sudois used because installing software typically requires root privileges.
Upgrade an RPM:
If you have a newer version of an already installed package:
sudo rpm -Uvh newerversionofsoftware.rpmU: upgrade (installs if not present, or upgrades if an older version exists)
Remove (erase) a package:
Removing packages with rpm -e can break other software if that software depends on what you’re removing. yum remove or dnf remove are generally safer as they check dependencies before uninstalling.
This will uninstall the package named “mysoftware”. Replace with the name of the package you wish to erase.
sudo rpm -e mysoftwaree: erase
Key takeaways of RPM
- RPM is a package format (
.rpmfiles) and a command-line tool (rpm) for managing software on many Linux distributions, including those offered by Liquid Web. - For installing, updating, and removing software with automatic dependency handling, always prefer
yumordnfover usingrpmdirectly for these tasks. - The
rpmcommand is excellent for querying information about packages (version, files, etc.) and verifying them. - Understanding basic RPM concepts can empower you to better manage and understand your Liquid Web server.
At Liquid Web, we’re committed to providing you with the help you need. Reach out to our support team for additional assistance.