2. Manage Software
πRed Hat Certified System Administrator (RHCSA β EX200)
1. What is an RPM Package?
- RPM stands for Red Hat Package Manager.
- It is the default package format used in RHEL, CentOS, Rocky Linux, AlmaLinux, and other Red Hat-based Linux systems.
- An RPM package is like a container that holds a program, its files, and metadata (version, dependencies, etc.).
- Files end with
.rpm, e.g.,vim-9.0-1.el9.x86_64.rpm.
IT Example:
On a web server, installing httpd via RPM will place all web server files (binaries, configs, logs) in their correct locations.
2. Basic RPM Commands
2.1 Install a Package
rpm -ivh package_name.rpm
-iβ install-vβ verbose (shows progress)-hβ hash marks for progress
Example:
rpm -ivh vim-9.0-1.el9.x86_64.rpm
This installs Vim editor on the system.
Important notes:
- Dependencies: RPM does not automatically resolve dependencies. If a package needs other packages, it will fail unless they are installed.
- File locations: RPM keeps track of all files it installs, so uninstalling is easier.
2.2 Upgrade a Package
rpm -Uvh package_name.rpm
-Uβ upgrade (installs if not present, replaces if already installed)
Example:
rpm -Uvh vim-9.1-1.el9.x86_64.rpm
This upgrades Vim to version 9.1 if an older version exists.
2.3 Remove a Package
rpm -e package_name
-eβ erase/remove package- Only the package name is needed, not the full file name
Example:
rpm -e vim
This removes Vim and all files installed by RPM.
3. Checking Installed Packages
Before removing or upgrading, you often check which packages are installed.
rpm -qa
-qβ query-aβ all
Example:
rpm -qa | grep vim
This will show all installed Vim packages.
4. Querying Package Details
You can see more information about a package:
rpm -qi package_name
- Shows version, release, install date, summary, and license.
rpm -ql package_name
- Lists all files installed by that package.
rpm -qc package_name
- Lists configuration files only.
rpm -q --requires package_name
- Shows dependencies required by the package.
5. Verifying Packages
After installation, you can verify if files are intact:
rpm -V package_name
- If everything is okay, it shows no output.
- If files are modified, it lists the changes (useful for IT admins to detect tampering).
6. Installing RPMs with Dependencies (Using dnf or yum)
- In practice, RPM alone often fails if dependencies are missing.
- In production, admins use
dnf(oryumin older systems) because it resolves dependencies automatically.
dnf install package_name.rpm
- It works like RPM but ensures all required libraries and packages are installed first.
IT Example:
Installing a database server like mysql-server.rpm may need libaio and libgcc dependencies. dnf install handles this automatically.
7. Key Exam Points for RHCSA
For the exam, you must be able to:
- Install an RPM package using
rpm -iordnf install. - Remove a package using
rpm -e. - Query installed packages using
rpm -qa,rpm -qi,rpm -ql. - Verify a package using
rpm -V. - Understand dependencies and that
rpmdoes not auto-resolve them, butdnfdoes.
Tip: RHCSA exam might give you an RPM file and ask you to install it or remove an existing package. Always check:
- Does it install correctly?
- Are dependencies missing?
8. Example Exam Scenario
Task: Install nano-6.4.rpm and check if it works.
rpm -ivh nano-6.4.rpm
rpm -qa | grep nano
nano --version
Task: Remove Vim package:
rpm -e vim
rpm -qa | grep vim # should return nothing
Task: Check which files were installed by httpd:
rpm -ql httpd
β Summary Table for Quick Review
| Action | RPM Command | Notes |
|---|---|---|
| Install | rpm -ivh package.rpm | Fails if dependencies missing |
| Upgrade | rpm -Uvh package.rpm | Installs if not already installed |
| Remove | rpm -e package_name | Only package name needed |
| Query all installed | rpm -qa | Lists all packages |
| Query details | rpm -qi package_name | Shows info about package |
| List files | rpm -ql package_name | Shows all installed files |
| Verify package | rpm -V package_name | Checks file integrity |
This covers everything you need to know for RHCSA EX200 regarding RPM installation and removal. After mastering these, youβll be ready to handle packages on your exam confidently.
