linux_wiki:install_and_update_software_packages_from_red_hat_network_a_remote_repository_or_from_the_local_file_system

Install And Update Software Packages From Red Hat Network A Remote Repository Or From The Local File System

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
  • This includes most of the Virtualization Groups


List all packages that belong to the “Security Tools” group

yum group info "Security Tools"

Yum group info markers meanings

  • “-” = Package isn't installed, and won't be installed as part of the group
    • (Eg. “yum group install foo -pkgA” or “yum group install foo; yum remove pkgA” … this will have pkgA marked as '-')
  • “+” = Package isn't installed, but will be the next time you run “yum upgrade” or “yum group upgrade foo”
  • “ ” = Package is installed, but wasn't installed via the group (so “group remove foo” won't remove it).
  • “=” = Package is installed, and was installed via the group.


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
  • i - install
  • v - verbose
  • h - hash progress bar


List all installed rpm packages

rpm -qa
  • q - query
  • a - all


List all files installed as part of package

rpm -ql nano
  • l - list files


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
  • d - documentation files


List configuration files for a package

rpm -qc nano
  • c - configuration files


Remove package

rpm -e nano
  • -e ⇒ erase


Install local rpm, auto install dependencies

yum install nano-2.3.1-10.el7.x86_64.rpm
  • Note: yum localinstall ⇒ maintained for legacy reasons only, as yum install will behave as a local install if the target is a file.

Repo config files location

  • /etc/yum.repos.d
  • file must end in “.repo”


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
  • [EPEL7] ⇒ repo id
  • Fedora EPEL 7 ⇒ repo name


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

  • linux_wiki/install_and_update_software_packages_from_red_hat_network_a_remote_repository_or_from_the_local_file_system.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)