This is part of the independent and unofficial RHCSA Exam Study Guide series providing free π€ resources to prepare for the exam.
This post covers the objectives under the section:
βDEPLOY, CONFIGURE, AND MAINTAIN SYSTEMSβ
It contains two main parts:
- Resources: with links to learn and practice for each objective.
- Cheatsheet: containing some examples of commands and actions performed in each objective (when applied).
π Resources:
SCHEDULE TASKS USING AT AND CRON
π RHCSA v8 Practice Session: Schedule tasks using at and cron β Part 1
π RHCSA v8 Practice Session: Schedule tasks using at and cron β Part 2
π 24.3. Scheduling a Job to Run at a Specific Time Using at
π 24.2. Scheduling a Recurring Asynchronous Job Using Anacron
π How to allow only specific non-root user(s) to use crontab
π CentOS / RHEL : anacron basics (What is anacron and how to configure it)
π Cron Vs Anacron: How to Schedule Jobs Using Anacron on Linux
START AND STOP SERVICES AND CONFIGURE SERVICES TO START AUTOMATICALLY AT BOOT
CONFIGURE SYSTEMS TO BOOT INTO A SPECIFIC TARGET AUTOMATICALLY
π RHCSA v8 Practice Session: Configure systems to boot into a specific target automatically
π Boot systems into different targets manually β RHCSA Objective Preparation
CONFIGURE TIME SERVICE CLIENTS
π RHCSA v8 Practice Session: Configure time service clients
π How to Set Time, Timezone and Synchronize System Clock Using timedatectl Command
INSTALL AND UPDATE SOFTWARE PACKAGES FROM RED HAT NETWORK, A REMOTE REPOSITORY, OR FROM THE LOCAL FILE SYSTEM
Attention: Before starting, it is recommended to set up a local repository using the Red Hat Enterprise Linux 8 installation ISO file:
Add the RHEL 8 iso file as an image to Virtual Box (similar process to the virtualization tool of your choice):
Mount locally a repository from the ISO image:
mount -o ro /dev/sr0 /mntβ‘ mount iso image to/mntdrive (find the device name if not/dev/sr0)./dev/sr0 /mnt iso9660 ro 0 0β‘ on/etc/fstab/, mounts the iso image at system startup.create
/etc/yum.repos.d/local.repofile β‘ to install a local repository.[BaseOS] name=BaseOS baseurl=file:///mnt/BaseOS gpgcheck=0 enabled=1 [AppStream] name=AppStream baseurl=file:///mnt/AppStream gpgcheck=0 enabled=1
Done!
π RHCSA v8 Practice Session: Install and update software packages β Part 1
π RHCSA v8 Practice Session: Install and update software packages β Part 2
π 25 Useful DNF Command Examples For Package Management In Linux
π Create an FTP-based YUM/DNF repository on Red Hat Enterprise Linux 8 (Follow along until the end of βStep 5: Test and verify your local repositoryβ. In the RHCSA exam, you may be required to set up a local repository from the Red Hat Enterprise Linux (RHEL) installation ISO file.)
π How to query files, packages, and repositories in Linux
π RPM command examples to query, install, remove and upgrade packages
π How to query packages information with the rpm package manager
WORK WITH PACKAGE MODULE STREAMS
π RHCSA v8 Practice Session: Work with package module streams
π Chapter 11. Managing versions of application stream content
π Introduction to Application Streams in Red Hat Enterprise Linux
MODIFY THE SYSTEM BOOTLOADER
π Understanding the Linux Boot Process - CompTIA Linux+, LPIC-1
π An introduction to the Linux boot and startup processes
π What is UEFI
π RHCSA v8 Practice Session: Modify the system bootloader
π An introduction to GRUB2 configuration for your Linux machine
π Chapter 26. Working with GRUB 2 (see until the end of item β26.5. Customizing the GRUB 2 Configuration Fileβ)
π How to update GRUB2 using grub2-editenv and grubby in RHEL 8 Linux
π Cheatsheet:
SCHEDULE TASKS USING AT AND CRON
See examples and references at
man crontabandman -s 5 crontab, also, see the cheatsheet at/etc/crontabfile.Add
0 */2 * * mon-fri user1 backup.shto/etc/crontabfile β‘ runbackup.shshell script asuser1every 2nd hour at minute 0, every day-of-week.crontab -eβ‘ open current userβscrontabfile (no need to specify user for the cron job, file will be saved as/var/spool/cron/user1).Create
/etc/crond.d/verify-backupfile β‘cronwill read and run the jobs as specified in the file.# Run verify-backup.sh script everyday, twice a day. 0 */12 * * * user1 verify-backup.shAdd
user2to/etc/cron.denyfile β‘ to blockcrontabaccess foruser2.Schedule a one time task using
at:at now + 5 hoursβ‘ startatprompt, deliberating the time to run.- Type
echo "task completed by at >> /tmp/at-test.txt"β‘ to define a test task. - Press
CTRL+dβ‘ to exit theatprompt.
atqβ‘ lists the userβs pending job.at -c 4β‘catjob4to standard output.atrm 4β‘ removes job4from the queue.cat /var/log/cronβ‘ verify the log file forcronandat.Add
7 5 remove_obsolete_pkgs dnf autoremoveto/etc/anacrontabfile β‘ once a week, rundnf autoremove, delaying 5 mins to begin.anacronβ‘ manually run all jobs scheduled in/etc/anacrontab.Each entry in
/etc/anacrontabgenerates a file in/var/spool/anacronwith itβs execution date.journalctl -g anacronβ‘ check logs for the wordanacron.
START AND STOP SERVICES AND CONFIGURE SERVICES TO START AUTOMATICALLY AT BOOT
systemctlβ‘ shows loaded units.systemctl list-unit-filesβ‘ lists unit files.systemctl list-unitsβ‘ lists active units.systemctl --failedβ‘ list all units that failed to start last system boot.systemctl start firewalldβ‘ startsfirewalldservice.systemctl --user start mycustom.serviceβ‘ startsmycustom.serviceunit file, stored at~/.config/systemd/user/, as current user.systemctl restart firewalldβ‘ restartsfirewalldservice.systemctl stop firewalldβ‘ stopsfirewalldservice.systemctl enable firewalldβ‘ enablefirewalldservice to start at system boot.systemctl disable firewalldβ‘ disablefirewalldservice, it wonβt start at system boot.systemctl status firewalldβ‘ checkfirewalldservice status.systemctl show firewalldβ‘ showfirewalldunit details.systemctl is-enabled firewalldβ‘ check iffirewalldservice is enabled.systemctl daemon-reloadβ‘ reload the systemd manager configuration.systemctl mask firewalldβ‘ prohibitfirewalldfrom being enabled or disabled.
CONFIGURE SYSTEMS TO BOOT INTO A SPECIFIC TARGET AUTOMATICALLY
systemctl get-defaultβ‘ displays the current default target.systemctl isolate multi-user.targetβ‘ switch tomulti-user.target.systemctl set-default multi-userβ‘ setmulti-user.targetas default.systemctl -t target --allβ‘ lists all units of typetarget.systemctl rebootβ‘ reboot the system.
CONFIGURE TIME SERVICE CLIENTS
date,timedatectlβ‘ check current system date and time.timedatectl set-ntp falseβ‘ disable networking time sync, also disableschronyd.serviceif enabled.timedatectl set-time "2021-07-08 04:30:00β‘ change date and time.date --set 04:00β‘ change time.tzselectβ‘ starts the helper to set timezone.systemctl status chronydβ‘ (requireschrony) check if Chrony is active, it is the preferred implementation of the Network Time Protocol.Bind
chronydto a different server:chronyc sourcesβ‘ checks current time sourceschronydis accessing.- On
/etc/chrony.conf, comment all entries beggining withpoolorserver. - Add a new line in the end:
server 127.127.1.0 - Add a new line in the end:
server 127.127.1.4 iburst prefer(Checkman chrony.configto learn the directives allowed.) systemctl restart chronydβ‘ apply changes.chronyc sourcesβ‘ checks current time sourceschronydis accessing.
INSTALL AND UPDATE SOFTWARE PACKAGES FROM RED HAT NETWORK, A REMOTE REPOSITORY, OR FROM THE LOCAL FILE SYSTEM
To add a repository from an iso image:
mount -o ro /dev/sr0 /mntβ‘ mount iso image to/mntdrive./dev/sr0 /mnt iso9660 ro 0 0β‘ on/etc/fstab/, mounts the iso image at system startup.create
/etc/yum.repos.d/local.repofile β‘ to install a local repository.[BaseOS] name=BaseOS baseurl=file:///mnt/BaseOS gpgcheck=0
Check
man -s 5 yum.conffor directives and options for a.repofile, andcat /etc/dnf/dnf.confto see an example of the syntax.
Using rpm
rpm -i ./zsh-5.5.1-6.el8_1.2.x86_64.rpmβ‘ install package file from current dir.rpm -i --reinstall -vh /zsh-5.5.1-6.el8_1.2.x86_64.rpmβ‘ reinstall package from file (verbose mode, show progress printing a hash bar).rpm -qi zshβ‘ show package info (from installed package).rpm -qa | grep zshβ‘ query all packages andgrepthe wordzsh.rpm -qip ./zsh-5.1.1-6.el8_1.2.x86_64.rpmβ‘ show package file info (from the repository).rpm -K ./zsh-5.5.1-6.el8_1.2.x86_64.rpm --nosignatureβ‘ validate integrity (completeness and error-free state) and authententicity for the given package file.rpm -V zshβ‘ check installed package file attributes compared to the package file present on the repository (permission mode, size, owner, group, etcβ¦), if no output, integrity of attributes are OK.rpm -q zshβ‘ check whetherzshpackage is installed.rpm -qf /etc/hostsβ‘ search what package provides the file/etc/hosts(similar todnf provides /etc/hosts).rpm -qc zshβ‘ list all configuration files forzsh.
Using dnf/yum
dnf repolistβ‘ show installed repositories.dnf repolist --allβ‘ show all repositoriesdnfis aware of (enabled or disabled).dnf search tmuxβ‘ search in packages containing the worftmuxin itβsi name or metadadata.dnf config-manager --disable BaseOSβ‘ disableBaseOSrepository.dnf config-manager --enable BaseOSβ‘ enableBaseOSrepository.dnf install tmux -yβ‘ installtmuxpackage, assuming yes for all questions.dnf list --installedβ‘ show installed packages.dnf repoquery --repo "AppStream",dnf repository-packages BaseOS listβ‘ list all the packages available for a specific repository.dnf provides /etc/groupβ‘ show which package contains the/etc/groupfile.tail /var/log/dnf.logβ‘ see recent interactions.dnf repoquery --deplist policycoreutilsβ‘ list dependencies for the given package.dnf group list --installedβ‘ list only installed package groups.dnf group install "Security Tools"β‘ install package group.
WORK WITH PACKAGE MODULE STREAMS
dnf module list --installedβ‘ list only installed modules.dnf module list perl*β‘ list all the streams for all modules with name starting asperl.dnf module list --enabled*β‘ list all enabled module streams.dnf module enable postgresql:9.6β‘ enable module on the specified stream.dnf module update postgresql -yβ‘ updatepostgresqlmodule.dnf module install --profile postgresql:10β‘ install the moduleβs stream 10.dnf module install --profile perl:5.26/minimalβ‘ install the module withminimalprofile for the stream5.26.dnf module remove --profile postgresql:10β‘ uninstall the moduleβs stream10.dnf module info --profile postgresqlβ‘ list all profiles available for the module.dnf module info --profile postgresql:10β‘ show details for the specific module stream.dnf module reset postgrelsqlβ‘ reset module.
MODIFY THE SYSTEM BOOTLOADER
grubby --default-kernelβ‘ display the path of the default kernel.grubby --default-indexβ‘ display the index number of the default kernel.grubby --set-default /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64β‘ set specified kernel to default.sudo grubby --set-default-index=1β‘ set specified kernel to default, by using itβs index number.grubby --info=ALLβ‘ display information of all boot entries.grubby --info /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64β‘ display information of the specified kernel entry.grubby --remove-args=quiet --update-kernel=DEFAULTβ‘ remove thequietargument from theDEFAULTboot entry.grubby --args=quiet --update-kernel=DEFAULTβ‘ add thequietargument to theDEFAULTboot entry./etc/default/grubβ‘ edit this file to change grub params.grub2-mkconfig -o /boot/grub2/grub.cfg,grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfgβ‘ make the config file to apply changes.
Next:
(RHCSA) Manage Basic Networking
β¦or back to Red Hat Certified System Administrator (RHCSA) Exam Study Guide
Useful links & references:
Enable Sysadmin (a blog from Red Hat)
Footnotes:
- Follow me on Twitter to get more posts like this and other quick tips in your feed.
- If you have any doubts or tips about this article, Iβd appreciate knowing and discussing it via email.
- Do you have any other Linux tips? Would you like to publish that in this blog? Please send an email to all drops.
- As English is not my native language, I apologize for the errors. Corrections are welcome.
- Contact: contact [@] alldrops [.] info.




