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:
“OPERATE RUNNING 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:
BOOT, REBOOT, AND SHUT DOWN A SYSTEM NORMALLY
š RHCSA v8 Practice Session: Boot, reboot, and shut down a system normally
š Chapter 16. Shutting down, suspending, and hibernating the system
š How Boot, Reboot, and Shut Down the System Normally on CentOS 7 / RHEL 7
BOOT SYSTEMS INTO DIFFERENT TARGETS MANUALLY
INTERRUPT THE BOOT PROCESS IN ORDER TO GAIN ACCESS TO A SYSTEM
IDENTIFY CPU/MEMORY INTENSIVE PROCESSES AND KILL PROCESSES
š RHCSA v8 Practice Session: Identify CPU/memory intensive processes and kill processes
š How To Use ps, kill, and nice to Manage Processes in Linux
š Linux Command Basics: 7 commands for process management
ADJUST PROCESS SCHEDULING
MANAGE TUNING PROFILES
š 2. Getting started with Tuned (skip items: 2.4, 2.8 and 2.9)
LOCATE AND INTERPRET SYSTEM LOG FILES AND JOURNALS
š RHCSA v8 Practice Session: Locate and interpret system log files and journals
š Beginners Guide to CentOS/RHEL logging (systemd-journald and rsyslog) architecture)
š Overview of Syslog Priorities, rsyslog rules, log rotation and basic troubleshooting using syslog
š How to use journalctl to view log messages in journal for system troubleshooting
PRESERVE SYSTEM JOURNALS
START, STOP, AND CHECK THE STATUS OF NETWORK SERVICES
š RHCSA RHEL 8 - Start, stop, and check the status of network services
š Chapter 14. Managing system services with systemctl (skip items 14.2. and 14.5)
SECURELY TRANSFER FILES BETWEEN SYSTEMS
š RHCSA v8 Practice Session: Securely transfer files between systems
š How to securely copy files between Linux hosts using SCP and SFTP
š Cheatsheet:
BOOT, REBOOT, AND SHUT DOWN A SYSTEM NORMALLY
systemctl reboot
ā” shut down and reboot the system.systemctl halt
ā” shut down and halt the system (stops CPU but keeps it powered).systemctl poweroff
ā” shut down and poweroff the system (stops CPU and turns off the power).
BOOT SYSTEMS INTO DIFFERENT TARGETS MANUALLY
systemctl get-default
ā” get the default boot target.systemctl set-default multi-user
ā” set the default boot target.systemctl --type target --all
ā” list all target units (loaded or not).Interrupt boot process to temporarily boot from another target (i.e.:
multi.user.target
), without changing the default target:- append
systemd.unit=multi-user.target
ā” to the end of the boot cmd, when editing the grub menu entry, and start it with Ctrl+x.
- append
INTERRUPT THE BOOT PROCESS IN ORDER TO GAIN ACCESS TO A SYSTEM
Reset root pwd in 7 steps:
append
rd.break
ā” to the end of the boot cmd, when editing the grub menu entry, and start it with Ctrl+x.chroot /sysroot
ā” make the mounted (read-only) root file system (/sysroot
) appear as mounted on/
.mount -o remount,rw /
ā” remount root file system in read/write mode for thepasswd
cmd to be able to modify the shadow file with a new pwd.passwd
ā” change password for the root user.touch .autorelabel
ā” create.autorelabel
file to instruct the OS to run SELinux relabeling on all files on the next reboot (including theshadow
that was updated).exit
ā” thechroot
shell.reboot
ā” the system.Extra Step:
mandb
ā” after restart, rebuild manual pages db.
Install most recent kernel, without removing/updating previous kernel (7 files):
linux-firmware
kernel
kernel-core
kernel-headers
kernel-modules
kernel-tools
kernel-tools-libs
dnf list installed kernel*
ā” list installed kernels.cat /boot/grub2/grubenv
ā” check if new installed kernel is default boot option.
IDENTIFY CPU/MEMORY INTENSIVE PROCESSES AND KILL PROCESSES
tar -czf home.tar.gz . &
ā” starttar
as background process in the current shell.jobs
ā” list backgrund processes in the current shell.ps -aux
ā” list every process in the system.ps -eo pid,nice,cmd | grep top
ā” showpid
andnice
for thetop
ā” running process.kill -sigstop 3251
ā” send stop signal to process.
ADJUST PROCESS SCHEDULING
nice -n +8 top
ā” runtop
cmd with a lower priority (by 8).renice -n -10 -p 3261
ā” increase the priority of the3261
running proccess to-10
.crontab -e
ā” edit usercrontab
.23 8 * * * echo "Hello World" > /dev/pts/0
ā” in acrontab
file, this entry will make the terminal/dev/pts/0
print the message everyday at 8:23.cat /var/log/cron
ā” cron execution logs.
MANAGE TUNING PROFILES
tuned-adm profile
,tuned-adm list
ā” list all available system tuning profiles.tuned-adm active
ā” show current system tuning profile.tuned-adm recommend
ā” list recommended system tuning profile.tuned-adm profile balanced
ā” set system profile tobalanced
.
LOCATE AND INTERPRET SYSTEM LOG FILES AND JOURNALS
cat /etc/rsyslog.conf
ā” see directories defined to save the log files generated byrsyslog
.tail -f /var/log/secure
ā” live view of thesecure
log file.tail /var/log/audit/audit.log
ā” view SELinux related logs.journalctl --since 10:00
ā” viewjournal
logs from 10:00 until now.journalctl --unit sshd.service -o verbose
ā” viewjournal
logs related tosshd.service
displaying additional parameters.journalctl --priority crit
ā” view critial priority logs.logger "$LOGNAME is delivering this message at $(date)"
ā” write custom log message to/var/log/messages
.
PRESERVE SYSTEM JOURNALS
Preserve system journals:
mkdir -p /var/log/journal
systemctl restart systemd-journald
journalctl -b -1
ā” view log messages from previous boot.item
ā” description.
START, STOP, AND CHECK THE STATUS OF NETWORK SERVICES
systemctl status sshd.service
ā” verify ifsshd
general status.systemctl enable sshd.service
ā” makesshd
start at system startup.systemctl disable sshd.service
ā” makesshd
do not start at system startup.systemctl start sshd.service
ā” makesshd
start temporarily (this system do not persist reboots).systemctl disable sshd.service
ā” makesshd
stop temporarily (this setting do not persist reboots).
SECURELY TRANSFER FILES BETWEEN SYSTEMS
scp srv2:/etc/chrony.conf /tmp
ā” get file fromsrv2
.scp -r /etc/sysconfig srv2:/tmp
ā” transfer entire directory tosrv2
.scp -p file1.txt srv2:/tmp
ā” transfer file tosrv2
/tmp
directory preserving file attributes (permissions, etc).
Next:
(RHCSA) Configure Local Storage
…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.