RedHat
- RHEL | User, Group and Password
- RHEL | Mounting ISO and Setting as Local Repo
- realmd/sssd | Joining a Domain with RHEL and logging in with AD account
- chrony | Set up NTP Server and Client
- timedatectl | Change Date/Time in RHEL
- tar | File Archive Commands
- scp | Push/Pull Files/Directory
- rsync | Synchronise between systems
- LVM | Create/Extend
- RHEL | Mounting ISO and Setting as Local Repo
RHEL | User, Group and Password
User Management
Add new user
useradd
Create a user and set the primary group to something else
sudo useradd -G consultants consultant3
Delete User
userdel johndoe1
Append group to user
usermod -aG sudo myusername
Group Management
Add new group
groupadd
Delete Group
groupdel groupname
Create a new group called consultants with a GID of 35000. (-g is id)
groupadd -g 35000 consultants
Password Management
Change the default max password age
sudo vim /etc/login.defs
Require a new password every 15 days (-M is max days)
chage -M 15 username
Require user to change password on first login (-d )
chage -d 0 username
Change to password date expiry
chage -E 2023-01-27 username
Edit password configs
/etc/login.defs
RHEL | Mounting ISO and Setting as Local Repo
Prerequisite
- A Free RedHat Account
- Official Redhat Linux ISO
No Redhat license is required.
Step 1: Identify the Red Hat OS version
Run the following command in the terminal:
cat /etc/os-release
Look for the line VERSION="8.7 (Ootpa)"
in the output. This will show the version number.
[user@lab-rhel8 ~]$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.7 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.7 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
Step 2: Download the RHEL ISO of the correct version
If you do not have an account, you must register a free account before downloading. Download the RHEL ISO of your version from the official RHEL download website.
Step 3: Mount the ISO from your Hypervisor
From your Hyper-V manager, add the ISO to the DVD drive device of the Virtual Machine.
Step 4: Identify the DVD Drive inside Red Hat Linux
Run the following to identify the correct device name of the DVD drive: lsblk
Look for the label rom
in the TYPE
column. For below example, it is sr0
. This means that DVD drive is located at /dev/sr0
. Take note of this device.
[user@lab-rhel8 ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 2G 0 part /boot
└─sda2 8:2 0 97G 0 part
├─rhel-tmp 253:0 0 5G 0 lvm /tmp
├─rhel-var_log 253:1 0 20G 0 lvm /var/log
├─rhel-var 253:2 0 10G 0 lvm /var
├─rhel-swap 253:3 0 12G 0 lvm [SWAP]
├─rhel-home 253:4 0 10G 0 lvm /home
├─rhel-root 253:5 0 30G 0 lvm /
├─rhel-var_log_audit 253:6 0 5G 0 lvm /var/log/audit
└─rhel-var_tmp 253:7 0 5G 0 lvm /var/tmp
sdb 8:16 0 300G 0 disk
└─sdb1 8:17 0 300G 0 part /appdata
sr0 11:0 1 6.6G 0 rom
Step 5: Create a Mountpoint and mount the DVD Drive locally
For this guide, the mountpoint used will be in /mnt/disc
.
Run the following command file /mnt/disc
to create a mountpoint, if it does not exist yet.
Output will show No such file or directory
if it does not exist.
[user@lab-rhel8 ~]$ file /mnt/disc
/mnt/disc: cannot open `/mnt/disc' (No such file or directory)
Create the mountpoint /mnt/disc
directory with sudo mkdir /mnt/disc
.
[user@lab-rhel8 ~]$ sudo mkdir /mnt/disc
[user@lab-rhel8 ~]$ file /mnt/disc
/mnt/disc: directory
Next, mount the DVD drive (/dev/sr0
) to the mountpoint (/mnt/disc
) with the command mount -o loop RHEL7.9.iso /mnt/disc
.
[user@lab-rhel8 ~]$ sudo mount -o loop /dev/sr0 /mnt/disc
With the DVD drive mounted, you can now list the content inside the disc with ls -al /mnt/disc
.
[user@lab-rhel8 ~]$ ls -al /mnt/disc
total 53
dr-xr-xr-x. 7 root root 2048 Apr 4 2019 .
drwxr-xr-x. 3 root root 18 May 12 14:51 ..
dr-xr-xr-x. 4 root root 2048 Apr 4 2019 AppStream
dr-xr-xr-x. 4 root root 2048 Apr 4 2019 BaseOS
-r--r--r--. 1 root root 60 Apr 4 2019 .discinfo
dr-xr-xr-x. 3 root root 2048 Apr 4 2019 EFI
-r--r--r--. 1 root root 8266 Mar 1 2019 EULA
-r--r--r--. 1 root root 1455 Apr 4 2019 extra_files.json
-r--r--r--. 1 root root 18092 Mar 1 2019 GPL
dr-xr-xr-x. 3 root root 2048 Apr 4 2019 images
dr-xr-xr-x. 2 root root 2048 Apr 4 2019 isolinux
-r--r--r--. 1 root root 103 Apr 4 2019 media.repo
-r--r--r--. 1 root root 1669 Mar 1 2019 RPM-GPG-KEY-redhat-beta
-r--r--r--. 1 root root 5134 Mar 1 2019 RPM-GPG-KEY-redhat-release
-r--r--r--. 1 root root 1796 Apr 4 2019 TRANS.TBL
-r--r--r--. 1 root root 1566 Apr 4 2019 .treeinfo
Step 6: Copying the media.repo file
Copy the media.repo file from the root of the mounted directory to /etc/yum.repos.d/ and set the permissions to 644.
[user@lab-rhel8 ~]$ sudo cp /mnt/disc/media.repo /etc/yum.repos.d/rhel8dvd.repo
[user@lab-rhel8 ~]$ sudo chmod 644 /etc/yum.repos.d/rhel8dvd.repo
Step 7: Editing the rhel8dvd.repo
Edit the new repo file:
[user@lab-rhel8 ~]$ sudo vi /etc/yum.repos.d/rhel8dvd.repo
Copy the following into the file:
[InstallMedia-BaseOS]
name=Red Hat Enterprise Linux DVD BaseOS
mediaid=None
metadata_expire=-1
gpgcheck=1
cost=500
enabled=1
baseurl=file:///mnt/disc/BaseOS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[InstallMedia-AppStream]
name=Red Hat Enterprise Linux DVD AppStream
mediaid=None
metadata_expire=-1
gpgcheck=1
cost=500
enabled=1
baseurl=file:///mnt/disc/AppStream
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Disable the any repo files that is not in use. Look for the line enabled = 1
and make sure that all are set to enabled = 0
in the other repo files.
[user@lab-rhel8 ~]$ cd /etc/yum.repos.d/
[user@lab-rhel8 yum.repos.d]$ sudo vi redhat.repo
Step 8: Clear the yum cache
Clear the cache and check whether you can get the packages list from the DVD repo
[user@lab-rhel8 ~]$ sudo yum clean all
[user@lab-rhel8 ~]$ sudo yum repolist enabled
Updating Subscription Management repositories.
repo id repo name
InstallMedia-BaseOS Red Hat Enterprise Linux 8.7.0 BaseOS
InstallMedia-AppStream Red Hat Enterprise Linux 8.7.0 AppStream
Now, you can install any packages with yum install <packagename>
or update installed packages with yum update
.
Disabling the Local Repo and Unmounting the DVD
This step is to be done before unmounting the DVD. To disable the local repo, simply delete the local repo file.
[user@lab-rhel8 ~]$ cd /etc/yum.repos.d
[user@lab-rhel8 yum.repos.d]$ sudo rm rhel8dvd.repo
Unmount the DVD Drive from the mountpoint
[user@lab-rhel8 yum.repos.d]$ sudo umount /mnt/disc
Links
- Official RHEL Download Website
- Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7 - Red Hat Customer Portal
realmd/sssd | Joining a Domain with RHEL and logging in with AD account
Install the necessary packages and join a domain
SSSD = Authentication service from a remote source such as AD
realmd = Active Directory service
Install the packages
yum install sssd realmd oddjob oddjob-mkhomedir adcli samba-common samba-common-tools krb5-workstation openldap-clients python3-policycoreutils
Check if can discover the domain
realm discover homelab.local
Join Domain
# realm join --user=[domain user account] [domain name]
realm join --user=aki.adm homelab.local
Check if it is inside a domain after joining
realm list
Further configuration
So now that the Linux server is part of the AD domain, domain users can access the server with their usual credentials. We are done, right? Wrong. "What's the problem?" I hear you say. HAHAHHAH
Configure SSSD
Its main configuration file is located at /etc/sssd/sssd.conf. As a matter of fact, this is the main configuration file we will modify.
Configure the SSSD conf to look like this. From line 17!
[sssd]
domains = homelab.local
config_file_version = 2
services = nss, pam
[domain/homelab.local]
ad_domain = homelab.local
krb5_realm = HOMELAB.LOCAL
realmd_tags = manages-system joined-with-adcli
cache_credentials = True
id_provider = ad
krb5_store_password_if_offline = True
default_shell = /bin/bash
ldap_id_mapping = True
use_fully_qualified_names = True
fallback_homedir = /home/%u@%d
access_provider = simple
ad_hostname = lab-dc1.homelab.local
dyndns_update = true
dyndns_refresh_interval = 43200
dyndns_update_ptr = true
dyndns_ttl = 3600
dyndns_auth = GSS-TSIG
Once the configuration is complete, restart sssd to apply settings immediately.
systemctl restart sssd
Managing Login Permissions for Domain Users
Shows the permitted or denied login
By default, this is the output without configurations
[root@lab-rhel8 ~]# realm list
homelab.local
type: kerberos
realm-name: HOMELAB.LOCAL
domain-name: homelab.local
configured: kerberos-member
server-software: active-directory
client-software: sssd
required-package: oddjob
required-package: oddjob-mkhomedir
required-package: sssd
required-package: adcli
required-package: samba-common-tools
login-formats: %U@homelab.local
login-policy: allow-permitted-logins
permitted-logins:
permitted-groups:
Deny all
Deny local login by realm accounts.
This command prevents realm accounts from logging into the local machine. Use realm permit to restrict logins to specific accounts.
realm deny --all
The following options can be used:
--all, -a
This option should be specified
--realm, -R
Specify the name of the realm to deny users login to.
Permit All (Default)
Permit logins using realm accounts on the local machine according to the realm policy. This usually defaults to allowing any realm user to log in.
realm permit --all
realm permit -a
Permit User
realm permit user@example.com
realm permit DOMAIN\\User2
Permit Group
realm permit --groups "Domain Admin"
realm permit -g "Domain Admin"
Permit Realm (if joining more than one domain)
realm permit --realm
realm permit -R homelab.local
Remove Permit
realm permit --withdraw user@example.com
realm permit -x user@example.com
chrony | Set up NTP Server and Client
NTP Server
Step 1: Install Chrony NTP package
yum install chrony
Step 2: Enable Chrony to start after boot:
systemctl enable chronyd
Step 3: Set Chrony to act as an NTP server for a local network
To turn Chrony into an NTP server, add the following line to the main Chrony /etc/chrony.conf
configuration file. Change the address to your network address.
allow 10.1.1.0/24
Step 4: Restart Chrony NTP daemon to apply the changes
systemctl restart chronyd
Step 5: Open the firewall port to allow for incoming NTP requests
firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
NTP Client
Step 1: Install Chrony NTP package
yum install chrony
Step 2: Enable Chrony to start after boot:
systemctl enable chronyd
Step 3: Set Chrony to act as an NTP client
Add the following line in the Chrony /etc/chrony.conf
configuration file: Change the IP address to your NTP server.
Server 10.1.1.10
Step 4: Restart Chrony NTP daemon to apply the changes
systemctl restart chronyd
Step 5: Check for NTP server sources.
Your local NTP server should be listed:
chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? LAB-DC1.lab.local 4 6 1 2 +31us[ +31us] +/- 44ms
timedatectl | Change Date/Time in RHEL
Show Status
To display status
timedatectl
Disable/Enable NTP
Firstly, temporarily disable the NTP service, if active.
timedatectl set-ntp no
To enable.
timedatectl set-ntp yes
Change Time
We must adhere to the following syntax rule to change the current local time where HH is for hours, MM for minutes, and SS for seconds.
timedatectl set-time HH:MM:SS
timedatectl set-time 18:05:00
Change Date
To change the current date, adhere to the following command syntax where YYYY is for a year, MM for a month, and DD for a day.
timedatectl set-time YYYY-MM-DD
timedatectl set-time 2021-11-17
Change Timezone
List timezone
timedatectl list-timezones
To change/edit the Time Zone you are under, adhere to the following command syntax.
timedatectl set-timezone your_preferred_time_zone
timedatectl set-timezone Asia/Singapore
tar | File Archive Commands
TAR (No Compression)
Create TAR Archive
Create a TARarchive from a directory. "-cf" is to create and append. No compression.
tar -cf <filename> <dir>
Extract TAR Archive
Extract the TAR file to the current directory.
tar -xf <filename>
View TAR Archive
View the content of the TAR file.
tar -tf <filename>
TAR (With Compression)
Create a TAR file with compression
Create a TAR archive with compression. The order of the letter is important.
(gzip) $ tar -czf <filename> <dir>
(bzip2) $ tar -cjf <filename> <dir>
(xz) $ tar -cJf <filename> <dir>
Extract a compressed TAR file
Extract a compressed TAR file to the current directory.
(gzip) $ tar -xzf <filename>
(bzip2) $ tar -xjf <filename>
(xz) $ tar -xJf <filename>
Preserve Permission and Verbose
Create a compressed TAR file and preserve permissions.
(gzip) $ tar -cvpzf <filename> <dir>
(bzip2) $ tar -cvpzf <filename> <dir>
(xz) $ tar -cvpzf <filename> <dir>
permission gzip
scp | Push/Pull Files/Directory
To copy files/folders from one system to another system
scp <source> <dest>
Pull file.txt to home directory
scp username@host:/file.txt ~/
Push file.txt to other system home directory
scp ~/file.txt username@host:~/file.txt
rsync | Synchronise between systems
Sync
rsync command
rsync <source> <dest>
Local
Between the same system between directory
rsync -av /var/log /tmp
Remote
Between the local directory and the remote directory
rsync -av /tmp username@remote_host:/tmp
Compare
Compare the content of the source and remote directory
rsync -anv <source> <dest>
LVM | Create/Extend
Create LVM
Steps
In sequence,
- Prepare the physical storage
- Create the physical volume
- Create the volume group from the physical volume
- Create logical volume from the volume group
- Make an XFS File System from the logical volume
- Mount the XFS FS
Step 1: Prepare the physical storage
Create a partition if don’t want to use the whole volume
parted
udevadm settle
Step 2: Create the physical volume
Create a physical volume out of a partition or whole disk. In this example, there are two partitions vdb1 and vdb2.
# pvreate <device/partition>
pvcreate /dev/vdb1
pvcreate /dev/vdb2
Display the physical group
To display the volume group.
pvdisplay
or
# pvdisplay <device/partition>
pvdisplay /dev/vda1
Step 3: Create the volume group from the physical volume
Create the volume group with the physical device
# vgcreate <name> <member of physical volume>
vgcreate vg01 /dev/vdb1 /dev/vdb2
Display the volume group
To display the volume group.
vgdisplay
or
# vgdisplay <vgname>
vgdisplay vg01
Step 4: Create logical volume from the volume group
Create logical volume from a volume group
# lvcreate -n <name> -L <size> <source vg>
# 400M size
lvcreate -n lv01 -L 400M vg01
# 100% size
lvcreate -n lv01 -L +100%FREE vg01
Display the logical volume
Display the stats of logical volume
lvdisplay
Step 5: Make an XFS File System from the logical volume
Make an XFS file system
# mkfs.xfs <path to lv>
mkfs.xfs /dev/vg01/lv01
Step 6: Mount the XFS FS
mkdir /data
mount /dev/vg01/lv01 /data
Extend Logical Volume
Steps
In sequence,
- Extend the volume group
- Extend the logical volume
- Extend the File System
- Display the stats of logical volume
Step 1: Extend the volume group
Prepare the physical storage or partition it if required. In this example, vdb3 is used to be included inside existing volume group vg01..
parted /dev/vdb3
Extend with vgextend.
vgextend vg01 /dev/vdb3
Step 2: Extend the logical volume
Extend logical volume in a logical group
# lvextend
lvextend -l +100%FREE /dev/vg01/lv01
Step 3: Extend the File System
XFS
# xfs_growfs <path to lv>
xfs_growfs /dev/vg01/lv01
Other FS
# resize2fs <path to lv>
resize2fs /dev/vg01/lv01
Step 4: Display the stats of logical volume
lvdisplay
RHEL | Mounting ISO and Setting as Local Repo
This document provides a guide on mounting the RHEL ISO and setting it up as a local repo. This will enable RedHat Linux to install and update RPM packages.
This guide may work on another type of Linux as it is based on editing the repo file and mounting ISO media.
Prerequisite
- A Free RedHat Account
- Official Redhat Linux ISO
No Redhat license is required.
Step 1: Identify the Red Hat OS version
Run the following:
cat /etc/os-release
Look for the line VERSION="8.7 (Ootpa)"
in the output. This will shows the version number.
[user@demo ~]$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.7 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.7 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
Step 2: Download the RHEL ISO of the correct version
If you do not have an account, you must register a free account before downloading. Download the RHEL ISO of your version from the official RHEL download website.
Step 3: Mount the ISO from your Hypervisor
From your Hyper-V manager, add the ISO to the DVD drive device of the Virtual Machine.
Step 4: Identify the DVD Drive inside Red Hat Linux
Run the following to identify the correct device name of the DVD drive: lsblk
Look for the label rom
in the TYPE
column. For below example, it is sr0
. This means that the DVD drive is located at /dev/sr0
. Take note of this device.
[user@demo ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 2G 0 part /boot
└─sda2 8:2 0 97G 0 part
├─rhel-tmp 253:0 0 5G 0 lvm /tmp
├─rhel-var_log 253:1 0 20G 0 lvm /var/log
├─rhel-var 253:2 0 10G 0 lvm /var
├─rhel-swap 253:3 0 12G 0 lvm [SWAP]
├─rhel-home 253:4 0 10G 0 lvm /home
├─rhel-root 253:5 0 30G 0 lvm /
├─rhel-var_log_audit 253:6 0 5G 0 lvm /var/log/audit
└─rhel-var_tmp 253:7 0 5G 0 lvm /var/tmp
sdb 8:16 0 300G 0 disk
└─sdb1 8:17 0 300G 0 part /data
sr0 11:0 1 6.6G 0 rom
Step 5: Create a mountpoint and mount the DVD Drive locally
For this guide, the mountpoint used will be in /mnt/disc
.
Run the following command. file /mnt/disc
to create a mount point if it does not exist yet.
Output will show No such file or directory
if it does not exist.
[user@demo ~]$ file /mnt/disc
/mnt/disc: cannot open `/mnt/disc' (No such file or directory)
Create the mountpoint /mnt/disc
directory with sudo mkdir /mnt/disc
.
[user@demo ~]$ sudo mkdir /mnt/disc
[user@demo ~]$ file /mnt/disc
/mnt/disc: directory
Next, mount the DVD drive (/dev/sr0
) to the mountpoint (/mnt/disc
) with the command mount -o loop RHEL7.9.iso /mnt/disc
.
[user@demo ~]$ sudo mount -o loop /dev/sr0 /mnt/disc
With the DVD drive mounted, you can now list the content inside the disc with ls -al /mnt/disc
.
[user@demo ~]$ ls -al /mnt/disc
total 53
dr-xr-xr-x. 7 root root 2048 Apr 4 2019 .
drwxr-xr-x. 3 root root 18 May 12 14:51 ..
dr-xr-xr-x. 4 root root 2048 Apr 4 2019 AppStream
dr-xr-xr-x. 4 root root 2048 Apr 4 2019 BaseOS
-r--r--r--. 1 root root 60 Apr 4 2019 .discinfo
dr-xr-xr-x. 3 root root 2048 Apr 4 2019 EFI
-r--r--r--. 1 root root 8266 Mar 1 2019 EULA
-r--r--r--. 1 root root 1455 Apr 4 2019 extra_files.json
-r--r--r--. 1 root root 18092 Mar 1 2019 GPL
dr-xr-xr-x. 3 root root 2048 Apr 4 2019 images
dr-xr-xr-x. 2 root root 2048 Apr 4 2019 isolinux
-r--r--r--. 1 root root 103 Apr 4 2019 media.repo
-r--r--r--. 1 root root 1669 Mar 1 2019 RPM-GPG-KEY-redhat-beta
-r--r--r--. 1 root root 5134 Mar 1 2019 RPM-GPG-KEY-redhat-release
-r--r--r--. 1 root root 1796 Apr 4 2019 TRANS.TBL
-r--r--r--. 1 root root 1566 Apr 4 2019 .treeinfo
Step 6: Copying the media.repo file
Copy the media.repo file from the root of the mounted directory to /etc/yum.repos.d/ and set the permissions to 644.
[user@demo ~]$ sudo cp /mnt/disc/media.repo /etc/yum.repos.d/rhel8dvd.repo
[user@demo ~]$ sudo chmod 644 /etc/yum.repos.d/rhel8dvd.repo
Step 7: Editing the rhel8dvd.repo
Edit the new repo file:
[user@demo ~]$ sudo vi /etc/yum.repos.d/rhel8dvd.repo
Copy the following into the file:
[InstallMedia-BaseOS]
name=Red Hat Enterprise Linux DVD BaseOS
mediaid=None
metadata_expire=-1
gpgcheck=1
cost=500
enabled=1
baseurl=file:///mnt/disc/BaseOS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[InstallMedia-AppStream]
name=Red Hat Enterprise Linux DVD AppStream
mediaid=None
metadata_expire=-1
gpgcheck=1
cost=500
enabled=1
baseurl=file:///mnt/disc/AppStream
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Disable any repo files that are not in use. Look for the line enabled = 1
and make sure that all are set to enabled = 0
in the other repo files.
[user@demo ~]$ cd /etc/yum.repos.d/
[user@demo yum.repos.d]$ sudo vi redhat.repo
Step 8: Clear the yum cache
Clear the cache and check whether you can get the packages list from the DVD repo
[user@demo ~]$ sudo yum clean all
[user@demo ~]$ sudo yum repolist enabled
Updating Subscription Management repositories.
repo id repo name
InstallMedia-BaseOS Red Hat Enterprise Linux 8.7.0 BaseOS
InstallMedia-AppStream Red Hat Enterprise Linux 8.7.0 AppStream
Now, you can install any package with yum install <packagename>
or update installed packages with yum update
.
Disabling the Local Repo and Unmounting the DVD
This step should be completed before unmounting the DVD. To disable the local repo, delete the local repo file.
[user@demo ~]$ sudo rm rhel8dvd.repo
Unmount the DVD Drive from the mountpoint
[user@demo ~]$ sudo umount /mnt/disc