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/mnt
drive (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.repo
file ā” 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 crontab
andman -s 5 crontab
, also, see the cheatsheet at/etc/crontab
file.Add
0 */2 * * mon-fri user1 backup.sh
to/etc/crontab
file ā” runbackup.sh
shell script asuser1
every 2nd hour at minute 0, every day-of-week.crontab -e
ā” open current user’scrontab
file (no need to specify user for the cron job, file will be saved as/var/spool/cron/user1
).Create
/etc/crond.d/verify-backup
file ā”cron
will read and run the jobs as specified in the file.# Run verify-backup.sh script everyday, twice a day. 0 */12 * * * user1 verify-backup.sh
Add
user2
to/etc/cron.deny
file ā” to blockcrontab
access foruser2
.Schedule a one time task using
at
:at now + 5 hours
ā” startat
prompt, 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 theat
prompt.
atq
ā” lists the user’s pending job.at -c 4
ā”cat
job4
to standard output.atrm 4
ā” removes job4
from the queue.cat /var/log/cron
ā” verify the log file forcron
andat
.Add
7 5 remove_obsolete_pkgs dnf autoremove
to/etc/anacrontab
file ā” once a week, rundnf autoremove
, delaying 5 mins to begin.anacron
ā” manually run all jobs scheduled in/etc/anacrontab
.Each entry in
/etc/anacrontab
generates a file in/var/spool/anacron
with 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
ā” startsfirewalld
service.systemctl --user start mycustom.service
ā” startsmycustom.service
unit file, stored at~/.config/systemd/user/
, as current user.systemctl restart firewalld
ā” restartsfirewalld
service.systemctl stop firewalld
ā” stopsfirewalld
service.systemctl enable firewalld
ā” enablefirewalld
service to start at system boot.systemctl disable firewalld
ā” disablefirewalld
service, it won’t start at system boot.systemctl status firewalld
ā” checkfirewalld
service status.systemctl show firewalld
ā” showfirewalld
unit details.systemctl is-enabled firewalld
ā” check iffirewalld
service is enabled.systemctl daemon-reload
ā” reload the systemd manager configuration.systemctl mask firewalld
ā” prohibitfirewalld
from 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.target
as 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.service
if 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
chronyd
to a different server:chronyc sources
ā” checks current time sourceschronyd
is accessing.- On
/etc/chrony.conf
, comment all entries beggining withpool
orserver
. - 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.config
to learn the directives allowed.) systemctl restart chronyd
ā” apply changes.chronyc sources
ā” checks current time sourceschronyd
is 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/mnt
drive./dev/sr0 /mnt iso9660 ro 0 0
ā” on/etc/fstab/
, mounts the iso image at system startup.create
/etc/yum.repos.d/local.repo
file ā” to install a local repository.[BaseOS] name=BaseOS baseurl=file:///mnt/BaseOS gpgcheck=0
Check
man -s 5 yum.conf
for directives and options for a.repo
file, andcat /etc/dnf/dnf.conf
to 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 andgrep
the 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 whetherzsh
package 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 repositoriesdnf
is aware of (enabled or disabled).dnf search tmux
ā” search in packages containing the worftmux
in it’si name or metadadata.dnf config-manager --disable BaseOS
ā” disableBaseOS
repository.dnf config-manager --enable BaseOS
ā” enableBaseOS
repository.dnf install tmux -y
ā” installtmux
package, 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/group
file.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
ā” updatepostgresql
module.dnf module install --profile postgresql:10
ā” install the module’s stream 10.dnf module install --profile perl:5.26/minimal
ā” install the module withminimal
profile 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 thequiet
argument from theDEFAULT
boot entry.grubby --args=quiet --update-kernel=DEFAULT
ā” add thequiet
argument to theDEFAULT
boot 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.