Yellowdog Updater, Modified (YUM)

Basic Commands

List packages with pending updates
yum list updates
Show all versions of a package installed on the system
yum --showduplicates list dpdk | expand
Install a specific package
yum install dpdk 19.02-2

If the version you wish to install is older, you may need to…

Remove an installed package
yum remove dpdk
To lock packages
yum install yum-versionlock
yum versionlock dpdk

Stock Repos

/etc/yum.repos.d/

Method 1: Boot to live CD and copy repos from there to your system

Method 2: Create a “base” set of repo files by hand.

Create the following file:

vi /etc/yum.repos.d/Centos-Base.repo

Put the following info inside of the file:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
priority=1

Save your changes, run yum clean all and yum makecache

Method 3: Using rpm, manually reinstall centos-release-rpm

The first step is to see if the centos-release package is installed, by typing rpm -q centos-release

[root@smartproxy-iad ~]# rpm -q centos-release
centos-release-7-6.1810.2.el7.centos.x86_64

If it’s not installed, then the --replacepkgs --replacefiles part of the command can be omitted.

yum remove centos-release
# Option A
rpm -ivh --replacepkgs --replacefiles centos-release*.rpm
# Option B
rpm -Uvh centos-release.*.rpm