Updated April 15, 2023
Introduction to CentOS packages
The Linux operating system, we are having various distributions like RHEL, Debian, Gentoo, Ubuntu, Linux Mint, Red Hat Enterprise Linux, CentOS, Fedora, Kali Linux, etc. We have seen different types of packages. Every Linux distribution is having its own capability, functionality, and working expertise. The packages are playing a very important role. We are not using the UI interphase of the CentOS or Linux distribution. Generally, we are using CLI interphase. Here, it is important that we need to understand the type of packages and how to work with them. In CentOS, we getting the packages in different types like rpm, tar file, etc. To install the packages, we are having the two methods like rpm and yum.
Syntax of Useradd Command
rpm [ options ] [ Package Name ]
yum [ options ] command [ Package Name ]
- rpm: We can use the rpm keyword in the syntax or command. It will accept arguments like different options. We are using the different options in it like select options, query options, verify options, install options, etc. The rpm command will help to install the packages in the CentOS operating system.
- yum: We can use the yum keyword in the syntax or command. It will accept arguments like different options, commands, package names, etc. The yum commands will assistance to install the packages with complete dependency.
- option: We can provide the different flags as the option that is compatible with the “rpm” & “yum” command.
- Package Name: As per the requirement, we can use the different CentOS packages.
How CentOS packages Command Works?
In the CentOS environment, we can handle the packages in two different ways like rpm and yum.
Below are the lists of options that are compatible with the rpm packages installation.
- -?, –help: It will help to print the longer usage information as compared to normal.
- –version: It will display a single line of information for the version number of the used rpm package.
- –quiet: It will display the information as short as. As per the normal condition, it will only print the error messages.
- -v: It will help to print the verbose message information while installing the packages in the CentOS system.
- -vv: It will help to print lots of ugly debugging information on the screen.
- –rcfile FILELIST: In the rpm, the colon-separated FILELIST will read sequentially by rpm.
- –pipe CMD: It will get the pipes the output of rpm to the command line.
- –dbpath DIRECTORY: It will help to Use the database at the directory level rather than the default path i.e. the /var/lib/rpm path.
- –root DIRECTORY: It will Use the file system as root at the directory level. It will use for all operations.
- -D, –define=’MACRO EXPR’: It will help to define the MACRO with value EXPR in the CentOS system.
- –undefine=’MACRO’: It will help to undefine the MACRO in the CentOS system.
- -E, –eval=’EXPR’: It will help to print the macro expansion in the EXPR.
Below are the lists of option that are compatible with the yum packages installation.
- install: It will help to install the packages with the help of the yum command.
- update-to: It will help to update the packages like the update command. But in this option will work to specifies the version information to update.
- update-minimal: It will help to update the packages like the update command. But it is not purely like step 1 then step 2 then step 3. As per the requirement, we can install the packages.
- check-update: If we need to check the update without running it interactively then we can use this option. It will print the value of 100 if the packages are available to update in the system. It will return the value is “0” then we can consider it as no packages is available to update.
- upgrade: This option is pointing to the update packages only with the –obsoletes flag set. See update for more details.
- upgrade-to: It will help to upgrade the packages like the update command. But this option will work to specify the version information to update.
- info: It will help to get the description and summary information of the available packages.
- clean: It will help to clean up the things which are collected in the yum cache location or directory.
- makecache: It is used to make usable for the metadata and download the currently enabled yum repos. If we will use this option and set the argument as “fast” then we need to make sure that the repo is currently in the state.
Examples of CentOS packages Command
Here are the follwoing examples mention below
Example #1 – Install rpm packages
In the CentOS environment, we are able to install the rpm packages. The package extension is .rpm.
rpm -ivh mysql-community-client-plugins-8.0.23-1.el7.aarch64.rpm
As per the below screenshot, the rpm packages is not able to install the dependency packages.
Example #2 – Check dependency packages
In the rpm command, we are having the functionality to see the dependency packages.
rpm -qpR mysql-community-client-plugins-8.0.23-1.el7.aarch64.rpm
As per the above command, we are able to get the list of dependency packages which is important to install the mysql-community-client-plugins-8.0.23-1.el7.aarch64.rpm package.
Example #3 – Install packages with yum
In the CentOS environment, we are able to install the packages from the yum utility.
yum install ntp -y
As per the above command, we are installing the ntp packages from the yum utility.
Example #4 – Check repo list through yum
With the help of yum utility, we are able to list the number of repos available in the environment.
As per the above command, we are list out the number of packages in the environment.
We have seen the uncut concept of “CentOS packages” with the proper example, explanation, and command with different outputs. In the CentOS environment, we are having two ways to install packages like rpm and yum. The rpm utility will not resolve the dependency package. But the yum utility will resolve the dependency of the packages.
We hope that this EDUCBA information on “CentOS packages” was beneficial to you. You can view EDUCBA’s recommended articles for more information.