Skip to content

RedHat

Training

Ebook

Red Hat API Tokens

https://access.redhat.com/management/api eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhZDUyMjdhMy1iY2ZkLTRjZjAtYTdiNi0zOTk4MzVhMDg1NjYifQ.eyJpYXQiOjE2ODExODQxNjcsImp0aSI6IjliODk0MGE4LWY5MTItNGEwOC1hYzJjLTZkNGQyN2YzNWJiMSIsImlzcyI6Imh0dHBzOi8vc3NvLnJlZGhhdC5jb20vYXV0aC9yZWFsbXMvcmVkaGF0LWV4dGVybmFsIiwiYXVkIjoiaHR0cHM6Ly9zc28ucmVkaGF0LmNvbS9hdXRoL3JlYWxtcy9yZWRoYXQtZXh0ZXJuYWwiLCJzdWIiOiJmOjUyOGQ3NmZmLWY3MDgtNDNlZC04Y2Q1LWZlMTZmNGZlMGNlNjp0ZWRjaGFuZ2NoaWVuQHN1cGVybWljcm8uY29tLnR3IiwidHlwIjoiT2ZmbGluZSIsImF6cCI6InJoc20tYXBpIiwic2Vzc2lvbl9zdGF0ZSI6ImI3MGNhMjMxLThhZjctNDg2Yi1hNzczLWI4MTYwYzIwZThiMyIsInNjb3BlIjoib2ZmbGluZV9hY2Nlc3MiLCJzaWQiOiJiNzBjYTIzMS04YWY3LTQ4NmItYTc3My1iODE2MGMyMGU4YjMifQ.t55UUlk1dIzEZ8I6fFqBuLJxpQH3iNwv1oPpH6k8BHA

Downloading an ISO image using curl

  • https://web.archive.org/web/20240422004454/https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/performing_a_standard_rhel_8_installation/downloading-beta-installation-images_installing-rhel#downloading-an-iso-image-with-curl_downloading-beta-installation-images
    • You have an offline token generated from Red Hat API Tokens.
    • You have a checksum of the file you want to download from Product Downloads.
      #!/bin/bash
      # set the offline token and checksum parameters
      offline_token="<offline_token>"
      checksum=<checksum>
      
      # get an access token
      access_token=$(curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id=rhsm-api -d refresh_token=$offline_token | jq -r '.access_token')
      
      # get the filename and download url
      image=$(curl -H "Authorization: Bearer $access_token" "https://api.access.redhat.com/management/v1/images/$checksum/download")
      filename=$(echo $image | jq -r .body.filename)
      url=$(echo $image | jq -r .body.href)
      
      # download the file
      curl $url -o $filename
      

Red Hat Subscription Management

Register a system by using the credentials of the Red Hat Customer Portal as the root user

[root@host ~]# subscription-manager register --username <yourusername>
Registering to: subscription.rhsm.redhat.com:443/subscription
Password: yourpassword
The system has been registered with ID: 1457f7e9-f37e-4e93-960a-c94fe08e1b4f
The registered system name is: host.example.com

[root@host ~]# subscription-manager register --username foo@bar.com --password foobar --auto-attach

View available subscriptions for your Red Hat account

[root@host ~]# subscription-manager list --available

Auto-attach a subscription

[root@host ~]# subscription-manager attach --auto

Alternatively, attach a subscription from a specific pool from the list of available subscriptions

[root@host ~]# subscription-manager attach --pool=poolID

View consumed subscriptions

[root@host ~]# subscription-manager list --consumed

did this system get properly registered?

subscription-manager identity

Unregister a system

[root@host ~]# subscription-manager unregister

RPM Software Packages

RPM package file names consist of four elements (plus the .rpm suffix): name-version-release.architecture

ARCH is the processor architecture that the package is compiled to run on. The x86_64 value indicates that this package is built for the 64-bit version of the x86 instruction set (as opposed to aarch64 for 64-bit ARM, and so on).

RPM packages are often downloaded from repositories. - A repository is a central location for storing and maintaining RPM software packages.

Each RPM package is an archive with the following components - The files that the package installs in your system. - Information about the package (metadata), such as the name, version, release, and architecture; a summary and description of the package; whether it requires other packages to be installed; licensing; a package change log; and other details. - Scripts that might run when you install, update, or remove the package. These scripts might also run when you install, update, or remove other packages.

Typically, software providers digitally sign RPM packages with GPG (GNU Privacy Guard) keys. (Red Hat digitally signs all packages that it releases.) - The RPM system verifies package integrity by confirming that the package is signed with the appropriate GPG key. - The RPM system fails to install a package if the GPG signature does not match.

Typically, only one version of a package is installed at a time. If a package is built with non-conflicting file names, then you might install multiple versions. - The kernel package is a an example of installing multiple package versions.

# List all installed packages
rpm -qa
# Determine which package provides FILENAME
rpm -qf /etc/yum.repos.d
# List the currently installed package version
rpm -q dnf
# Get detailed package information
rpm -qi wget
#  List the files that the package installs
rpm -ql wget
# List only the configuration files that the package installs
rpm -qc wget
# List only the documentation files that the package installs.
rpm -qd openssh-clients
# List the shell scripts that run before or after you install or remove the package.
rpm -q --scripts openssh-server
# List the change log information for the package
rpm -q --changelog openssh-server

# install an RPM package that you downloaded to your local directory
rpm -ivh podman-4.0.0-6.el9.x86_64.rpm

# Use the rpm2cpio command to extract files from an RPM package file without installing the package.
# The rpm2cpio command converts an RPM package to a cpio archive. After the RPM package is converted to a cpio archive, the cpio command can extract a list of files.
[user@host tmp-extract]$ rpm2cpio httpd-2.4.51-7.el9_0.x86_64.rpm | cpio -idv

# Extract individual files by specifying the path of the file
rpm2cpio httpd-2.4.51-7.el9_0.x86_64.rpm | cpio -id "*/etc/httpd/conf/httpd.conf"

# list the files in an RPM package
rpm2cpio httpd-2.4.51-7.el9_0.x86_64.rpm | cpio -tv

Manage Software Packages with DNF

The low-level rpm command can be used to install packages, but it is not designed to work with package repositories or to resolve dependencies from multiple sources automatically.

DNF improves RPM-based software installation and updates. With the dnf command, you can install, update, remove, and get information about software packages and their dependencies.

# displays installed packages from which repo name
 dnf list installed | grep fping
 dnf list installed | grep perl-Net-SNMP

# displays installed and available packages
dnf list 'http*'

# lists packages by keywords that are in the name and summary fields only
dnf search 'web server'

# lists packages by keywords that are in the name, summary, and description fields
dnf search all 'web server'

# detailed information about a package
dnf info httpd

# displays packages that match the specified path name
dnf provides /var/www/html

# obtains and installs a software package, including any dependencies
dnf install httpd

# obtains and installs a later version of the specified package, including any dependencies.
# Generally, the process tries to preserve configuration files in place, but in some cases, those files might be renamed if the packager considers that the earlier name will not work after the update.

:::danger The dnf remove command removes the listed packages and any package that requires the packages to be removed (and packages which require those packages, and so on). This command can lead to unexpected removal of packages :::

Because a new kernel can be tested only by booting to that kernel, the package specifically supports the installation of multiple versions at once. If the new kernel fails to boot, then the earlier kernel is still available.

# list all installed and available kernels
dnf list kernel

# view the currently running kernel
uname -r
uname -a

# installs the new kernel
dnf update kernel

Groups of Software with DNF

concept of groups, which are collections of related software that are installed together

two kinds of package groups. - Regular groups are collections of packages. - Environment groups are collections of regular groups.

# shows the names of installed and available groups
dnf group list

# Some groups are normally installed through environment groups and are hidden by default.
#  List these hidden groups
dnf group list hidden

# displays information about a group. It includes a list of mandatory, default, and optional package names.
dnf group info "RPM Development Tools"


# installs a group that installs its mandatory and default packages and their dependent packages.
dnf group install "RPM Development Tools"

All installation and removal transactions are logged in the /var/log/dnf.rpm.log file.

The dnf history command displays a summary of installation and removal transactions.

The dnf history undo command reverses a transaction.

BaseOS and Application Stream

For developers who wanted the latest version of an application and administrators who wanted the most stable version of the application, the resulting situation was tedious to manage.

With modularity, a single repository can host multiple versions of an application's package and its dependencies.

Red Hat Enterprise Linux 9 distributes the content through two main software repositories: BaseOS and Application Stream (AppStream). - The BaseOS repository provides the core operating system content for Red Hat Enterprise Linux as RPM packages. - The Application Stream repository provides content with varying lifecycles as both modules and traditional packages. - The Application Stream repository contains two types of content: modules and traditional RPM packages. - A module describes a set of RPM packages that belong together. - Modules can contain several streams to make multiple versions of applications available for installation.

Red Hat Enterprise Linux 9 supports modular features of Application Stream.

Each module has one or more module streams, which hold different versions of the content Each module can have one or more profiles. - A profile is a list of packages that you can install together for a particular use case, such as for a server, client, development, minimal installation, or other.

DNF Software Repositories

Systems often have access to many Red Hat repositories.

# lists all available repositories and their statuses
dnf repolist all

# enable and disable repositories
dnf config-manager --enable rhel-9-server-debug-rpms

Non-Red Hat sources provide software through third-party repositories. For example, Adobe provides some of its software for Linux through DNF repositories.

The dnf command can access repositories from a website, an FTP server, or the local file system.

You can add a third-party repository in one of two ways. - create a .repo file in the /etc/yum.repos.d/ directory - add a [repository] section to the /etc/dnf/dnf.conf file

Red Hat recommends using .repo files, and reserving the dnf.conf file for additional repository configurations.

# add repositories to the machine
[user@host ~]$ dnf config-manager \
--add-repo="https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/"

# imports the RPM-GPG-KEY-EPEL-9 (EPEL) GPG public key and installs the RHEL9 Extra Packages for Enterprise Linux (EPEL) repository RPM
[user@host ~]$ rpm --import \
https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-9
[user@host ~]$ dnf install \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
dnf config-manager --add-repo=https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo

GUI

dnf groupinstall "Server with GUI"
dnf group list hidden
systemctl set-default graphical.target
systemctl isolate graphical.target
systemctl status gdm.service
systemctl restart gdm.service

Kickstart

RAID + LVM

sample 1

bootloader --append="crashkernel=auto" --location=mbr --boot-drive=sda
part raid.2025 --fstype="mdmember" --ondisk=sdb --size=3813822
part /boot --fstype="xfs" --size=1024
part /boot/efi --fstype="efi" --size=600 --fsoptions="umask=0077,shortname=winnt"
part raid.2018 --fstype="mdmember" --ondisk=sda --size=3813822
raid pv.2032 --device=pv00 --fstype="lvmpv" --level=RAID0 --chunksize=512 raid.2018 raid.2025
volgroup rhel --pesize=4096 pv.2032
logvol / --fstype="xfs" --grow --size=1024 --name=root --vgname=rhel
logvol /home --fstype="xfs" --size=7551608 --name=home --vgname=rhel
logvol swap --fstype="swap" --size=4096 --name=swap --vgname=rhel
[anaconda root@s8is001 ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0             7:0    0 674.5M  1 loop
loop1             7:1    0     3G  1 loop
|-live-rw       253:0    0     3G  0 dm    /
`-live-base     253:1    0     3G  1 dm
loop2             7:2    0    32G  0 loop
`-live-rw       253:0    0     3G  0 dm    /
sda               8:0    1   3.7T  0 disk
|-sda1            8:1    1   600M  0 part  /mnt/sysroot/boot/efi
|-sda2            8:2    1     1G  0 part  /mnt/sysroot/boot
`-sda3            8:3    1   3.7T  0 part
  `-md127         9:127  0   7.3T  0 raid0
    |-rhel-swap 253:2    0     4G  0 lvm   [SWAP]
    |-rhel-home 253:3    0   7.2T  0 lvm   /mnt/sysroot/home
    `-rhel-root 253:4    0    70G  0 lvm   /mnt/sysroot
sdb               8:16   1   3.7T  0 disk
`-sdb1            8:17   1   3.7T  0 part
  `-md127         9:127  0   7.3T  0 raid0
    |-rhel-swap 253:2    0     4G  0 lvm   [SWAP]
    |-rhel-home 253:3    0   7.2T  0 lvm   /mnt/sysroot/home
    `-rhel-root 253:4    0    70G  0 lvm   /mnt/sysroot
sdc               8:32   1   3.7T  0 disk
nvme0n1         259:0    0 894.3G  0 disk

sample 2

ignoredisk --only-use=nvme0n1,nvme1n1
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part raid.1186 --fstype="mdmember" --ondisk=nvme1n1 --size=1026
part raid.3290 --fstype="mdmember" --ondisk=nvme1n1 --size=12816
part raid.2703 --fstype="mdmember" --ondisk=nvme0n1 --size=10256
part raid.1658 --fstype="mdmember" --ondisk=nvme1n1 --size=12816
part raid.389 --fstype="mdmember" --ondisk=nvme0n1 --size=5128
part raid.4558 --fstype="mdmember" --ondisk=nvme1n1 --size=1625420
part raid.1179 --fstype="mdmember" --ondisk=nvme0n1 --size=1026
part raid.3283 --fstype="mdmember" --ondisk=nvme0n1 --size=12816
part raid.4551 --fstype="mdmember" --ondisk=nvme0n1 --size=1625420
part /boot/efi --fstype="efi" --size=2048 --fsoptions="umask=0077,shortname=winnt"
part raid.2159 --fstype="mdmember" --ondisk=nvme0n1 --size=131200
part raid.1651 --fstype="mdmember" --ondisk=nvme0n1 --size=12816
part raid.3899 --fstype="mdmember" --ondisk=nvme0n1 --size=12816
part raid.3906 --fstype="mdmember" --ondisk=nvme1n1 --size=12816
part /boot --fstype="xfs" --size=2048
part raid.2166 --fstype="mdmember" --ondisk=nvme1n1 --size=131200
part raid.396 --fstype="mdmember" --ondisk=nvme1n1 --size=5128
part raid.2710 --fstype="mdmember" --ondisk=nvme1n1 --size=10256
raid swap --device=swap --fstype="swap" --level=RAID0 --chunksize=512 raid.2159 raid.2166
raid /home --device=home --fstype="xfs" --level=RAID0 --chunksize=512 raid.1179 raid.1186
raid /var/log/audit --device=var_log_audit --fstype="xfs" --level=RAID0 --chunksize=512 raid.3899 raid.3906
raid /usr --device=usr --fstype="xfs" --level=RAID0 --chunksize=512 raid.2703 raid.2710
raid /tmp --device=tmp --fstype="xfs" --level=RAID0 --chunksize=512 raid.4551 raid.4558
raid /var/log --device=var_log --fstype="xfs" --level=RAID0 --chunksize=512 raid.3283 raid.3290
raid /var --device=var --fstype="xfs" --level=RAID0 --chunksize=512 raid.1651 raid.1658
raid / --device=root --fstype="xfs" --level=RAID0 --chunksize=512 raid.389 raid.396
nvme1n1      259:0    0   1.8T  0 disk
├─nvme1n1p1  259:2    0 128.1G  0 part
│ └─md127      9:127  0   256G  0 raid0 [SWAP]
├─nvme1n1p2  259:3    0  12.5G  0 part
│ └─md123      9:123  0    25G  0 raid0 /var
├─nvme1n1p3  259:4    0  12.5G  0 part
│ └─md120      9:120  0    25G  0 raid0 /var/log
├─nvme1n1p4  259:5    0  12.5G  0 part
│ └─md121      9:121  0    25G  0 raid0 /var/log/audit
├─nvme1n1p5  259:7    0    10G  0 part
│ └─md126      9:126  0    20G  0 raid0 /usr
├─nvme1n1p6  259:8    0     5G  0 part
│ └─md125      9:125  0    10G  0 raid0 /
├─nvme1n1p7  259:11   0     1G  0 part
│ └─md122      9:122  0     2G  0 raid0 /home
└─nvme1n1p8  259:13   0   1.6T  0 part
  └─md124      9:124  0   3.1T  0 raid0 /tmp
nvme0n1      259:1    0   1.8T  0 disk
├─nvme0n1p1  259:6    0     2G  0 part  /boot/efi
├─nvme0n1p2  259:9    0     2G  0 part  /boot
├─nvme0n1p3  259:10   0 128.1G  0 part
│ └─md127      9:127  0   256G  0 raid0 [SWAP]
├─nvme0n1p4  259:12   0  12.5G  0 part
│ └─md123      9:123  0    25G  0 raid0 /var
├─nvme0n1p5  259:14   0  12.5G  0 part
│ └─md120      9:120  0    25G  0 raid0 /var/log
├─nvme0n1p6  259:15   0  12.5G  0 part
│ └─md121      9:121  0    25G  0 raid0 /var/log/audit
├─nvme0n1p7  259:16   0    10G  0 part
│ └─md126      9:126  0    20G  0 raid0 /usr
├─nvme0n1p8  259:17   0     5G  0 part
│ └─md125      9:125  0    10G  0 raid0 /
├─nvme0n1p9  259:18   0     1G  0 part
│ └─md122      9:122  0     2G  0 raid0 /home
└─nvme0n1p10 259:19   0   1.6T  0 part
  └─md124      9:124  0   3.1T  0 raid0 /tmp

if re-install the disk which has configured with raid

########################################################################
# create the partition scheme file /tmp/partitionfile
########################################################################

# disabling md RAID resync during installation
# this speeds up the installation process significantly
echo "[$0] disabling md RAID resync during installation"
echo 0 > /proc/sys/dev/raid/speed_limit_max
echo 0 > /proc/sys/dev/raid/speed_limit_min
# get all disks md raid
mdraid=$(grep -E "^md[0-9]+" /proc/mdstat | awk '{print $1}')
# erase all existing md RAIDs
mdadm --stop /dev/${mdraid}
# Remove the Superblocks from the disks
mdadm --zero-superblock /dev/nvme0n1
mdadm --zero-superblock /dev/nvme1n1

# ignoredisk --only-use=nvme1n1,nvme0n1
# System bootloader configuration
echo 'bootloader --append="crashkernel=auto" --location=mbr --boot-drive=nvme0n1' >> /tmp/partitionfile
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
echo 'part raid.2203 --fstype="mdmember" --ondisk=nvme1n1 --size=2050' >> /tmp/partitionfile
echo 'part raid.995 --fstype="mdmember" --ondisk=nvme1n1 --size=1827319' >> /tmp/partitionfile
echo 'part raid.1581 --fstype="mdmember" --ondisk=nvme1n1 --size=2050' >> /tmp/partitionfile
echo 'part raid.2196 --fstype="mdmember" --ondisk=nvme0n1 --size=2050' >> /tmp/partitionfile
echo 'part raid.988 --fstype="mdmember" --ondisk=nvme0n1 --size=1827319' >> /tmp/partitionfile
echo 'part raid.1574 --fstype="mdmember" --ondisk=nvme0n1 --size=2050' >> /tmp/partitionfile
echo 'raid /boot --device=boot --fstype="xfs" --level=RAID1 raid.1574 raid.1581' >> /tmp/partitionfile
echo 'raid pv.1002 --device=pv00 --fstype="lvmpv" --level=RAID0 --chunksize=512 raid.988 raid.995' >> /tmp/partitionfile
echo 'raid /boot/efi --device=boot_efi --fstype="efi" --level=RAID1 --fsoptions="umask=0077,shortname=winnt" raid.2196 raid.2203' >> /tmp/partitionfile
echo 'volgroup rhel --pesize=4096 pv.1002' >> /tmp/partitionfile
echo 'logvol /tmp --fstype="xfs" --size=3282664 --name=tmp --vgname=rhel' >> /tmp/partitionfile
echo 'logvol /var/log/audit --fstype="xfs" --size=25600 --name=var_log_audit --vgname=rhel' >> /tmp/partitionfile
echo 'logvol /var --fstype="xfs" --size=25600 --name=var --vgname=rhel' >> /tmp/partitionfile
echo 'logvol /usr --fstype="xfs" --size=20480 --name=usr --vgname=rhel' >> /tmp/partitionfile
echo 'logvol /var/log --fstype="xfs" --size=25600 --name=var_log --vgname=rhel' >> /tmp/partitionfile
echo 'logvol swap --fstype="swap" --size=262144 --name=swap --vgname=rhel' >> /tmp/partitionfile
echo 'logvol / --fstype="xfs" --size=10240 --name=root --vgname=rhel' >> /tmp/partitionfile
echo 'logvol /home --fstype="xfs" --size=2048 --name=home --vgname=rhel' >> /tmp/partitionfile

yum

offline install package

ISO

on the local repo node
sudo mount -o loop  ISO/rhel-8.5-x86_64-dvd.iso /mnt
shopt -s dotglob
cp -avRpf /mnt/* /var/www/html/8.5
on the target node

/etc/yum.repos.d/BaseOS.repo

[BaseOS]
name=Red Hat Enterprise Linux 8.5 BaseOS
enabled=1
gpgcheck=1
baseurl=http://192.168.89.29/8.5/BaseOS/

/etc/yum.repos.d/AppStream.repo

[AppStream]
name=Red Hat Enterprise Linux 8.5 AppStream
enabled=1
gpgcheck=1
baseurl=http://192.168.89.29/8.5/AppStream/

yum clean all
rm -rf /var/cache/yum/*
yum makecache
yum repolist

reposync

on the node which can access internet
  1. use reposync to /var/www/html/8.5
  2. dump the /var/www/html/8.5 to the another local repo server which has no internet access
subscription-manager release --set=8.5 && rm -rf /var/cache/dnf
# check the repo id, this example is rhel-8-for-x86_64-baseos-rpms and rhel-8-for-x86_64-appstream-rpms
subscription-manager repos --list-enabled
reposync -n -p /var/www/html/8.5 --download-metadata --repo=rhel-8-for-x86_64-baseos-rpms
reposync -n -p /var/www/html/8.5 --download-metadata --repo=rhel-8-for-x86_64-appstream-rpms
on the target node

/etc/yum.repos.d/BaseOS.repo

[BaseOS]
name=Red Hat Enterprise Linux 8.5 BaseOS
enabled=1
gpgcheck=1
baseurl=http://192.168.89.29/8.5/rhel-8-for-x86_64-baseos-rpms/

/etc/yum.repos.d/AppStream.repo

[AppStream]
name=Red Hat Enterprise Linux 8.5 AppStream
enabled=1
gpgcheck=1
baseurl=http://192.168.89.29/8.5/rhel-8-for-x86_64-appstream-rpms/

yum clean all
rm -rf /var/cache/yum/*
yum makecache
yum repolist

specific package

dnf download --resolve podman
dnf --disablerepo=\* install *.rpm
# prepare docker command in rhel system
mkdir -p /tmp/rhel/docker
dnf download --downloaddir=/tmp/rhel/docker --resolve podman-5.4.0 podman-docker docker-compose-plugin

Infiniband

chrome

with internet

/etc/yum.repos.d/google-chrome.repo

[google-chrome]
name=google-chrome
baseurl=https://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub  

sudo dnf upgrade
sudo dnf install google-chrome-stable

without internet

sudo dnf install liberation-fonts vulkan
sudo rpm -ivh google-chrome-stable-119.0.6045.159-1.x86_64.rpm

rescue mode

  1. Boot the system from the relevant Binary DVD or boot disc of the same major release as the system.
  2. Select Troubleshooting/Rescue a Red Hat Enterprise Linux system at the install menu

After entering rescue mode - This shell exists in the installation/rescue environment, with the installed system optionally mounted under /mnt/sysimage. - This shell has a number of tools available for rescuing a system, such as all common file system, disk, LVM, and networking tools.

At the shell prompt, run df to see if the dev, sys, proc filesystems are mounted under /mnt/sysimage

# df

mount -o bind /dev /mnt/sysimage/dev
mount -o bind /sys /mnt/sysimage/sys
mount -t proc /proc /mnt/sysimage/proc
mount -o bind /dev/shm /mnt/sysimage/dev/shm

To chroot to the existing system root

# chroot /mnt/sysimage
# chroot /mnt/sysroot

customized case - /var partition are exploded due to keycloak log

chroot to the existing system root, and check df -h and found /var directories are not mounted. tried to mount /var and it failed till do

# xfs_repair -L /dev/mapper/rhel-var

one of the log continue to grow pass 25G which is the max partition for /var. finally, remove it

xfs_repair

Create a modified Red Hat Enterprise Linux ISO with kickstart file

mkksiso --ks /home/foo/files/ISO/rhel-9.3-x86_64-dvd-ks.cfg /home/foo/files/ISO/rhel-9.3-x86_64-dvd.iso /home/foo/files/ISO/rhel-9.3-x86_64-dvd-embedded-ks.iso
# enable text mode
text

repo --name="AppStream" --baseurl=file:///run/install/sources/mount-0000-cdrom/AppStream

%packages
@^server-product-environment

%end

# network configuration
network --bootproto=dhcp --device=link --activate

# Use CDROM installation media
cdrom

ignoredisk --only-use=sda
clearpart --drives=sda --initlabel
autopart

# Root password
rootpw --iscrypted $6$CJwHTZEau9/0iTFS$euGWh8wHxW.Kt1Fflk7VpRhZG/Icy3Si8Qfput1ekjxl.jwn8qSUJ1.OXEPRzvzjaGpN7HnateJ2pY7XceEOF1
user --groups=wheel --name=foo --password=$6$w.cf4rujMhOUTq9n$Hi3.xqgWZcBC6TnwJwIqC8IKCbnTBlAPHN040bNLX9bjd7TJubPSUEz5Gm2eA0UsGcw2UpGDL/TW6uP5IiHwk. --iscrypte

Redhat Certificate