Skip to main content

Software & Packages

RHC Connect (needed for package commands)

rhc connect -u username -p password

connects to red hat subscription manager

username: nicksotelo95

password: RHELsolomon5!!

 

Packages are Collections of Files

  • RPM = Red Hat Package Manager tool
  • CentOS & RHEL packages are in .rpm format

dnf

install CentOS & RHEL packages (formerly yum)

dnf install chrony -y

install time sync manager (yes to prompts)

dnf install httpd -y

install apache web server

rpm -qa | wc -l

count how many packages are installed
-q query
-a all

wc word count

-l lines

dnf install bind

installs Berkeley Internet Name Domain package

cat /etc/redhat-release

check RHEL version

dnf update -y

update all packages to latest version

dnf install ksh -y

install kornshell package

dnf remove ksh -y

remove kornshell package

 

Manual Package Installations

 

Offline Package Installation

wget -O ~/iso-downloads/centos-9.iso <.iso url>

download the iso to ~/iso-downloads and name it centos-9.iso

mkdir -p /mnt/rhel-dvd

create the mount folder

-p create parent if required, suppress errors if already exists

mount -t iso9660 -o loop,ro ~/iso-downloads/centos-9.iso /mnt/rhel-dvd

mount centos-9.iso as /mnt/rhel-dvd

-t (optional) iso9660 type = standard format for optical disks

-o options

loop treats- option to treat the iso as a physical block device

ro read only

df -h

verify mounted disk file system
-h human readable

mkdir -p /localrepo

create a directory for .rpm packages and metadata

cp -rv /mnt/rhel-dvd/BaseOS/Packages/* /localrepo

unpack iso BaseOS to localrepo
-r recursive

-v verbose

cp -rv /mnt/rhel-dvd/AppStream/* /localrepo

unpack iso AppStream to localrepo

dnf install createrepo_c -y

installs the createrepo_c utility

createrepo /localrepo/

scan folder and build the necessary XML metadata in the repository

so dnf/yum can index package names, versions & dependencies

cd /etc/yum.repos.d

go to the location that dns reads .repo (config) files from

mkdir backup

backup existing repo files for later

mv *.repo backup

move any existing repos to backup, disables default Red Hat online repositories

ensures the system only uses local repositories

nano local.repo

[localrepo]

name=localrepo

baseurl=file:///localrepo/

enabled=1

gpgcheck=0

metadata_expire=-1

create a local .repo (config) file for local repositories

repository header

human readable name to show up in lists

exact path to the files, file:/// tells the system to look at a local directory /localrepo/ rather than http://

enabled the repository

disable verification check for security signatures (GPG keys) on the packages

Disable metadata expiry

dnf clean all

delete cached repository metadata and package indexes (existing .repo's)

dnf repolist

list all active software sources

dnf install httpd -y

verifies the local repository can support package installations

 

AI Version

wget -O ~/iso-downloads/centos-9.iso <url>