Yum Cheatsheet

RPM

Where does a software package come from?

rpm -e --nodeps `rpm -q --whatprovides mysql-server`

List all installed RPM packages

rpm -qa

Query a package / show files in package

rpm -ql [packageName]

Yum

Yum operates on and manages RPMs

Yum utils

yum install yum-utils

Then you can run

yum-config-manager

e.g

sudo yum-config-manager --add-repo http://download.opensuse.org/repositories/home:/fengshuo:/zeromq/CentOS_CentOS-6/home:fengshuo:zeromq.repo

 Install RPM

yum install http://sphinxsearch.com/files/sphinx-2.2.11-1.rhel7.x86_64.rpm

Show available updates

yum check-update

Update all

yum -y update

downgrade php

yum downgrade $(rpm -qa --qf "%{NAME}\n" |  grep ^php | awk '{print $1"-5.4.32"}') -y 

Remove

yum remove packagename
yum erase packagemname

searching for installed packages

yum list packagename
yum list tsc\*

 Package info

yum info packagename

 View history

yum history list
history info [transactionNo]
yum history undo [transactionNo]
yum history redo [transactionNo]

What provides

 yum whatprovides '*bin/dig'

Listing all locally installed yum packages

yum list installed

searching for all packages (not installed ones)

yum search packagname

search for all packages that include files called php

yum provides php

Viewing history

Yum History

$ yum history list

 Information about a package name

$ yum info _package_name_

 Show installed packages

repoquery --list packagename

e.g repoquery -l time

Install from specific repo

yum --enablerepo remi,remi-php70 install php-zip
yum install npm --enablerepo=epel