Managing packages is a crucial aspect of system administration and development in Linux environments, such as CentOS. This guide is designed to introduce you to the top 20 most common examples of package manager usage on CentOS. Whether you are a new system administrator or a seasoned developer, understanding these examples will help you effectively manage your CentOS systemβs packages, ensuring it runs smoothly and securely.
Software Requirements and Linux Command Line Conventions
Category
Requirements, Conventions or Software Version Used
System
CentOS Linux Distribution
Software
YUM or DNF package manager
Other
Internet connection for downloading packages
Conventions
# β requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ β requires given linux commands to be executed as a regular non-privileged user
Top 20 Package Manager Commands for CentOS
Below are detailed examples and explanations of the most common package management operations you can perform on a CentOS system. These operations will help you maintain the software packages on your system effectively.
CentOS Package Management Cheat Sheet
A quick reference guide for system administrators on using YUM and DNF command-line tools for package management in CentOS.
Install a Package: To install a new package on your CentOS system, use the following command. This command will search the configured repositories and install the specified package along with its dependencies.
This command is fundamental for adding new software to your system.
Update a Package: Keep your system secure and up-to-date by updating individual packages as follows. This will ensure you have the latest features and security fixes.
$ sudo dnf update package_name
To update all packages, simply omit the package name.
Remove a Package: If you no longer need a package, you can remove it using the command below. This helps in maintaining a clean system environment.
$ sudo dnf remove package_name
This command will also remove the dependencies that are no longer needed by other packages.
Install a Package from a Specific Repository: If you have multiple repositories configured, you can specify from which repository to install a package.
Upgrade System: To upgrade your entire system to the latest version of all packages, use the following command. This is more comprehensive than updating individual packages.
$ sudo dnf upgrade
This operation can significantly change your system, so use it with caution.
Show Package Information: Get detailed information about a package, including version, release, and description.
$ dnf info package_name
This is useful for understanding what a package does before installing it.
Mastering package management on CentOS with YUM and DNF is essential for maintaining a secure, up-to-date, and efficient system. This guide has covered the top 20 most common package manager examples to help you manage your CentOS system more effectively. Whether youβre installing new software, updating existing packages, or managing repositories, these commands will serve as a solid foundation for your package management tasks.