Updated April 15, 2023
Introduction to CentOS package manager
As we know, the Linux operating system is supporting multiprogramming and multiplies tasking. Due to which we need multiple software to execute the task. To do such software or package installation, we need a package manager utility. It will manage the complete workflow of the package installation. In the Linux environment, the software or tool is distributed through the packages. The same packages are linked with the metadata information. The metadata information consists of the list of dependencies which is important to download the packages, packages description, persistence of the software, etc. While installation the packages, they will be linked with the repository. The repository location will be local or centralized. In this topic, we are going to learn about CentOS package managers.
Syntax of CentOS package manager
[ Package manager Name/Type ] [ Option ] [ Package / Software Name ]
- Package manager Name/Type: As per the requirement, we can use the package manager name as the keyword in the syntax or command. It will accept arguments like different options, package names, etc. It will automatically resolve the dependency and install the necessary packages in the CentOS environment
- option: We can provide the different flags as the option that is compatible with the package manager command.
- Package / Software Name: As per the requirement or the job/application need, we need to pass the package or software name to install the necessary packages.
How does CentOS package manager Command Works?
In the Linux working environment, we are having multiple options of a package manager like Pacman, apt-get, YUM, rpm, DNF, apt, urpmi, zipper, yaourt, packer, etc. As per the package manager, we are able to install the packages with their dependency also. Every package manager is having their own working methodology; if we need to work with the respective package manager, we need to understand the working methodology as well as the syntax of it. We can do the package manager from the CLI as well as from the UI also. It depends on the user’s need from which they want to manage the packages.
In CentOS, we are doing the package management in two different ways, like rpm and yum. The major difference in-between the two methods is package dependency. The rpm method is not able to resolve the dependency of the packages. But in the yum package manager, it will resolve the package dependency, i.e., while installing any packages and the same package is needed, any different packages need to be installed, then the yum package manager will handle the request.
Below is the list of options that are compatible with the rpm package manager
- -?, –help: It will display the extra o details information than the normal message.
- –version: It will display a single line of information in terms of the version number of rpm being used.
- –quiet: It will display the information as little as possible. As per the default nature, it will only print the error messages.
- -v: It will help to print the verbose information. As per the default nature, it will take normally routine the progress messages.
- -vv: It will display lots of ugly debugging information on the screen.
Below is the list of options that are compatible with the yum package manager
- -h, –help: It will help to print the message and then quit automatically.
- -y, –assumeyes: This option can assume to be yes. It can be assumed that the answer to any question which would be asked is yes. It will automatically accept the entire prompt from the UI.
- –assumeno: This option can assume to be no. It can be assumed that the answer to any question which would be asked is no. It will not automatically accept the entire prompt from the UI.
- -c, –config=[config file]: It will help to specifies the configuration file location. It will also take the input from the FTP, Local machine URL, and HTTP.
- -q, –quiet: This option will run without the output.
- -v, –verbose: We can use this option to run the command with a lot of debugging output.
Examples of CentOS package manager
Examples to understand CentOS package manager Command
1. CentOS Package Manager Command: Get the List of Packages in RPM
In the CentOS environment, it is a very simple way to find the list of packages installed in the system.
Command:
rpm -qa
Explanation:
As per the below command, we are able to get the list of packages installed in the system. Here, we are using the “qa” option with the rpm command.
Output:
2. CentOS Package Manager Command: Get details of recent install packages in RPM
In the CentOS environment, we are able to get the details of recently installed packages.
Command:
rpm -qa --last
Explanation:
As per the above rpm command, we are able to get the recently install packages. We are using the “-qa” option with the rpm package manager.
Output:
3. CentOS Package Manager Command: Get the List of Packages in YUM
In the yum command, we are able to get the number of packages that are installed in the machine.
Command:
yum list installed
Explanation:
As per the above command, we are able to list out the number of packages installed in the CentOS system. In the yum command, we are using the “list” option to get the list of installed packages.
Output:
4. CentOS Package Manager Command: Install Packages with YUM
In the CentOS environment, we are able to install the packages in the CentOS environment. We can do that with the help of the yum package manager.
Command:
yum install ntp -y
Explanation:
As per the above command, we are installing the “ntp” packages in the system.
Output:
Conclusion
We have seen the uncut concept of the “CentOS package manager” with the proper example, explanation, and command with different outputs. For the requirement, we can choose the proper package manager. So, it will take care of the proper distribution of packages and resolve the package dependency also.
Recommended Articles
We hope that this EDUCBA information on “CentOS package manager” was beneficial to you. You can view EDUCBA’s recommended articles for more information.