We’ll cover more than a 100 commands of the yum
package manager. Which is super handy to the system-administrators in order to be able to manage the packages in Linux distros that use yum
, such as redhat 6 & 7, CentOS 6 & 7 and Scientific Linux 6 & 7.
Keep in mind that a root‘s privileges are needed. To gain those privileges, either login as root with su
if you have the root‘s password, or prefix each of the following command with sudo
if your user is a sudoer.
List all available packages:
[root@centos ~]# yum list available
List all installed packages:
[root@centos ~]# yum list installed
List all installed & available packages:
[root@centos ~]# yum list all
List all installed & available kernel packages:
[root@centos ~]# yum list kernel
List all installed & available package groups:
[root@centos ~]# yum grouplist
Search for vim
package:
[root@centos ~]# yum search vim
List info about coreutils
package:
[root@centos ~]# yum info coreutils
List packages in Fedora Packager
group:
[root@centos ~]# yum groupinfo 'Fedora Packager'
List dependencies of tmux
package:
[root@centos ~]# yum deplist tmux
Show package contains htop
command:
[root@centos ~]# yum provides '*bin/htop'
yum whatprovides '*bin/htop'
.Show package contains README.top
file:
[root@centos ~]# yum provides "*/README.top"
Display a summary information about the advisories for packages that can be updated:
[root@centos ~]# yum updateinfo
yum updateinfo summary
, same as: yum updateinfo summary updates
.Display a summary information only about the installed advisories:
[root@centos ~]# yum updateinfo summary installed
Display a summary information about the advisories for packages available for updating or installation:
[root@centos ~]# yum updateinfo summary available
Display a summary information about both installed and available advisories:
[root@centos ~]# yum updateinfo summary all
Display a list of information about the advisories for packages that can be updated:
[root@centos ~]# yum updateinfo info
yum updateinfo info updates
.Display an information about the advisories FEDORA-EPEL-2020-34c412d66a
:
[root@centos ~]# yum updateinfo info FEDORA-EPEL-2020-34c412d66a
Display an information only about the installed advisories:
[root@centos ~]# yum updateinfo info installed
Display an information about the advisories for packages available for updating or installation:
[root@centos ~]# yum updateinfo info available
Display an information about both installed and available advisories:
[root@centos ~]# yum updateinfo info all
Display a list of the advisories for packages that can be updated:
[root@centos ~]# yum updateinfo list
yum updateinfo list updates
.Display a list of the only installed advisories:
[root@centos ~]# yum updateinfo list installed
Display a list of the advisories for packages available for updating or installation:
[root@centos ~]# yum updateinfo list available
Display a list of both installed and available advisories:
[root@centos ~]# yum updateinfo list all
Display the available security updates:
[root@centos ~]# yum updateinfo security
Display the available bug-fix updates:
[root@centos ~]# yum updateinfo bugfix
Display the available bugzillas updates:
[root@centos ~]# yum updateinfo bugzillas
Display the available CVEs updates:
[root@centos ~]# yum updateinfo cves
Display the available enhancement updates:
[root@centos ~]# yum updateinfo enhancement
Display the available recommended updates:
[root@centos ~]# yum updateinfo recommended
Display the available severity updates:
[root@centos ~]# yum updateinfo severity
Display the available new packages updates:
[root@centos ~]# yum updateinfo new-packages
Display information about epel
repository:
[root@centos ~]# yum repoinfo epel
Display information about all repositories:
[root@centos ~]# yum repoinfo all
Display information about enabled repositories:
[root@centos ~]# yum repoinfo enabled
Display information about disabled repositories:
[root@centos ~]# yum repoinfo disabled
Download yum
repository data to cache:
[root@centos ~]# yum makecache
yum makecache fast
will try to make sure the repos are current (much like “yum clean expire-cache
“).Display all software repositories:
[root@centos ~]# yum repolist all
Display enabled software repositories:
[root@centos ~]# yum repolist
yum repolist enabled
.Display disabled software repositories:
[root@centos ~]# yum repolist disabled
List packages in epel
repository:
[root@centos ~]# yum repo-pkgs epel list
Install all packages in epel
repository:
[root@centos ~]# yum repo-pkgs epel install
Remove all packages in epel
repository:
[root@centos ~]# yum repo-pkgs epel remove
Install vim-enhanced
package:
[root@centos ~]# yum install vim-enhanced
Install multiple packages:
[root@centos ~]# yum install htop tmux
Install all packages in epel
repository:
[root@centos ~]# yum repo-pkgs epel install
Remove htop
and install tmux
:
[root@centos ~]# yum swap htop tmux
yum swap -- remove htop -- install tmux
.Remove Xfce
group and install MATE
group:
[root@centos ~]# yum swap @Xfce @MATE
yum swap -- group remove Xfce -- group install MATE
.Install a local package:
[root@centos ~]# yum localinstall htop.rpm
Install a package from HTTP or FTP URL:
[root@centos ~]# yum localinstall http://some-domain.com/htop.rpm
Install all packages in Security Tools
group:
[root@centos ~]# yum groupinstall "Security Tools"
yum group install "Security Tools"
.Same as:
yum install "@Security Tools"
.Re-install tmux
package:
[root@centos ~]# yum reinstall tmux
tmux
, which will replace any deleted files.Check if there is any available updates:
[root@centos ~]# yum check-update
Update all packages with available updates:
[root@centos ~]# yum update
Update vim-enhanced
package:
[root@centos ~]# yum update vim-enhanced
Update multiple packages:
[root@centos ~]# yum update htop tmux
Update all packages but one:
[root@centos ~]# yum update --exclude=kernel*
-x
. And it can be added as much as needed.Apply the updates even if some dependencies will be missing:
[root@centos ~]# yum update --skip-broken
Apply the updates without checking GPG
signatures:
[root@centos ~]# yum update --nogpgcheck
Apply security-related package updates:
[root@centos ~]# yum update --security
Apply only the bug-fix updates:
[root@centos ~]# yum update-minimal
yum update --bugfix
.Apply only the patches and bug-fix updates:
[root@centos ~]# yum update-minimal --security
yum update --bugfix --security
.Update a package to a specific version:
[root@centos ~]# yum update-to tmux-1.8-4.el7
Downgrade htop
package to earlier version:
[root@centos ~]# yum downgrade htop
- All of the mentioned
update
commands can be applied toupgrade
. - All of the mentioned
update-to
commands can be applied toupgrade-to
. - Except that the
update
is safer thanupgrade
, sinceupdate
doesn’t remove the obsolete packages. (in case of anything goes wrong with the update/upgrade process).
Remove vim-enhanced
package and its dependencies:
[root@centos ~]# yum remove vim-enhanced
yum erase vim-enhanced
.Remove multiple packages:
[root@centos ~]# yum remove htop tmux
yum erase htop tmux
.Remove all packages in epel
repository:
[root@centos ~]# yum repo-pkgs epel remove
yum repository-packages epel remove
.Remove vim-enhanced
package, and remove additional unneeded packages:
[root@centos ~]# yum autoremove vim-enhanced
Remove packages that weren’t installed by user and aren’t required by anything. (Orphans):
[root@centos ~]# yum autoremove
Remove all packages in Security Tools
group:
[root@centos ~]# yum groupremove "Security Tools"
yum group remove "Security Tools"
.Same as:
yum remove "@Security Tools"
.List snapshots:
[root@centos ~]# yum fssnapshot list
yum fssnap list
.Snapshot summary:
[root@centos ~]# yum fssnapshot summary
Check the available space before taking a snapshot:
[root@centos ~]# yum fssnapshot have-space
Create a YUM
snapshot:
[root@centos ~]# yum fssnapshot create
Remove a YUM
snapshot:
[root@centos ~]# yum fssnapshot remove centos/root_yum_20200711
List the current used filters:
[root@centos ~]# yum fs filters
Allow only English language:
[root@centos ~]# yum fs filter languages en
Allow only English & Spanish languages:
[root@centos ~]# yum fs filter languages en:es
Allow all languages:
[root@centos ~]# yum fs filter languages all
Don’t install package’s documentations:
[root@centos ~]# yum fs filter documentation
Allow install of package’s documentation:
[root@centos ~]# yum fs filter nodocumentation
Apply current filters to a package:
[root@centos ~]# yum fs refilter htop
Apply filter clean-up to a package:
[root@centos ~]# yum fs refilter-cleanup htop
Display disk usage of packages in /usr/bin
:
[root@centos ~]# yum fs du /usr/bin
Check the local RPM
database for problems:
[root@centos ~]# yum check
List all yum
install, update and remove actions:
[root@centos ~]# yum history list
Show details of yum
transaction 2:
[root@centos ~]# yum history info 2
Undo the yum
action from transaction 3:
[root@centos ~]# yum history undo 3
Redo the undone yum
action from transaction 4:
[root@centos ~]# yum history redo 4
Delete time records of metadata & mirror lists:
[root@centos ~]# yum clean expire-cache
Delete packages saved in cache:
[root@centos ~]# yum clean packages
Delete the cached metadata:
[root@centos ~]# yum clean metadata
Delete the sqlite database cache:
[root@centos ~]# yum clean dbcache
Delete all cache data from RPM
database:
[root@centos ~]# yum clean rpmdb
Delete all plugins cached data:
[root@centos ~]# yum clean plugins
Clean everything in cache:
[root@centos ~]# yum clean all
Some options that can be used with YUM
command:
-y
,--assumeyes
: Assume yes to all prompt questions.--assumeno
: Assume no to all prompt questions.-q
,--quiet
: Suppress the output.-v
,--verbose
: Produce extra output.--noplugins
: Run command without loading anyYUM
plugins.--enableplugin=
: Enable a particular plugin for a singleYUM
command. (e.g:yum --enableplugin=ps ps
).--disableplugin=
: Disable a particular plugin for a singleYUM
command. (e.g:yum --disableplugin=fastestmirror info htop
).--enablerepo=
: Enable currently disabled repository for a singleYUM
command. (e.g:yum --enablerepo=docker install docker
).--disablerepo=
: Disable currently enabled repository for a singleYUM
command. (e.g:yum --disablerepo=epel list available
).--downloadonly
: Download to/var/cache/yum/ARCH/PROD/REPO/PKG
without installing it. (e.g:yum --downloadonly install tmux
).--downloaddir=
: Specifies an alternate directory to store packages.--changelog
: Display changelog information of a package.