General Information
Managing software packages and repos.
Check to see if updates are available
yum check-update
Update all packages, assume yes to all questions
yum -y update
Search package name and summary for “apache”
yum search apache
View package details
yum info httpd
Install Apache Web Server
yum install httpd
List all installed package
yum list installed
What package created a file (or directory)
yum provides /var/www
Uninstall package
yum remove httpd
Clean yum cache files
yum clean all
List repositories
yum repolist
List available groups
yum group list
List available groups, including hidden
yum group list hidden
List all packages that belong to the “Security Tools” group
yum group info "Security Tools"
Yum group info markers meanings
Install the Security Tools group
yum group install "Security Tools"
To undo a group install:
1) View yum history
yum history Loaded plugins: amazon-id, rhui-lb ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 25 | group install Security T | 2015-06-06 22:21 | Install | 3 24 | -y install httpd | 2015-06-06 21:32 | Install | 1
2) [Optional] View detailed information about ID 25 (Security Tools group install)
yum history info 25 Loaded plugins: amazon-id, rhui-lb Transaction ID : 25 Begin time : Sat Jun 6 22:21:20 2015 Begin rpmdb : 696:2cf91b5d397c109762f978831d2194caabcf22c4 End time : 22:21:21 2015 (1 seconds) End rpmdb : 699:ac6d05d5b20db2192d6b5f7f30723488222723d0 User : <user> Return-Code : Success Command Line : group install Security Tools Transaction performed with: Installed rpm-4.11.1-25.el7.x86_64 @rhui-REGION-rhel-server-releases Installed yum-3.4.3-125.el7.noarch @rhui-REGION-rhel-server-releases Installed yum-metadata-parser-1.1.4-10.el7.x86_64 @anaconda/7.0 Packages Altered: Dep-Install openscap-1.1.1-3.el7.x86_64 @rhui-REGION-rhel-server-releases Dep-Install openscap-scanner-1.1.1-3.el7.x86_64 @rhui-REGION-rhel-server-releases Install scap-security-guide-0.1.19-2.el7.noarch @rhui-REGION-rhel-server-releases history info
3) Undo the group install (removes installed packages)
yum history undo 25
Use yum downloader to download RPM
yumdownloader nano
Install package
rpm -ivh nano-2.3.1-10.el7.x86_64.rpm
List all installed rpm packages
rpm -qa
List all files installed as part of package
rpm -ql nano
List all files that are part of a local RPM file that is not installed yet
rpm -qlp nano-2.3.1-10.el7.x86_64.rpm
List documentation files for a package
rpm -qd nano
List configuration files for a package
rpm -qc nano
Remove package
rpm -e nano
Install local rpm, auto install dependencies
yum install nano-2.3.1-10.el7.x86_64.rpm
Repo config files location
Show all enabled repos
yum repolist
Show all enabled and disabled repos
yum repolist all
Add new repo
yum-config-manager --add-repo=http://dl.fedoraproject.org/pub/epel/7/x86_64
Disable repo using yum-config-manager and repo id (get id from “yum repolist”)
yum-config-manager --disable dl.fedoraproject.org_pub_epel_7_x86_64_
Remove repo
rm -f /etc/yum.repos.d/dl.fedoraproject.org_pub_epel_7_x86_64_.repo
Add new repo; create new file in /etc/yum.repos.d/
vim /etc/yum.repos.d/fedora_epel.repo [EPEL7] name=Fedora EPEL 7 baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64/ enabled=1
Disable repo by editing repo file
vim /etc/yum.repos.d/fedora_epel.repo enabled=0
Setup directory and mount iso
mkdir -p /repos/local mount -o loop rhel-server-7.1-x86_64-dvd.iso /repos/local
Create local repo config file
cd /etc/yum.repos.d/ vim local-repo.repo [local-repo] name=Red Hat Linux Local Repo baseurl=file:///repos/local enabled=1 gpgcheck=0
Download gpg key from repo
cd /etc/pki/rpm-gpg wget http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
Add gpg check and key to repo config
cd /etc/yum.repos.d vim dl.fedoraproject.org_pub_epel_7_x86_64_.repo gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7