2025-02-11 21:58:34 -06:00
|
|
|
# RHCSA Study Notes
|
|
|
|
|
|
|
|
|
|
## Exam Information
|
|
|
|
|
- Exam Code: EX200
|
|
|
|
|
- Duration: 2.5 hours
|
|
|
|
|
- Passing Score: 210/300 (70%)
|
|
|
|
|
|
2025-02-11 23:44:38 -06:00
|
|
|
[CLI Commands](rhcsa.md#cli-commands)
|
|
|
|
|
|
2025-02-11 21:58:34 -06:00
|
|
|
## Core Topics
|
|
|
|
|
|
|
|
|
|
### 1. Essential Tools
|
2025-02-11 22:26:59 -06:00
|
|
|
- [x] Access a shell prompt and issue commands
|
|
|
|
|
- [x] Use input-output redirection
|
|
|
|
|
- [x] Use grep and regular expressions
|
|
|
|
|
- [x] Access remote systems using SSH
|
|
|
|
|
- [x] Log in and switch users in multiuser targets
|
2025-02-11 21:58:34 -06:00
|
|
|
|
|
|
|
|
### 2. File Management
|
2025-02-11 22:26:59 -06:00
|
|
|
- [x] Create, delete, copy, and move files and directories
|
|
|
|
|
- [x] Create and manage hard and soft links
|
|
|
|
|
- [x] Find files and directories
|
|
|
|
|
- [x] Manage file permissions and ownership
|
2025-02-11 21:58:34 -06:00
|
|
|
|
|
|
|
|
### 3. Service Configuration
|
2025-02-11 23:44:38 -06:00
|
|
|
- [x] Configure networking and hostname resolution
|
2025-02-11 21:58:34 -06:00
|
|
|
- [ ] Start, stop, and check system service status
|
|
|
|
|
- [ ] Configure services to start automatically at boot
|
|
|
|
|
- [ ] Configure time service clients
|
|
|
|
|
|
|
|
|
|
### 4. Storage Management
|
|
|
|
|
- [ ] List, create, delete, and modify physical storage partitions
|
|
|
|
|
- [ ] Create and configure filesystem
|
|
|
|
|
- [ ] Configure and manage swap space
|
|
|
|
|
- [ ] Create and manage LVM storage
|
|
|
|
|
- [ ] Create and manage STRATIS storage
|
|
|
|
|
|
|
|
|
|
### 5. Container Management
|
|
|
|
|
- [ ] Find and retrieve container images
|
|
|
|
|
- [ ] Create and manage containers
|
|
|
|
|
- [ ] Configure container storage
|
|
|
|
|
|
|
|
|
|
### 6. System Management
|
|
|
|
|
- [ ] Boot, reboot, and shut down a system
|
|
|
|
|
- [ ] Install Red Hat Enterprise Linux
|
|
|
|
|
- [ ] Use systemd targets for system management
|
|
|
|
|
- [ ] Configure system logging
|
|
|
|
|
- [ ] Schedule tasks using cron and systemd timers
|
|
|
|
|
|
|
|
|
|
### 7. Security
|
|
|
|
|
- [ ] Configure firewall settings
|
|
|
|
|
- [ ] Configure SELinux
|
|
|
|
|
- [ ] Manage users and groups
|
|
|
|
|
- [ ] Set file permissions and ownership
|
|
|
|
|
|
|
|
|
|
## Resources
|
|
|
|
|
- Official Red Hat Documentation
|
|
|
|
|
- Practice Environments
|
|
|
|
|
- Useful Commands Reference
|
|
|
|
|
|
|
|
|
|
## Progress Tracking
|
|
|
|
|
- [ ] Complete practice exams
|
|
|
|
|
- [ ] Lab environment setup
|
|
|
|
|
- [ ] Hands-on practice completed
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
*Note: Check boxes can be used to track progress on each topic as you study*
|
2025-02-11 23:09:41 -06:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# CLI Commands
|
|
|
|
|
|
|
|
|
|
## Networking
|
|
|
|
|
|
2025-02-11 23:34:21 -06:00
|
|
|
### nmtui
|
2025-02-11 23:09:41 -06:00
|
|
|
```bash
|
|
|
|
|
nmtui # Network Manager Text User Interface
|
2025-02-11 23:34:21 -06:00
|
|
|
```
|
2025-02-11 23:09:41 -06:00
|
|
|
|
2025-02-11 23:34:21 -06:00
|
|
|
### ip
|
|
|
|
|
```bash
|
2025-02-11 23:09:41 -06:00
|
|
|
sudo ip addr add dev eth0 192.168.2.2/24 # Add an IP address to the interface eth0 Note: Not persistent, will be lost on reboot
|
2025-02-11 23:34:21 -06:00
|
|
|
```
|
2025-02-11 23:22:14 -06:00
|
|
|
|
2025-02-11 23:34:21 -06:00
|
|
|
### nmcli
|
|
|
|
|
```bash
|
2025-02-11 23:22:14 -06:00
|
|
|
nmcli connection add connection.interface-name ens160 ipv4.addresses 192.168.100.1/24 ipv4.gateway 192.168.100.254 type ethernet # Persistant IP address
|
|
|
|
|
|
|
|
|
|
sudo nmcli connection up ethernet-ens160 # Bring up the ethernet interface
|
|
|
|
|
|
|
|
|
|
sudo nmcli connection down ethernet-ens160 # Bring down the ethernet interface
|
|
|
|
|
|
|
|
|
|
sudo nmcli connection delete id "ens160" # Delete the ethernet connection
|
|
|
|
|
|
|
|
|
|
sudo nmcli connection show # Show all connections
|
2025-02-11 23:09:41 -06:00
|
|
|
```
|
|
|
|
|
|
2025-02-12 21:00:24 -06:00
|
|
|
## Manage and Monitor Processes
|
|
|
|
|
|
|
|
|
|
### top
|
|
|
|
|
```bash
|
|
|
|
|
top # Display running processes
|
|
|
|
|
|
|
|
|
|
top -o %MEM # Sort by memory usage
|
|
|
|
|
|
|
|
|
|
top -o %CPU # Sort by CPU usage
|
2025-02-12 21:29:13 -06:00
|
|
|
|
|
|
|
|
top -p 1234 # Display information for process 1234
|
|
|
|
|
```
|
|
|
|
|
### pidof
|
|
|
|
|
```bash
|
|
|
|
|
pidof sleep # Display the PID of the sleep command
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### kill
|
|
|
|
|
```bash
|
|
|
|
|
kill -l # List all signals
|
|
|
|
|
|
|
|
|
|
kill -9 1234 # Kill the process with PID 1234
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### nice
|
|
|
|
|
```bash
|
|
|
|
|
nice -n 10 sleep 100 # Run the sleep command with a priority of 10
|
2025-02-12 21:00:24 -06:00
|
|
|
```
|
|
|
|
|
|
2025-02-15 09:08:40 -06:00
|
|
|
## Partitions and Mounting
|
|
|
|
|
|
|
|
|
|
### lsblk
|
|
|
|
|
```bash
|
|
|
|
|
lsblk -f # List all block devices with filesystem type
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### fdisk
|
|
|
|
|
```bash
|
|
|
|
|
sudo fdisk /dev/sda # Partition the disk /dev/sda
|
|
|
|
|
# Note: n for new partition, p for primary, 1 for first partition, w for write
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### mkfs
|
|
|
|
|
```bash
|
|
|
|
|
sudo mkfs.xfs /dev/sda1 # Format the partition /dev/sda1 as XFS
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### mount
|
|
|
|
|
```bash
|
|
|
|
|
sudo mount /dev/sda1 /mnt # Mount the partition /dev/sda1 to /mnt
|
|
|
|
|
|
|
|
|
|
sudo mount -a # Mount all partitions
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### LVM
|
2025-02-15 09:34:31 -06:00
|
|
|
```bash
|
|
|
|
|
sudo fdisk /dev/sda # Partition the disk /dev/sda
|
2025-02-15 10:28:28 -06:00
|
|
|
# Note: p for print, n for new partition, t for type, 8e for LVM, w for write
|
2025-02-15 09:34:31 -06:00
|
|
|
|
2025-02-15 10:21:52 -06:00
|
|
|
### Physical Volumes ###
|
2025-02-15 09:34:31 -06:00
|
|
|
sudo pvdisplay # Display all physical volumes
|
|
|
|
|
sudo pvs # Display all physical volumes
|
|
|
|
|
|
|
|
|
|
sudo pvcreate /dev/sda1p1 # Create a physical volume on /dev/sda1p1
|
|
|
|
|
sudo pvcreate /dev/sdb1p1 # Create a physical volume on /dev/sdb1p1
|
|
|
|
|
sudo pvcreate /dev/sdc1p1 # Create a physical volume on /dev/sdc1p1
|
|
|
|
|
|
2025-02-15 10:21:52 -06:00
|
|
|
### Volume Groups ###
|
2025-02-15 09:34:31 -06:00
|
|
|
sudo vgcreate vg_data /dev/sda1p1 /dev/sdb1p1 /dev/sdc1p1 # Create a volume group vg_data on /dev/sda1p1, /dev/sdb1p1, /dev/sdc1p1
|
|
|
|
|
|
|
|
|
|
sudo vgdisplay # Display all volume groups
|
|
|
|
|
sudo vgs # Display all volume groups
|
|
|
|
|
|
2025-02-15 10:21:52 -06:00
|
|
|
### Logical Volumes ###
|
2025-02-15 09:34:31 -06:00
|
|
|
sudo lvdisplay # Display all logical volumes
|
|
|
|
|
sudo lvs # Display all logical volumes
|
|
|
|
|
|
|
|
|
|
sudo lvcreate -n lv_data -l 100%FREE vg_data # Create a logical volume lv_data on vg_data
|
|
|
|
|
sudo lvcreate -n lv_data -L 100M vg_data # Create a logical volume lv_data on vg_data with a size of 100M
|
|
|
|
|
|
2025-02-15 10:21:52 -06:00
|
|
|
### Formatting and Mounting ###
|
2025-02-15 09:34:31 -06:00
|
|
|
sudo mkfs.xfs /dev/vg_data/lv_data # Format the logical volume lv_data as XFS
|
|
|
|
|
sudo mount /dev/vg_data/lv_data /mnt # Mount the logical volume lv_data to /mnt
|
|
|
|
|
sudo umount /mnt # Unmount the logical volume lv_data from /mnt
|
|
|
|
|
|
2025-02-15 10:21:52 -06:00
|
|
|
### Extending and Reducing ###
|
2025-02-15 10:13:28 -06:00
|
|
|
sudo lvextend -L +100M /dev/vg_data/lv_data # Extend the logical volume lv_data by 100M
|
|
|
|
|
sudo lvreduce -L -100M /dev/vg_data/lv_data # Reduce the logical volume lv_data by 100M
|
|
|
|
|
|
2025-02-15 09:34:31 -06:00
|
|
|
sudo lvremove /dev/vg_data/lv_data # Remove the logical volume lv_data
|
|
|
|
|
sudo vgremove vg_data # Remove the volume group vg_data
|
|
|
|
|
sudo pvremove /dev/sda1p1 /dev/sdb1p1 /dev/sdc1p1 # Remove the physical volumes /dev/sda1p1, /dev/sdb1p1, /dev/sdc1p1
|
|
|
|
|
|
2025-02-15 10:21:52 -06:00
|
|
|
### Interactive LVM Tool ###
|
2025-02-15 10:13:28 -06:00
|
|
|
sudo lvm # Interactive LVM tool
|
|
|
|
|
```
|
2025-02-15 09:34:31 -06:00
|
|
|
|
2025-02-15 10:13:28 -06:00
|
|
|
### STRATIS
|
|
|
|
|
```bash
|
|
|
|
|
sudo dnf install stratisd stratis-cli # Install the STRATIS storage service and CLI
|
|
|
|
|
|
|
|
|
|
sudo stratis pool create pool1 /dev/sda1p1 # Create a pool named pool1 on /dev/sda1p1
|
|
|
|
|
sudo stratis pool add-data pool1 /dev/sdb1p1 # Add a data volume to the pool named pool1 on /dev/sdb1p1
|
|
|
|
|
|
|
|
|
|
sudo stratis pool delete pool1 # Delete the pool named pool1
|
|
|
|
|
|
|
|
|
|
sudo stratis pool list # List all pools
|
|
|
|
|
sudo stratis blockdev list # List all block devices
|
|
|
|
|
|
|
|
|
|
sudo stratis fs create pool1 fstest # Create a filesystem named fstest on the pool named pool1
|
|
|
|
|
sudo stratis fs list # List all filesystems # Note: UUID is the UUID of the filesystem
|
|
|
|
|
mkdir /mnt/fsmount # Create a mount point for the filesystem
|
|
|
|
|
sudo nano /etc/fstab # Add the following line to the fstab file: UUID=1234567890 /mnt/fsmount xfs x-systemd.requires=stratisd.service 0 0
|
|
|
|
|
sudo mount -a # Mount all filesystems
|
|
|
|
|
```
|
2025-02-15 09:34:31 -06:00
|
|
|
|
2025-02-15 12:28:59 -06:00
|
|
|
## Automatic Services & Task Scheduling
|
|
|
|
|
|
|
|
|
|
### cron
|
|
|
|
|
```bash
|
|
|
|
|
sudo crontab -e # Edit the cron table
|
|
|
|
|
|
|
|
|
|
sudo crontab -l # List the cron table
|
|
|
|
|
|
2025-02-15 12:33:54 -06:00
|
|
|
### crontab format ###
|
|
|
|
|
|
2025-02-15 12:28:59 -06:00
|
|
|
* * * * * command # Run the command every minute
|
|
|
|
|
|
|
|
|
|
0 12 * * * command # Run the command at 12:00 PM
|
|
|
|
|
|
|
|
|
|
0 0 * * * command # Run the command at 12:00 AM
|
|
|
|
|
```
|
|
|
|
|
|
2025-02-15 12:33:54 -06:00
|
|
|
### at
|
|
|
|
|
```bash
|
|
|
|
|
at 12:00 PM # Schedule a command to run at 12:00 PM
|
|
|
|
|
|
|
|
|
|
at -l # List all scheduled jobs
|
|
|
|
|
|
|
|
|
|
atq # List all scheduled jobs
|
|
|
|
|
|
|
|
|
|
atrm 1 # Remove the scheduled job with ID 1
|
|
|
|
|
```
|
|
|
|
|
|
2025-02-15 15:19:42 -06:00
|
|
|
### systemd
|
2025-02-15 12:28:59 -06:00
|
|
|
|
2025-02-15 15:19:42 -06:00
|
|
|
```bash
|
|
|
|
|
sudo systemctl start sshd # Start the sshd service
|
|
|
|
|
sudo systemctl stop sshd # Stop the sshd service
|
|
|
|
|
sudo systemctl restart sshd # Restart the sshd service
|
|
|
|
|
|
|
|
|
|
sudo systemctl enable sshd # Enable the sshd service to start on boot
|
|
|
|
|
sudo systemctl disable sshd # Disable the sshd service from starting on boot
|
|
|
|
|
sudo systemctl status sshd # Check the status of the sshd service
|
|
|
|
|
|
|
|
|
|
sudo systemctl daemon-reload # Reload the systemd daemon
|
|
|
|
|
|
|
|
|
|
sudo systemctl mask sshd # Mask the sshd service
|
|
|
|
|
sudo systemctl unmask sshd # Unmask the sshd service
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### systemd service and timer commands
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
### Creating a service ###
|
|
|
|
|
sudo nano /etc/systemd/system/myapp.service
|
|
|
|
|
# [Unit]
|
|
|
|
|
# Description=My App
|
|
|
|
|
|
|
|
|
|
# [Service]
|
2025-02-15 16:32:12 -06:00
|
|
|
# Type=simple
|
2025-02-15 15:19:42 -06:00
|
|
|
# ExecStart=/usr/bin/myapp
|
2025-02-15 16:32:12 -06:00
|
|
|
# User=myuser
|
2025-02-15 15:19:42 -06:00
|
|
|
|
|
|
|
|
### Creating a timer ###
|
|
|
|
|
sudo nano /etc/systemd/system/myapp.timer
|
|
|
|
|
# [Unit]
|
|
|
|
|
# Description=My App Timer
|
|
|
|
|
|
|
|
|
|
# [Timer]
|
2025-02-15 16:32:12 -06:00
|
|
|
# OnBootSec=10min # Run the timer 10 minutes after the system starts
|
|
|
|
|
# OnCalendar=*-*-* 10:00:00 # Run at 10:00 AM every day
|
2025-02-15 16:50:49 -06:00
|
|
|
# OnCalendar=*-*-* *:*:0 # Run at every minute
|
2025-02-15 16:32:12 -06:00
|
|
|
|
|
|
|
|
# [Install]
|
|
|
|
|
# WantedBy=graphical.target # Run the timer on the graphical target
|
2025-02-15 15:19:42 -06:00
|
|
|
|
|
|
|
|
### Tying the timer to the service ###
|
|
|
|
|
sudo systemctl link /etc/systemd/system/myapp.timer
|
|
|
|
|
|
|
|
|
|
### Starting a service ###
|
|
|
|
|
sudo systemctl start myapp
|
2025-02-15 17:09:05 -06:00
|
|
|
sudo systemctl start myapp.timer
|
2025-02-15 15:19:42 -06:00
|
|
|
```
|
2025-02-15 09:34:31 -06:00
|
|
|
|
2025-02-15 17:17:50 -06:00
|
|
|
## Bash Scripting
|
2025-02-15 09:08:40 -06:00
|
|
|
|
2025-02-15 17:17:50 -06:00
|
|
|
### Basic Script
|
|
|
|
|
```bash
|
|
|
|
|
nano myscript.sh
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
> Note: Shebang is the first line of the script that tells the system which interpreter to use.
|
|
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
echo "Hello, World!"
|
2025-02-15 20:09:11 -06:00
|
|
|
|
|
|
|
|
### Variables ###
|
|
|
|
|
myvar="Hello, World!"
|
|
|
|
|
echo $myvar
|
|
|
|
|
|
|
|
|
|
### Conditionals ###
|
|
|
|
|
if [ -f /etc/passwd ]; then
|
|
|
|
|
echo "File exists"
|
|
|
|
|
else
|
|
|
|
|
echo "File does not exist"
|
|
|
|
|
fi
|
2025-02-15 17:17:50 -06:00
|
|
|
```
|
2025-02-15 09:08:40 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
### Script to create a directory
|
|
|
|
|
> NOTE: When creating bash scripts you can use particular operators to check for the existence of a file (-f) or directory (-d). The
|
|
|
|
|
> following example uses the -d operator to check for the existence of a directory. Using conditional logic, if the script detects
|
|
|
|
|
> that the directory does not exist, the script will go ahead and create it.
|
2025-02-15 09:08:40 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
2025-02-15 09:08:40 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
# Ask the user to enter a directory name
|
|
|
|
|
echo "Enter a directory name: "
|
2025-02-15 09:08:40 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
# Read the user's input
|
|
|
|
|
read user_dir
|
2025-02-15 09:08:40 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
# Check if the user_dir exists
|
|
|
|
|
if [ -d "$user_dir" ]; then
|
|
|
|
|
echo "The directory '$user_dir' already exists."
|
|
|
|
|
else
|
|
|
|
|
# Create the user_dir directory if it doesn't exist
|
|
|
|
|
mkdir "$user_dir"
|
|
|
|
|
echo "The directory '$user_dir' has been created."
|
|
|
|
|
fi
|
|
|
|
|
```
|
2025-02-12 21:00:24 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
> In a similar vein, you can check for the existence of a regular file using the -f operator.
|
2025-02-12 21:00:24 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
2025-02-11 23:09:41 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
# Ask the user to enter a filename
|
|
|
|
|
echo "Enter a filename: "
|
2025-02-11 23:09:41 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
# Read the user's input
|
|
|
|
|
read user_file
|
2025-02-12 21:29:13 -06:00
|
|
|
|
2025-02-15 20:09:11 -06:00
|
|
|
# Check if the file exists
|
|
|
|
|
if [ -f "$user_file" ]; then
|
|
|
|
|
echo "The file '$user_file' exists."
|
|
|
|
|
else
|
|
|
|
|
echo "The file '$user_file' does not exist."
|
|
|
|
|
fi
|
|
|
|
|
```
|
2025-02-16 07:35:46 -06:00
|
|
|
|
|
|
|
|
### for loop
|
|
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
for i in 1..10; do
|
|
|
|
|
echo $i
|
|
|
|
|
done
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### while loop
|
|
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
i=1
|
|
|
|
|
while [ $i -le 10 ]; do
|
|
|
|
|
echo $i
|
|
|
|
|
i=$((i+1))
|
|
|
|
|
done
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### until loop
|
|
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
i=1
|
|
|
|
|
until [ $i -gt 10 ]; do
|
|
|
|
|
echo $i
|
|
|
|
|
i=$((i+1))
|
|
|
|
|
done
|
2025-02-16 08:17:00 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Example script to check a user's age
|
|
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
echo "Please provide me your age: "
|
|
|
|
|
|
|
|
|
|
read age
|
|
|
|
|
|
|
|
|
|
if [ "$age" -le 17 ]; then
|
|
|
|
|
echo "You cannot enter bars or vote."
|
|
|
|
|
elif [ "$age" -ge 18 ] && [ "$age" -le 20 ]; then
|
|
|
|
|
echo "You can vote but not enter bars."
|
|
|
|
|
else
|
|
|
|
|
echo "You are old enough to vote and enter bars."
|
|
|
|
|
fi
|
2025-02-16 11:21:37 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Boot Process & Targets
|
|
|
|
|
|
2025-02-16 12:26:51 -06:00
|
|
|
### Change the grub2 configuration
|
|
|
|
|
```bash
|
|
|
|
|
sudo grub2-mkconfig -o /boot/grub2/grub.cfg # Create a new grub configuration file
|
2025-02-16 15:26:36 -06:00
|
|
|
|
|
|
|
|
sudo nano /etc/default/grub # Edit the grub configuration file
|
|
|
|
|
|
|
|
|
|
# Add the following line to the grub configuration file:
|
|
|
|
|
GRUB_CMDLINE_LINUX="quiet splash"
|
2025-02-16 12:26:51 -06:00
|
|
|
```
|
|
|
|
|
|
2025-02-16 11:21:37 -06:00
|
|
|
### dmesg
|
|
|
|
|
|
|
|
|
|
> Note: The boot process is the process by which a system starts up. It is a sequence of events that occur when a system is powered on or rebooted.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
sudo dmesg # Display the kernel messages
|
|
|
|
|
sudo dmesg | tail # Display the last 10 lines of the kernel messages
|
|
|
|
|
sudo dmesg | grep "kernel" # Display the kernel messages that contain the word "kernel"
|
|
|
|
|
|
|
|
|
|
### /var/log/messages ###
|
|
|
|
|
sudo less /var/log/messages # Display the kernel messages
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### systemd targets
|
|
|
|
|
|
|
|
|
|
> Note: Systemd targets are a way to manage the boot process of a system. They are a way to manage the boot process of a system.
|
2025-02-16 12:25:13 -06:00
|
|
|
>> multi.target is the default target for the system.
|
|
|
|
|
>> graphical.target is the target for the graphical interface.
|
|
|
|
|
>> basic.target is the target for the minimal system.
|
|
|
|
|
>> rescue.target is the target for the rescue mode.
|
|
|
|
|
>> emergency.target is the target for the emergency mode.
|
|
|
|
|
>> multi-user.target is the target for the multi-user mode.
|
|
|
|
|
>> reboot.target is the target for the reboot mode.
|
|
|
|
|
>> poweroff.target is the target for the poweroff mode.
|
2025-02-16 11:21:37 -06:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
systemctl list-units --type=target
|
2025-02-16 12:23:22 -06:00
|
|
|
|
|
|
|
|
### Changing the default target ###
|
|
|
|
|
sudo systemctl set-default multi-user.target # Set the default target to multi-user.target
|
|
|
|
|
sudo systemctl set-default graphical.target # Set the default target to graphical.target
|
|
|
|
|
sudo systemctl set-default basic.target # Set the default target to basic.target
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Run Level
|
|
|
|
|
|
|
|
|
|
> Note: Run level is a way to manage the boot process of a system. It is a way to manage the boot process of a system.
|
|
|
|
|
> 0 is the emergency mode.
|
|
|
|
|
> 1 is the single user mode.
|
|
|
|
|
> 2 is the multi-user mode.
|
|
|
|
|
> 3 is the multi-user mode.
|
|
|
|
|
> 4 is the multi-user mode. (unused)
|
|
|
|
|
> 5 is the graphical mode.
|
|
|
|
|
> 6 is the reboot mode.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
runlevel # Display the current run level
|
|
|
|
|
sudo systemctl get-default # Display the default target
|
|
|
|
|
sudo systemctl set-default runlevel3.target # Set the default target to runlevel3.target
|
|
|
|
|
sudo telinit 3 # Change to runlevel 3
|
2025-02-16 15:26:36 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Manage SSH Connections
|
|
|
|
|
|
|
|
|
|
### ssh
|
|
|
|
|
```bash
|
|
|
|
|
ssh user@host # Connect to the host as the user
|
|
|
|
|
|
|
|
|
|
ssh -p 2222 user@host # Connect to the host as the user on port 2222
|
|
|
|
|
|
|
|
|
|
ssh -i /path/to/private_key user@host # Connect to the host as the user using a private key
|
|
|
|
|
|
|
|
|
|
ssh-copy-id user@host # Copy the user's public key to the host
|
|
|
|
|
|
|
|
|
|
ssh-keygen -t ed25519 -C "comment" -f ~/.ssh/id_ed25519 -N "" # Generate a new ed25519 key
|
|
|
|
|
|
|
|
|
|
ssh-keygen -t rsa -b 4096 -C "comment" -f ~/.ssh/id_rsa -N "" # Generate a new rsa key
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### sshd_config
|
|
|
|
|
```bash
|
|
|
|
|
sudo nano /etc/ssh/sshd_config # Edit the sshd configuration file
|
|
|
|
|
|
|
|
|
|
# Add the following line to the sshd configuration file:
|
|
|
|
|
Port 2222
|
|
|
|
|
|
|
|
|
|
sudo systemctl restart sshd # Restart the sshd service
|
|
|
|
|
```
|
|
|
|
|
|
2025-02-16 15:30:11 -06:00
|
|
|
## NFS & NTP
|
|
|
|
|
|
|
|
|
|
### NFS
|
|
|
|
|
```bash
|
2025-02-16 16:02:04 -06:00
|
|
|
sudo dnf install nfs-utils # Install the NFS utilities
|
|
|
|
|
|
2025-02-16 15:30:11 -06:00
|
|
|
sudo nano /etc/exports # Edit the exports file
|
2025-02-16 15:53:05 -06:00
|
|
|
|
2025-02-16 16:02:04 -06:00
|
|
|
# Add the following line to the exports file:
|
|
|
|
|
/mnt/nfs # The directory to export
|
|
|
|
|
|
2025-02-16 15:53:05 -06:00
|
|
|
sudo exportfs -r # Export the NFS shares
|
|
|
|
|
sudo exportfs # Display the NFS shares
|
|
|
|
|
|
|
|
|
|
sudo systemctl start nfs-server # Start the NFS server
|
2025-02-16 16:02:04 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Configure an NFS Client
|
|
|
|
|
```bash
|
|
|
|
|
sudo dnf install nfs-utils # Install the NFS utilities
|
|
|
|
|
|
|
|
|
|
sudo mount 192.168.1.1:/mnt/nfs /mnt/nfs # Mount the NFS share
|
|
|
|
|
sudo umount /mnt/nfs # Unmount the NFS share
|
2025-02-16 15:30:11 -06:00
|
|
|
```
|