Skip to content

RHCSA Course Notes

Networking.

  • Modifying Network interfaces under NetworkManager with Nmcli
    ip -brief address
    lo               UNKNOWN        127.0.0.1/8 ::1/128
    eth0             UP             10.2.32.60/19
    
  • Show nmcli connections
    root@10-2-32-60 ~$ nmcli conn show
    NAME         UUID                                  TYPE      DEVICE
    System eth0  5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  ethernet  eth0
    lo           544077e6-9932-4533-a192-11b93d276803  loopback  lo
    
  • Modify
    nmcli conn modify eth0 ipv4.addresses 10.2.32.66/19
    
  • Assign gateway

    nmcli conn modify eth0 ipv4.gateway 10.2.32.1
    
  • Change Configuration method to manual

    nmcli connection modify eth0 ipv4.method manual
    
  • Modify DNS

    nmcli connection modify eth0 ipv4.dns 8.8.8.8
    
  • Reset the connection

    nmcli connection down eth0 && nmcli connection up eth0
    
  • Assign Secondary IP with nmcli

    nmcli connection modify eth0 +ipv4.addresses 10.2.32.56/16
    
  • Reload the connection

    nmcli conn reload
    
  • Nmtui creating interfaces options

    1. Ethernet – Wired network connection (LAN).

    2. Wi-Fi – Wireless network connection (WLAN).

    3. Bridge – Joins multiple interfaces into one, often used for VMs or containers.

    4. Bond – Combines multiple interfaces for redundancy or speed (link aggregation).

    5. VLAN – Creates a virtual LAN tag over a physical interface.

    6. VPN – Secure remote access via virtual private network.

    7. DSL – Used for Digital Subscriber Line internet (older broadband tech).

    8. Mobile Broadband – Connects via cellular network (3G/4G/5G).

    9. Team – Similar to bond, but more flexible; used for NIC teaming.

  • Network files

  • /etc/sysconfig/network-scripts
  • /etc/hosts/
  • /etc/resolve.conf
  • /etc/nsswitch.conf
    • Commands
    • ping
    • ifconfig or ip
    • netstat
    • traceroute
    • tcpdump
    • nslookup or dig
    • ethtool
  • Print date with python
    python3 -c 'from datetime import datetime;now = datetime.now();print(now.strftime("%Y:%m:%d"))'
    

RedHat Linux Repository setup. Subscription manager

  • Checking list of repos with subscription-manager
    subscription-manager repos --list
    
  • Select ones you need like baseos,appstream
    subscription-manager repos --list | grep -E -i 'appstream|baseos'
    
  • Enable the repos ( BaseOS and Appstream)
    subscription-manager repos --enable=rhel-10-for-x86_64-baseos-rpms
    

subscription-manager repos --enable=rhel-10-for-x86_64-appstream-rpms
- The baseos is needed if you want to use at command (Job spooling tools)
dnf install at -y
  • Enable crb ( Codeready Builder for rhel) repo
    subscription-manager repos --list | grep codeready
    Repo ID:   codeready-builder-for-rhel-10-x86_64-eus-rpms
    Repo URL:  https://cdn.redhat.com/content/eus/rhel10/$releasever/x86_64/codeready-builder/os
    Repo ID:   codeready-builder-for-rhel-10-x86_64-eus-source-rpms
    Repo URL:  https://cdn.redhat.com/content/eus/rhel10/$releasever/x86_64/codeready-builder/source/SRPMS
    Repo ID:   codeready-builder-for-rhel-10-x86_64-debug-rpms
    Repo URL:  https://cdn.redhat.com/content/dist/rhel10/$releasever/x86_64/codeready-builder/debug
    Repo ID:   codeready-builder-for-rhel-10-x86_64-rpms
    Repo URL:  https://cdn.redhat.com/content/dist/rhel10/$releasever/x86_64/codeready-builder/os
    Repo ID:   codeready-builder-for-rhel-10-x86_64-eus-debug-rpms
    Repo URL:  https://cdn.redhat.com/content/eus/rhel10/$releasever/x86_64/codeready-builder/debug
    Repo ID:   codeready-builder-for-rhel-10-x86_64-source-rpms
    Repo URL:  https://cdn.redhat.com/content/dist/rhel10/$releasever/x86_64/codeready-builder/source/SRPMS
    
subscription-manager repos --enable codeready-builder-for-rhel-10-x86_64-rpms

Install Epel Release on Rhel

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
- Setting up at job
echo "cat /etc/passwd > /var/log/passwd_output_at_test" | at now + 1 day
- Listing the job and removing it
atq
1       Tue Jul 29 14:31:00 2025 a root 
  • removing the job with at -c [jobNumber]

    at -c 1
    
  • Crontab and cronjob syntax. Check cronitor cli . at crontab.guru.

  • Examples At every minute past every hour on every day-of-month from 5 through 10 and on every day-of-week from Monday through Friday.”
    * */1 5-10 * 1-5
    
  • Cronitor also has a dashboard for managing cronjobs.
  • Run cronitor dash to configure credentials and then again to start the web UI.
    cronitor dash
    Dashboard credentials are not configured.
    Please set a username and password for dashboard access.
    These credentials will be saved to your configuration file and can be updated later from the Settings screen.
    
    Enter dashboard username: username
    Enter dashboard password: password
    
cronitor dash
Starting Cronitor dashboard on port 9000...
Opening browser to http://localhost:9000...
Dashboard running on http://localhost:9000 (Press Ctrl+C to stop)

System tuning tuned.service

  • List available profiles and current one
tuned-adm list | sed 's/\-//g'
tuned-adm active
Current active profile: virtual-guest

Documentation From RedHat

Process Priority alignment

  • Nice and Renice priority levels
  • Higher Priority from -20-19 to 0 from 0 to -> 18-20 Lowest Priority
  • Top[PR] Priority - > RT -99 to -3 -2 -1 0 from 0 to 20 - 38 , 39
  • Summary

    Nice value is user-space and priority PR is the processe's actual priority that is used by Linux kernel. In Linux system priorities are 0 to 139 in which 0 to 99 for real time and 100 139 for users

  • View linux priority through ps command

    ps axo pid,comm,nice,cls --sort=nice
    
  • Set process priority (nice value)

    nice -n $process_name
    
  • Renice running process from command line and top

    renice -n $process_ID
    

Open top press r and type the process ID, then hit Enter and enter the value from +19 to -20

Access control lists

I already have notes inhere -> https://docs.vladmin-dev.top/LinuxNotes/CompTIA/ACL/

Selinux

  • Disable SELINUX

    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
    
  • Main concepts

  • Labeling ( user )
  • Type enforcement (level)
  • List labels with -Z flag of ls
    ls -lZ /usr/sbin/crond
    -rwxr-xr-x. 1 root root system_u:object_r:crond_exec_t:s0 78312 Dec 11  2024 /usr/sbin/crond
    
  • list directory selinux type
    ls -dZ /usr/sbin/
    system_u:object_r:bin_t:s0 /usr/sbin/
    
root@redhat ~$ ls -dZ /var/mail/
system_u:object_r:mail_spool_t:s0 /var/mail/
root@redhat ~$ ls -dZ /var/
system_u:object_r:var_t:s0 /var/
  • system_u - > user
  • object_r -> role
  • var_t -> type
  • s0 -> Level

User home dir example

 useradd -m vladmin -s /usr/bin/bash -c 'test user for Selinux'

ls -dZ /home/vladmin/
unconfined_u:object_r:user_home_dir_t:s0 /home/vladmin/
- Check Process's selinux policy with ps command
ps axZ | grep httpd
system_u:system_r:httpd_t:s0      37571 ?        Ss     0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0      37572 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0      37573 ?        Sl     0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0      37574 ?        Sl     0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0      37575 ?        Sl     0:00 /usr/sbin/httpd -DFOREGROUND
netstat -tlpnZ | grep httpd
tcp6       0      0 :::80                   :::*                    LISTEN      37571/httpd          system_u:system_r:httpd_t:s0

Command to manage SELinux

  • semanage -> to label
    • login
    • user
    • port
    • interface
    • module
    • node
    • file context
    • boolean
    • permissive state
    • dontaudit What is Boolean?
  • It is an On/Off switch to allow and block access
  • getsebool -a or semanage boolean -l get all boolean rules
  • Enable or turn on a boolean
    setsebool -P boolean_name on
    
setsebool -P httpd_can_connect_ftp on
setsebool -P httpd_can_connect_ftp off
  • Change the type in label
    chcon -t httpd_sys_content_t FILENAME
    
semanage -t httpd_sys_content_t FILENAME
  • Error messages recorded in journalctl

Examples

  • List users
    semanage user --list
    
    Labeling   MLS/       MLS/
    SELinux User    Prefix     MCS Level  MCS Range                      SELinux Roles
    
    guest_u         user       s0         s0                             guest_r
    root            user       s0         s0-s0:c0.c1023                 system_r staff_r sysadm_r unconfined_r
    staff_u         user       s0         s0-s0:c0.c1023                 system_r staff_r sysadm_r unconfined_r
    sysadm_u        user       s0         s0-s0:c0.c1023                 sysadm_r
    system_u        user       s0         s0-s0:c0.c1023                 system_r unconfined_r
    unconfined_u    user       s0         s0-s0:c0.c1023                 system_r unconfined_r
    user_u          user       s0         s0                             user_r
    xguest_u        user       s0         s0                             xguest_r
    

Storage management

Logical Volume Management.

  • Adding a disk and creating LVM partition.
  • Use fdisk to create the partition
  • Then create physycal volume

    pvcreate /dev/vdb1
    
  • Create the Volume Group

    vgcreate test_vg /dev/vdb1
    
vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  rhel      1   2   0 wz--n- <29.00g     0
  test_vg   1   0   0 wz--n-  <5.00g <5.00g
  • Create the Logical Volume group
  • It might return error for insufficient space.
    lvcreate -n test_lv --size 5G test_vg
      Volume group "test_vg" has insufficient free space (1279 extents): 1280 required.
    
    Then we use M format to create it as follows.
lvcreate -n test_lv --size 5000M test_vg
  Logical volume "test_lv" created.
lvs
  LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root    rhel    -wi-ao---- <26.00g
  swap    rhel    -wi-ao----   3.00g
  test_lv test_vg -wi-a-----   4.88g
  • Make the filesystem

    mkfs.xfs /dev/test_vg/test_lv
    
  • Remove the created vg , pv and lv

  • Umount the disk - > umount /lvs_vol
  • delete the logical volume then the volume group and the physical volume
    lvremove /dev/test_vg/test_lv
    Do you really want to remove active logical volume test_vg/test_lv? [y/n]: y
      Logical volume "test_lv" successfully removed.
    
vgremove test_vg
  Volume group "test_vg" successfully removed
pvremove /dev/vdb1
  Labels on physical volume "/dev/vdb1" successfully wiped.

The partition is now ready for extending an existing lvm

Manage and Extend disks

Extending a LVM group with another disk

  1. create the main physical volume group with disk 1 -> pvcreate /dev/vdb1
  2. Create the Volume Group - > vgcreate attached_vg /dev/vdb1
  3. Create the LVM group and configure the size (5GB disks are used) -> lvcreate -n attach_lv --size 5000M attached_vg
  4. Create the FileSystem - > mkfs.xfs /dev/attached_vg/attach_lv
  5. Create phsycal volume 2 > pvcreate /dev/sda1
  6. Extend the Volumgroup -> vgextend attached_vg /dev/sda1
  7. Extend the logical volume group to the max capacity -> lvextend -l +100%FREE /dev/attached_vg/attach_lv
  8. Grow the file system to maximum 10GB - For ext4 use resize2fs and for xfs use xfs_growfs -> xfs_growfs /dev/attached_vg/attach_lv
  9. Then mount the volume group to a folder -> mount /dev/attached_vg/attach_lv /lvs_vol/

Advanced Storage Features

Official Documentation

Stratis utility. Using storage pools to manage disks. Using thin provisioning providing dynamic allocation and more efficiency

The devices /dev/vdb and /dev/sda have been used in an lvm group which had their udev tags and metadata still reflecting the lvm group so it returnes this error

stratis pool create stratis-pool1 /dev/sda
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: At least one of the devices specified was unsuitable for initialization: udev information indicates that device /dev/sda is a block device which appears to be owned.
We need to remove the data from the disks using wipefs command
wipefs -a /dev/sda
wipefs -a /dev/vdb

Then we can create the pool

stratis pool create stratis-pool1 /dev/sda
stratis pool list
Name                   Total / Used / Free    Properties                                   UUID   Alerts
stratis-pool1   5 GiB / 526 MiB / 4.49 GiB   ~Ca,~Cr, Op   98d0dfd7-2a72-4f99-98e3-34078655eff7   WS001
stratis pool add-data stratis-pool1 /dev/vdb
stratis pool list
Name                    Total / Used / Free    Properties                                   UUID   Alerts
stratis-pool1   10 GiB / 532 MiB / 9.48 GiB   ~Ca,~Cr, Op   98d0dfd7-2a72-4f99-98e3-34078655eff7

Once this is done we need to create the stratis pool's filesystem

stratis filesystem create stratis-pool1 filesystem-1
stratis filesystem list
Pool            Filesystem     Total / Used / Free / Limit            Device                                    UUID
stratis-pool1   filesystem-1   1 TiB / 546 MiB / 1023.47 GiB / None   /dev/stratis/stratis-pool1/filesystem-1   8ea3a262-565a-40c6-80a2-5d065f18548f

Now we can mount it to a folder. We are going to use the device path /dev/stratis/stratis-pool1/filesystem-1

mount /dev/stratis/stratis-pool1/filesystem-1 /stratis-fs/

The lsblk command output will look like this

lsblk
NAME                                                                                        MAJ:MIN RM  SIZE RO TYPE    MOUNTPOINTS
sda                                                                                           8:0    0    5G  0 disk
└─stratis-1-private-98d0dfd72a724f9998e334078655eff7-physical-originsub                     253:2    0   10G  0 stratis
  ├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thinmeta                        253:3    0    6M  0 stratis
  │ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool                      253:6    0  9.5G  0 stratis
  │   └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7    0    1T  0 stratis /stratis-fs
  ├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thindata                        253:4    0  9.5G  0 stratis
  │ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool                      253:6    0  9.5G  0 stratis
  │   └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7    0    1T  0 stratis /stratis-fs
  └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-mdv                             253:5    0  512M  0 stratis
vda                                                                                         252:0    0   30G  0 disk
├─vda1                                                                                      252:1    0    1M  0 part
├─vda2                                                                                      252:2    0    1G  0 part    /boot
└─vda3                                                                                      252:3    0   29G  0 part
  ├─rhel-root                                                                               253:0    0   26G  0 lvm     /
  └─rhel-swap                                                                               253:1    0    3G  0 lvm     [SWAP]
vdb                                                                                         252:16   0    5G  0 disk
└─stratis-1-private-98d0dfd72a724f9998e334078655eff7-physical-originsub                     253:2    0   10G  0 stratis
  ├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thinmeta                        253:3    0    6M  0 stratis
  │ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool                      253:6    0  9.5G  0 stratis
  │   └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7    0    1T  0 stratis /stratis-fs
  ├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thindata                        253:4    0  9.5G  0 stratis
  │ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool                      253:6    0  9.5G  0 stratis
  │   └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7    0    1T  0 stratis /stratis-fs
  └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-mdv                             253:5    0  512M  0 stratis

It will always show as 1TB . To check the actual size we need to use stratis filesystem list

stratis filesystem list

We can create snapshots of the filesystem

stratis filesystem snapshot stratis-pool1 filesystem-1 fs-snap

Mounting the device to fstab

We have to use the UUID method. We can get the UUID from the filesystem list. To mount it we need extra flags for the stratisd Keep in mind that single quotes are not needed in fstab

UUID=8ea3a262-565a-40c6-80a2-5d065f18548f /stratis-fs xfs defaults,x-systemd.requires=stratisd.service 0 0
Reload the daemon due to the below hint
mount -a
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
Then test the mount

Deleting the stratis fs Unmount the folder

umount /stratis-fs
Destroy the filesystem for the pool
stratis filesystem destroy stratis-pool1 filesystem-1

Stop the pool temporarily

stratis pool stop --name stratis-pool1
To destroy the pool it must be started
stratis pool destroy stratis-pool1

NFS Config PDF

Samba Config filesystem