Linux Tactic

Mastering Package Management on CentOS with YUM

Managing software packages on CentOS is a task that is necessary but can be daunting, especially for those who are new to using Linux-based operating systems. Thankfully, the YUM (Yellowdog Updater Modified) package manager makes the process of managing software on CentOS much easier.

In this article, we will cover the basics of listing and filtering installed packages on CentOS, as well as managing packages with YUM.

Listing and Filtering Installed Packages on CentOS

Before we can manage our packages, we need to know what is currently installed on our system. The YUM package manager makes it easy to list the installed packages on CentOS.

Simply open up a terminal window and run the following command:

yum list installed

This will provide you with a list of all the installed packages on your system. If you are looking for a specific package, you can use the grep command to search for it.

For example, if you are looking for the Apache web server package, you can run the following command:

yum list installed | grep httpd

This will provide you with a list of all the installed packages containing the text “httpd” in their name. Additionally, you can also use the RPM package manager to list installed packages.

To do this, simply run the following command in your terminal window:

rpm -qa

This will provide you with a list of all the installed packages on your system. If you would like to create a list of all the installed packages, you can use the “redirect command output” feature by piping the output of the command to a file.

For example, you can run the following command:

rpm -qa > installed-packages.txt

This will create a file called “installed-packages.txt” in your home directory that contains a list of all the installed packages on your system. Lastly, if you would like to count the total number of installed packages, you can use the “wc” utility.

Simply run the following command:

rpm -qa | wc -l

This will provide you with the total number of installed packages on your system.

Managing Packages with YUM

Now that we know what packages are installed on our system, we can begin managing them. YUM makes it easy to install, remove, update, and search for packages on CentOS.

Installing Packages with YUM

To install a package with YUM, simply run the following command:

yum install [package-name]

For example, if you would like to install the Apache web server, run the following command:

yum install httpd

This will download and install the Apache web server and its dependencies.

Removing Packages with YUM

To remove a package with YUM, simply run the following command:

yum remove [package-name]

For example, if you would like to remove the Apache web server, run the following command:

yum remove httpd

This will remove the Apache web server and any dependencies that are no longer needed.

Updating Packages with YUM

To update a package with YUM, simply run the following command:

yum update [package-name]

For example, if you would like to update the Apache web server to the latest version, run the following command:

yum update httpd

This will download and install the latest version of the Apache web server and its dependencies.

Searching for Packages with YUM

To search for a package with YUM, simply run the following command:

yum search [package-name]

For example, if you are looking for a package to manage your MySQL databases, you can run the following command:

yum search mysql

This will provide you with a list of packages that match the search term “mysql”.

Enabling and Disabling Repositories with YUM

YUM uses repositories to store packages. By default, CentOS comes with a set of repositories that are pre-configured, but you can also enable or disable additional repositories.

To do this, open up the “yum.conf” file located in the “/etc/yum.repos.d/” directory, and uncomment the repositories that you would like to enable or disable by removing or adding “#” in front of the repository’s name.

Conclusion

Managing software packages on CentOS may seem like a daunting task, but with YUM, it is much easier. By using YUM, we can list, filter, install, remove, update, and search for packages with ease.

We hope that this article has been informative and has provided a good starting point for managing software packages on CentOS. In summary, managing software packages on CentOS can be a daunting task but is made easier with the YUM package manager.

This article covered the basics of listing and filtering installed packages on CentOS, as well as managing packages with YUM. The YUM package manager allows us to easily install, remove, update, and search for packages, as well as enable or disable repositories.

The importance of this topic cannot be understated, as managing software packages is crucial for ensuring the security and optimal performance of your system. By using YUM, users can manage their packages with ease and have greater control over their system.

Popular Posts