---Yum and RPM Commands---

rpm --queryformat="%{NAME}\n" -qa | less ##show all packages installed by name | through less unless you read REALLY fast

rpm --queryformat="%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}: %{INSTALLTIME:date}\n" -qa ##same as above, but with more details

rpm --queryformat="%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}: %{INSTALLTIME:date}\n" -qa | sort -k 3 -k 5 | sed 's/-[0-9].*//' ##same as above but sort by date install and remove everything after package name

package-cleanup --leaves ##remove unused packages, clean your junk up!

yum update ##check for package updates and interactively ask user if they want to upgrade

yum update --exclude=kernel* ##check for package updates, excluding the kernel, and interactively ask the user if they want to upgrade

yum list installed brasero ##show if package 'brasero' is installed

yum install brasero ##install package 'brasero' and it's depenencies

yum install yum-utils ##install 'yum-utils', this yum extension includes yumdownloader which allows you to download packages without installing them

yumdownloader --resolve --destdir=/home//Downloads/brasero brasero ##download package and it's dependencies and put them in the destdir, extra rpms might be downloaded even though you already have them installed, but this will guarantee the package will work

yum history info brasero ##show yum history for package 'brasero', also shows dependencies that were installed

yum history info brasero | grep -o '[^ ].x86_64[^ ]\|[^ ]noarch[^ ]' ##See Grep and Find commands, useful to download only the packages and dependencies that were needed at the time of installation of package 'brasero'

yum history list all ##show all yum packages installed by history ID

yum history info 11 ##show history ID '11' details, shows packages that were installed/updated, etc

yum whatprovides iostat ##show which package 'iostat' is a part of, in this case, 'iostat' is a part of 'sysstat'

package-cleanup --dupes ##check for duplicate packages that on the system

package-cleanup --cleandupes ##clean installed duplicate packages

############################################ ###---Install and Use Local Repository---### ############################################

yum install yum-utils createrepo ##these packages are needed to create your own repository

mkdir /mnt/localrepo ##create directory where local packages will be stored

touch /etc/yum.repos.d/local.repo ##create a local repo file, this file is used for yum to know where your local repository is located, add the following text to 'local.repo', make sure there aren't any extra spaces

[lclrepo] name=Local Repo baseurl=file:///mnt/localrepo enabled=1 gpgcheck=0

rpm --import /etc/pki/rpm-gpg/RPM* ##optional, if you want to use GPG to check signed rpms, and change the local.repo line gpgcheck=0 to 1

#########################################
###---Test and Use Local Repository---###
#########################################

repotrack -a x86_64 iotop -p /mnt/localrepo/ ##download 'iotop' to local repository for testing, 'iotop' shows disk I/O by process, '-a x86_64' means download only the '-a x86_64' packages, doesn't always work, sometimes downloads i686

yum clean all ##clean the yum cache

cd /etc/yum.repos.d

rename .repo .repo.bak * ##change to yum.repo.d directory and rename all of the repo files to repo.bak, to remove them from the possible repos for yum to pull repos from

mv local.repo.bak local.repo ##rename local.repo.bak to local.repo so that it's the only repo available to yum

createrepo /mnt/localrepo/ ##tell yum where the repository is located

yum update ##update the repo cache from the only available repo, local.repo

yum install iotop ##install iotop, did it work? You should see yum using lclrepo and lclrepo/primary_db for the 'iotop' installation

  ###########################################################
  ###---Restore Yum Back to Using Internet Repositories---###
  ###########################################################

cd /etc/yum.repos.d

rename .repo.bak .repo *

yum clean all

yum update ##This will update the yum cache and update ALL packages, if you just want to update the yum cache answer 'n' after the yum update completes

######################################################################### ###---Install EPEL for Centos (Extra Packages for Enterprise Linux)---### #########################################################################

###---Version 6.x/7.x---###

yum install epel-release ####download the EPEL package list

###---Manual Version 6.x install---###

rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm ##download the EPEL package list

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 ##import the GPG key to verify rpm signature integrity

yum repolist ##show repolist, look for the 'repo id' line containg 'EPEL', this will show that the EPEL repolsitory list has been added to your Centos box