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.




