SYS: Learn to use the yum command.
Presentation of yum
yum is a sophisticated piece of software in charge of dealing with packages and their dependencies. yum will be deprecated in future versions of RHEL. But its successor, dnf, will reuse the same syntax.
Basic Features
To install a new package (here httpd), type:
# yum install httpd
To remove an existing package (here httpd), type:
# yum remove httpd
To get some details about a package (here httpd), type:
# yum info httpd
To install a package group (here “Web Server”), type:
# yum groupinstall "Web Server"
To remove a package group (here “Web Server”), type:
# yum groupremove "Web Server"
To get the list of installed package groups, type:
# yum grouplist
To get some details about a package group (here “Web Server”), type:
# yum groupinfo "Web Server"
To define which package provides a specified file (here semanage), type:
# yum whatprovides */semanage
To search for a particular string (here seinfo), type:
# yum search seinfo
To update the current base of installed packages, type:
# yum update
Note: To get the list of the packages to restart after upgrade, type: # needs-restarting
To get the list of all the available packages, type:
# yum list
To get the list of all the installed packages, type:
# yum list installed
To display the list of all the available but not alerady installed packages, type:
# yum list available
To get the list of the available repository, type:
# yum repolist
To clean up the yum cache, type:
# yum clean all
To get the list of the dependencies associated with a package (here httpd), type:
# yum deplist httpd
Additional Resources
In addition, you can look at Red Hat yum command cheat sheet or watch this Red Hat video about yum basic features. Rosehosting provides a tutorial about getting package information with yum.
Leave a comment