<span>yum</span> is the abbreviation for Yellowdog Updater Modified, a commonly used package management tool in the Red Hat family of Linux distributions (such as CentOS and RHEL). It is based on the RPM package management system and can automatically handle dependencies, installing, updating, or uninstalling packages from specified software repositories.
✅ Common <span>yum</span> Command Examples
1. Update all installed packages in the system
sudo yum update
- This will check for new versions of all installed packages and prompt whether to upgrade.
2. Install a specified package
sudo yum install package_name
- Example:
sudo yum install httpd
- Installs the Apache Web Server.
3. Uninstall a specified package
sudo yum remove package_name
- Example:
sudo yum remove httpd
4. Search for a package
yum search keyword
- Example:
yum search nginx
- This will list available packages that contain the keyword.
5. View package information
yum info package_name
- Example:
yum info httpd
6. List all available packages
yum list all
7. List only installed packages
yum list installed
8. List only updatable packages
yum list updates
9. Clean YUM cache
sudo yum clean all
- This clears all cached data, which can help resolve issues with failed updates or abnormal package downloads.
10. Rebuild cache
sudo yum makecache
- It is recommended to run this command after cleaning the cache to rebuild the local cache.
🧠 Common Option Descriptions
| Option | Description |
|---|---|
<span>-y</span> |
Automatically confirm operations (e.g., <span>sudo yum -y update</span>) |
<span>--exclude=package_name</span> |
Exclude certain packages from being updated |
<span>--disablerepo=repository_name</span> |
Disable a specific repository |
<span>--enablerepo=repository_name</span> |
Enable a specific repository |
⚠️ Notes
<span>yum</span>has been replaced by<span>dnf</span>in CentOS 8 and RHEL 8 (<span>dnf</span>is the next generation of<span>yum</span>, with better compatibility), but most<span>yum</span>commands still work as expected.- All operations that require modifying the system (such as installation and uninstallation) should be executed using
<span>sudo</span>or as root.
📌 Example: Update the system and install common tools in one go
sudo yum update -y && sudo yum install -y vim net-tools wget curl