Yum is a package manager used in Red Hat-based systems like Fedora, CentOS, and Red Hat Enterprise Linux. With Yum, users can easily install, update, and remove packages from the terminal. In this article, we’ll explore the basic Yum commands and their options, with examples to help you get started.
Installing Packages with Yum
The most basic use of Yum is to install packages. To install a package, you simply use the command “yum install” followed by the name of the package you want to install. For example, to install the Nano text editor, you would run the following command:
yum install nano
Yum will then search for the package in its repositories, download and install it, along with any dependencies it requires. You’ll be prompted to confirm the installation before it proceeds.
Updating Packages with Yum
To keep your system up-to-date, you can use Yum to update all of your installed packages. To do this, you use the “yum update” command:
Yum will then search for newer versions of all of your installed packages, and prompt you to confirm the updates. It’s a good idea to run this command regularly, so you can keep your system secure and stable.
Removing Packages with Yum
If you no longer need a package, you can use Yum to remove it. To remove a package, you use the “yum remove” command followed by the name of the package you want to remove. For example, to remove the Nano text editor, you would run the following command:
yum remove nano
Yum will then remove the package and any dependencies that are no longer required.
In addition to these basic commands, Yum has several options that allow you to customize its behavior. Here are some of the most commonly used options:
-y, –assumeyes: This option tells Yum to assume “yes” for any prompts, and proceed with the command without waiting for user input. For example, to update all packages without being prompted for confirmation, you would use the following command:
yum update -y
-q, –quiet: This option tells Yum to run in quiet mode, with no output to the terminal. This can be useful if you’re running Yum from a script, and don’t want to see the output.
yum update -q
-x, –exclude: This option allows you to exclude specific packages from a Yum command. For example, if you want to update all packages except for the Nano text editor, you would use the following command:
yum update -x nano
–security: This option tells Yum to only update security-related packages. This can be useful if you want to ensure your system is secure, without updating other packages that may break compatibility.
yum update --security
–list: This option tells Yum to list the packages that would be affected by the command, without actually performing the action. For example, to see what packages would be updated without actually updating them, you would use the following command:
yum update --list
Yum is a powerful package manager that makes it easy to install, update, and remove packages on Red Hat-based systems. With its basic commands and options, you can quickly manage your system’s packages, ensuring it’s up-to-date, secure, and running smoothly. Whether you’re a beginner or an experienced user, Yum is an essential tool for managing your Linux system.