RHCSA Commands: RPM and Flatpak
1. DNF Package Management
| Command | Description | Example |
|---|---|---|
dnf install <package> |
Install a package and its dependencies | dnf install httpd |
dnf install <package> -y |
Install without confirmation prompt | dnf install vim -y |
dnf remove <package> |
Remove a package | dnf remove httpd |
dnf erase <package> |
Alias for remove | dnf erase httpd |
dnf update |
Update all packages | dnf update |
dnf update <package> |
Update a specific package | dnf update httpd |
dnf upgrade |
Same as update (alias) | dnf upgrade |
dnf list |
List all available packages | dnf list |
dnf list installed |
List installed packages | dnf list installed |
dnf list available |
List available (not installed) packages | dnf list available |
dnf list extras |
List packages not in any repository | dnf list extras |
dnf info <package> |
Show detailed package information | dnf info httpd |
dnf search <keyword> |
Search package names and descriptions | dnf search web server |
dnf provides <file> |
Find which package provides a file | dnf provides /etc/httpd/conf/httpd.conf |
dnf whatprovides <file> |
Alias for provides | dnf whatprovides bash |
dnf reinstall <package> |
Reinstall an already installed package | dnf reinstall httpd |
dnf downgrade <package> |
Downgrade a package to an older version | dnf downgrade httpd |
dnf clean all |
Clean all cached data | dnf clean all |
dnf makecache |
Build/update the package cache | dnf makecache |
dnf history |
Show transaction history | dnf history |
dnf history undo <ID> |
Undo a transaction | dnf history undo 5 |
dnf history redo <ID> |
Redo a transaction | dnf history redo 5 |
dnf group list |
List package groups | dnf group list |
dnf group install <group> |
Install a package group | dnf group install "Server with GUI" |
dnf group remove <group> |
Remove a package group | dnf group remove "Server with GUI" |
dnf group update <group> |
Update a package group | dnf group update "Server with GUI" |
dnf swap <pkg1> <pkg2> |
Remove one package and install another in one transaction | dnf swap httpd nginx |
dnf distro-sync |
Upgrade/downgrade packages to match the latest repository versions | dnf distro-sync |
dnf check-update |
Check for available updates without installing | dnf check-update |
dnf version |
Show DNF version | dnf version |
dnf repolist |
List configured repositories | dnf repolist |
dnf repolist all |
List all repositories (including disabled) | dnf repolist all |
2. RPM Basic Operations
| Command | Description | Example |
|---|---|---|
rpm -i <package.rpm> |
Install an RPM package | rpm -i /path/to/package.rpm |
rpm -iv <package.rpm> |
Install with verbose output | rpm -iv package.rpm |
rpm -ivh <package.rpm> |
Install with verbose and hash progress | rpm -ivh package.rpm |
rpm -e <package> |
Erase (remove) a package | rpm -e httpd |
rpm -U <package.rpm> |
Upgrade a package (install if not present) | rpm -U package.rpm |
rpm -F <package.rpm> |
Freshen (upgrade only if installed) | rpm -F package.rpm |
rpm -q <package> |
Query if a package is installed | rpm -q httpd |
rpm -qa |
Query all installed packages | rpm -qa |
rpm -qi <package> |
Query package information | rpm -qi httpd |
rpm -ql <package> |
Query files installed by a package | rpm -ql httpd |
rpm -qc <package> |
Query config files of a package | rpm -qc httpd |
rpm -qd <package> |
Query documentation files | rpm -qd httpd |
rpm -qf <file> |
Query which package owns a file | rpm -qf /etc/passwd |
rpm -V <package> |
Verify a package (check integrity) | rpm -V httpd |
rpm -Va |
Verify all installed packages | rpm -Va |
rpm -K <package.rpm> |
Check package signature (verify) | rpm -K package.rpm |
rpm --import <keyfile> |
Import an RPM GPG key | rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release |
rpm -qpR <package.rpm> |
Query dependencies of an uninstalled package | rpm -qpR package.rpm |
rpm -qR <package> |
Query dependencies of an installed package | rpm -qR httpd |
rpm2cpio <package.rpm> | cpio -idmv |
Extract files from an RPM without installing | rpm2cpio package.rpm | cpio -idmv |
3. DNF Repository Configuration
| Command | Description | Example |
|---|---|---|
dnf repolist |
List enabled repositories | dnf repolist |
dnf repolist all |
List all repositories (enabled and disabled) | dnf repolist all |
dnf config-manager --add-repo <URL> |
Add a new repository from URL | dnf config-manager --add-repo http://example.com/repo.repo |
dnf config-manager --set-enabled <repo> |
Enable a repository | dnf config-manager --set-enabled rhel-8-for-x86_64-baseos-rpms |
dnf config-manager --set-disabled <repo> |
Disable a repository | dnf config-manager --set-disabled rhel-8-for-x86_64-appstream-rpms |
dnf config-manager --disable <repo> |
Alias for set-disabled | dnf config-manager --disable <repo> |
dnf config-manager --enable <repo> |
Alias for set-enabled | dnf config-manager --enable <repo> |
dnf --repo=<repo> install <pkg> |
Install from a specific repository | dnf --repo=baseos install vim |
dnf --disablerepo=<repo> install <pkg> |
Install while disabling a repo | dnf --disablerepo=* --enablerepo=baseos install vim |
dnf --enablerepo=<repo> install <pkg> |
Install while enabling a specific repo | dnf --enablerepo=appstream install httpd |
4. DNF Module Streams
| Command | Description | Example |
|---|---|---|
dnf module list |
List all available modules and streams | dnf module list |
dnf module list <module> |
List streams for a specific module | dnf module list python39 |
dnf module info <module> |
Show detailed module information | dnf module info nginx |
dnf module info <module>:<stream> |
Show info for a specific stream | dnf module info nginx:1.20 |
dnf module install <module> |
Install a module (default stream) | dnf module install nginx |
dnf module install <module>:<stream> |
Install a specific stream | dnf module install python39:3.9 |
dnf module install <module>:<stream>/<profile> |
Install a specific profile within a stream | dnf module install nginx:1.20/common |
dnf module remove <module> |
Remove a module | dnf module remove nginx |
dnf module reset <module> |
Reset a module to default state (uninstall) | dnf module reset nginx |
dnf module enable <module>:<stream> |
Enable a module stream | dnf module enable nginx:1.20 |
dnf module disable <module>:<stream> |
Disable a module stream | dnf module disable nginx:1.16 |
dnf module swap <profile> |
Swap to a different profile within the same stream | dnf module swap nginx:1.20/common |
5. Flatpak
| Command | Description | Example |
|---|---|---|
flatpak install <remote> <app> |
Install an application from a remote | flatpak install flathub org.gimp.GIMP |
flatpak install <app> |
Install from default remote (flathub) | flatpak install org.gimp.GIMP |
flatpak list |
List installed Flatpak applications | flatpak list |
flatpak list --app |
List only applications (not runtimes) | flatpak list --app |
flatpak remove <app> |
Remove an installed application | flatpak remove org.gimp.GIMP |
flatpak uninstall <app> |
Alias for remove | flatpak uninstall org.gimp.GIMP |
flatpak update |
Update all installed Flatpak applications | flatpak update |
flatpak update <app> |
Update a specific application | flatpak update org.gimp.GIMP |
flatpak search <keyword> |
Search for applications | flatpak search gimp |
flatpak remote-list |
List configured remotes | flatpak remote-list |
flatpak remote-add <name> <URL> |
Add a new remote repository | flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo |
flatpak remote-delete <name> |
Remove a remote repository | flatpak remote-delete flathub |
flatpak info <app> |
Show information about an application | flatpak info org.gimp.GIMP |
flatpak run <app> |
Run a Flatpak application | flatpak run org.gimp.GIMP |
6. Repository File Management
| Command | Description | Example |
|---|---|---|
cat /etc/yum.repos.d/<file>.repo |
View repository configuration file | cat /etc/yum.repos.d/redhat.repo |
ls /etc/yum.repos.d/ |
List all repository files | ls /etc/yum.repos.d/ |
vi /etc/yum.repos.d/<file>.repo |
Edit a repository configuration file | vi /etc/yum.repos.d/custom.repo |
7. Package File Location and Mounting
| Command | Description | Example |
|---|---|---|
mount /dev/sr0 /mnt |
Mount a CD/DVD to /mnt | mount /dev/sr0 /mnt |
df -h |
Show disk space usage (verify mount) | df -h |
ls /mnt |
List contents of mounted media | ls /mnt |