Table of Contents

Linux Command#Software

How to use yum Command in RHEL/CentOS





Commands List

Command Objective Example
yum -h
yum check check rpm database
It will take a lot of time.
yum clean all Clean all cached files from any enabled repository.


Repository Setting

Command Objective
yum repolist ← only enable repository
yum repolist all
Check Repository
yum-config-manager Check Configuration
yum-config-manager --enable REPO_NAME Enable Reposigory
yum-config-manager --disable-repo REPO_NAME Disable repository
yum-config-manager --add-repo REPO_URL Add Repository


Searching Packages

Command Objective Example
yum search STRINGS Find any packages matching a string yum search mysql
yum search apache
yum provides COMMAND/LIBRARY yum provides nping
yum provides libstdc++.so.5
yum provides libgcc_s.so.1
yum whatprovides XXXXX yum whatprovides libstdc++.so.5
yum info PACAGE Check Name, Arch, Version, Release, Description etc yum info lxc
yum deplist PACAGE check the dependences of the packages yum deplist vnc-server
yum deplist tree
yum check-update Checks whether updates exist for packages that are already installed on your system.
yum list Lists all packages that are available in all enabled repositories and all packages that are installed on your system.
You can confirm all rpm version.
yum list |grep httpd
yum list available yum --disablerepo="*" --enablerepo="spp" list available
yum list extras
yum list installed It lists all the packages installed on the system.
You can confirm rpm version.
yum list installed |grep openssh
rpm -qa --last | less
← How to check installed packege order by installed date
yum list updates It lists the packages you can update
You can confirm rpm version.
yum list updates |grep openssh


Install, Remove, Update Packages

Command Objective Example
yum install PACKAGE
yum -y install PACKAGE
yum reinstall PACKAGE
yum localinstall XXXX.rpm
yum remove PACKAGE
yum update ← update all packages
yum update PACKAGE ← update only a package
yum upgrade upgrade is the same as the update command with the --obsoletes flag set.


yum update and yum upgrade

yum update PACKAGE    <- update only a package 
yum update            <- update all packages
yum upgrade

upgrade is the same as the update command with the –obsoletes flag set.
yum update --obsoletes = yum upgrade
The obsoletes option automatically removes packages that you no longer need.

Default /etc/yum.conf
obsoletes=1   #Enable obsoletes option

yum update = yum upgrade


Yum Groups

Command Objective Example
yum groups list (RHEL 7-)
yum groups list hidden
yum grouplist (- RHEL6)
yum --noplugins groups list -v
Lists installed groups and groups
yum groupinfo "GROUPNAME" Displays detailed information about a group.
yum groupinstall "GROUPNAME" Installs all the packages in a group. yum groupinstall "X Window System"
yum groupinstall "GNOME Desktop Environment"
yum groupremove "GROUPNAME" Removes all the packages in a group.
yum groupupdate "GROUPNAME" Updates all the packages in a group.


etc

Command Objective Example
yum history list all
yum history info N
yum history list all
yum history info 8


TIPS

How to Use Proxy

temporary

export http_proxy=http://192.168.0.10:9999/
export https_proxy=http://192.168.0.10:9999/


/etc/yum.conf

[main]
export http_proxy=http://192.168.0.10:9999/
[main]
proxy=http://xx.xx.xx.xx:8080
proxy_username=username
proxy_password=password


Check Reposistory in all repo files

# grep -E "\[*\]|name|baseurl" /etc/yum.repos.d/*.repo


How to use only the specific repository

# yum --disablerepo=* --enablerepo=test-repo repolist
# yum --disablerepo=* --enablerepo=remi,epel search httpd


References