Package management in CentOS is primarily done using the yum
(Yellowdog Updater, Modified) or dnf
(Dandified Yum) commands. These package managers allow users to install, remove, update, and manage software packages on their CentOS systems. Here's an overview of how to use yum
or dnf
for package management:
1. Updating Package Repositories:
- Before installing or updating packages, it's essential to update the package repositories to ensure you have the latest information about available packages. Use one of the following commands:
sudo yum update
sudo dnf update
2. Installing Packages:
- To install a package, use the
install
option followed by the package name. For example:sudo yum install package_name
sudo dnf install package_name
- Replace
package_name
with the name of the package you want to install.
3. Removing Packages:
- To remove a package, use the
remove
option followed by the package name. For example:sudo yum remove package_name
sudo dnf remove package_name
- Replace
package_name
with the name of the package you want to remove.
4. Searching for Packages:
- You can search for packages using the
search
option followed by a keyword. For example:yum search keyword
dnf search keyword
- Replace
keyword
with the term you want to search for.
5. Listing Installed Packages:
- To list installed packages, you can use the
list
option. For example:yum list installed
dnf list installed
6. Updating Packages:
- To update installed packages to the latest available versions, you can use the
update
option. For example:sudo yum update
sudo dnf update
7. Additional Commands:
- Both
yum
anddnf
offer additional commands and options for advanced package management tasks, such as package group management, dependency resolution, and system upgrade procedures.
8. Differences Between yum
and dnf
:
dnf
is the next-generation package manager and is the default in newer versions of CentOS (such as CentOS 8).dnf
offers improved performance, dependency resolution, and additional features compared toyum
.- While
yum
is still available in CentOS 8, it's recommended to usednf
for package management tasks.
Comments