Compare commits

...
60 Commits
Author SHA1 Message Date
Hugh Ratsch 6f59855479 notes update 2025-03-12 10:29:30 -05:00
Hugh Ratsch bbfc9df6d1 notes update 2025-03-10 18:26:54 -05:00
Hugh Ratsch 5830b72de9 notes update 2025-03-06 18:51:21 -06:00
Hugh Ratsch 1c0abd53fe notes update && created mock practice exam 2025-03-06 18:40:54 -06:00
Hugh Ratsch c29910ad0e notes update && created mock practice exam 2025-03-06 18:13:55 -06:00
Hugh Ratsch 5fab863220 notes update 2025-03-03 19:13:27 -06:00
Hugh Ratsch 26eccbf5d1 notes update 2025-03-03 18:59:08 -06:00
Hugh Ratsch 72792697e9 notes update 2025-03-03 18:48:21 -06:00
Hugh Ratsch 71b7be46d2 Remove custom CSS to simplify styling and use default mdBook theme 2025-03-02 12:32:50 -06:00
Hugh Ratsch 3525a5509a Fix left sidebar display with proper width and positioning 2025-03-02 12:30:54 -06:00
Hugh Ratsch f89f7c016d Apply aggressive TOC hiding rules to fix persistent right sidebar 2025-03-02 12:27:47 -06:00
Hugh Ratsch 3b8979ae11 Clean up CSS to show left navigation sidebar and hide right TOC 2025-03-02 12:21:23 -06:00
Hugh Ratsch 0a8642fde0 Fix conflicting CSS rules to completely hide sidebar 2025-03-02 12:14:39 -06:00
Hugh Ratsch 17624e4bd1 Remove sidebar table of contents for cleaner interface 2025-03-02 12:11:33 -06:00
Hugh Ratsch a7ad134cad completely redesigned notes update 2025-03-02 12:03:42 -06:00
Hugh Ratsch 1933b4368f completely redesigned notes update 2025-03-02 11:59:34 -06:00
Hugh Ratsch d32a0fc48c completely redesigned notes update 2025-03-02 11:53:42 -06:00
Hugh Ratsch 8bfcb02dab completely redesigned notes update 2025-03-02 11:45:17 -06:00
Hugh Ratsch b5433bedf5 Implement flattened structure with in-page navigation and back-to-top links 2025-03-02 11:35:08 -06:00
Hugh Ratsch be1c0d3dc9 Fix mdBook rendering issues with nested sections 2025-03-02 11:28:31 -06:00
Hugh Ratsch e4ba16bfc7 Update solution templates with scenario descriptions 2025-03-02 09:45:00 -06:00
Hugh Ratsch cd36415d1d completely redesigned notes 2025-03-02 09:26:39 -06:00
Hugh Ratsch 9f724bc25c updated solutions for practice scenerios 2025-03-02 09:09:42 -06:00
Hugh Ratsch 7caffec7b9 updated solutions for practice scenerios 2025-03-02 09:03:45 -06:00
Hugh Ratsch fb9c79db6c updated solutions for practice scenerios 2025-03-02 09:03:12 -06:00
Hugh Ratsch f79226e051 updated solutions for practice scenerios 2025-02-23 12:22:35 -06:00
Hugh Ratsch 76f3d13f23 updated solutions for practice scenerios 2025-02-23 12:20:13 -06:00
Hugh Ratsch 80788d7ae2 updated solutions for practice scenerios 2025-02-23 12:01:29 -06:00
Hugh Ratsch 26c6a527c1 updated notes 2025-02-21 08:50:23 -06:00
Hugh Ratsch 623ab2a55c updated notes 2025-02-20 23:10:06 -06:00
Hugh Ratsch 3867c7ed7d updated solutions for practice scenerios 2025-02-20 23:07:39 -06:00
Hugh Ratsch a6ceaff943 created scenerios and solutions template 2025-02-20 19:38:02 -06:00
Hugh Ratsch 9f73eb1af5 updated notes 2025-02-20 15:48:09 -06:00
Hugh Ratsch 5e3fbf31c2 updated notes 2025-02-20 15:27:11 -06:00
Hugh Ratsch 8d6ad962dd updated notes 2025-02-20 14:58:49 -06:00
Hugh Ratsch 5e2473ffa5 updated notes 2025-02-20 12:44:08 -06:00
Hugh Ratsch 753c86939c updated notes 2025-02-20 11:47:16 -06:00
Hugh Ratsch d386f6044c updated notes 2025-02-20 09:01:32 -06:00
Hugh Ratsch f1e94f77d7 updated notes 2025-02-20 03:26:15 -06:00
Hugh Ratsch 793a23c859 updated notes 2025-02-20 03:21:31 -06:00
Hugh Ratsch 5da3e06f11 updated notes 2025-02-18 22:29:45 -06:00
Hugh Ratsch 9be2627fa3 updated notes 2025-02-18 20:39:07 -06:00
Hugh Ratsch 8a547aeb11 updated notes 2025-02-18 20:25:08 -06:00
Hugh Ratsch acecba25f2 updated notes 2025-02-18 19:56:32 -06:00
Hugh Ratsch 2bfd9c78d6 updated notes 2025-02-18 19:08:53 -06:00
Hugh Ratsch 74d360f7d0 updated notes 2025-02-18 18:36:17 -06:00
Hugh Ratsch f9a67c38be updated notes 2025-02-18 18:25:26 -06:00
Hugh Ratsch af8f1729ea updated notes 2025-02-18 18:23:21 -06:00
Hugh Ratsch 006cc41944 updated notes 2025-02-18 16:56:59 -06:00
Hugh Ratsch e6e96b65b6 updated notes 2025-02-18 16:43:28 -06:00
Hugh Ratsch 9f29df069c updated notes 2025-02-18 16:36:36 -06:00
Hugh Ratsch 990c6e55bd updated notes 2025-02-18 16:29:36 -06:00
Hugh Ratsch 4643b7e0de updated notes 2025-02-18 15:23:14 -06:00
Hugh Ratsch 0add4424e8 updated notes 2025-02-16 23:03:05 -06:00
Hugh Ratsch 975504ee78 updated notes 2025-02-16 17:57:42 -06:00
Hugh Ratsch cbe5c0c63e updated notes 2025-02-16 17:11:47 -06:00
Hugh Ratsch 5c25e1c8b6 updated notes 2025-02-16 16:59:09 -06:00
Hugh Ratsch 0b2e15b7e5 updated notes 2025-02-16 16:31:20 -06:00
Hugh Ratsch cc0de554b3 updated notes 2025-02-16 16:02:04 -06:00
Hugh Ratsch 6bc279bc8b updated notes 2025-02-16 15:53:05 -06:00
24 changed files with 4894 additions and 22 deletions
+14 -1
View File
@@ -9,4 +9,17 @@ title = "IT Learning Notes"
default-theme = "light"
preferred-dark-theme = "navy"
git-repository-url = "http://192.168.2.2:3003/hugh/it-knowledge.git"
port = 3001
port = 3001
mathjax-support = true
no-section-label = true
fold = { enable = true, level = 1 }
additional-js = ["custom.js"]
section-anchors = false
[build]
build-dir = "book"
create-missing = false
use-default-preprocessors = true
[preprocessor]
[preprocessor.index]
+164
View File
@@ -0,0 +1,164 @@
// Custom JavaScript for IT Learning Notes
// Wait for the DOM to be fully loaded
document.addEventListener('DOMContentLoaded', function() {
// Improve anchor link scrolling behavior
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
// Only process internal page links
if (targetId.startsWith('#')) {
const targetElement = document.querySelector(targetId);
if (targetElement) {
// Smooth scroll to the target
window.scrollTo({
top: targetElement.offsetTop - 60, // Account for header/navigation
behavior: 'smooth'
});
// Update URL without reloading the page
history.pushState(null, null, targetId);
}
}
});
});
// Add "Back to Top" links if they don't exist in the content
const sections = document.querySelectorAll('h2');
sections.forEach(section => {
// Check if there's already a back-to-top link after this section
const nextElement = section.nextElementSibling;
const hasBackToTop = false;
// Find the end of this section (next h2 or end of document)
let currentElement = section.nextElementSibling;
while (currentElement && currentElement.tagName !== 'H2') {
if (currentElement.tagName === 'A' &&
currentElement.getAttribute('href') &&
currentElement.getAttribute('href').includes('top')) {
hasBackToTop = true;
break;
}
currentElement = currentElement.nextElementSibling;
}
// Add back-to-top link if needed
if (!hasBackToTop && currentElement && currentElement.tagName === 'H2') {
const backToTop = document.createElement('a');
backToTop.href = '#';
backToTop.textContent = 'Back to Top';
backToTop.className = 'back-to-top';
backToTop.style.display = 'block';
backToTop.style.marginBottom = '2em';
// Insert before the next heading
section.parentNode.insertBefore(backToTop, currentElement);
}
});
// Fix for any dynamically loaded content
setTimeout(function() {
// Force redraw of content area
const content = document.querySelector('.content');
if (content) {
content.style.display = 'none';
content.offsetHeight; // Force reflow
content.style.display = 'block';
}
// Scroll to anchor if present in URL
if (window.location.hash) {
const element = document.getElementById(window.location.hash.substring(1));
if (element) {
element.scrollIntoView({behavior: 'smooth'});
}
}
}, 100);
});
// Create a table of contents if it doesn't exist
function generateTableOfContents() {
// Only run if we don't have a TOC div already
if (!document.querySelector('.toc')) {
const headings = document.querySelectorAll('h2');
if (headings.length > 2) { // Only if we have a reasonable number of headings
const toc = document.createElement('div');
toc.className = 'toc';
const tocTitle = document.createElement('h2');
tocTitle.textContent = 'Table of Contents';
toc.appendChild(tocTitle);
const tocList = document.createElement('ul');
headings.forEach(heading => {
if (!heading.textContent.toLowerCase().includes('table of contents')) {
const listItem = document.createElement('li');
const link = document.createElement('a');
// Create an id for the heading if it doesn't have one
if (!heading.id) {
heading.id = heading.textContent.toLowerCase()
.replace(/[^\w]+/g, '-');
}
link.href = '#' + heading.id;
link.textContent = heading.textContent;
listItem.appendChild(link);
tocList.appendChild(listItem);
}
});
toc.appendChild(tocList);
// Insert after the first heading (title)
const title = document.querySelector('h1');
if (title && title.nextElementSibling) {
title.parentNode.insertBefore(toc, title.nextElementSibling.nextElementSibling);
}
}
}
}
// Run when the page loads
window.addEventListener('load', function() {
// Generate TOC if needed
generateTableOfContents();
// Enable all sections that might have been hidden
document.querySelectorAll('.content-hidden')
.forEach(el => el.classList.remove('content-hidden'));
});
// Monitor for any dynamically added elements and ensure they're visible
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
for (let i = 0; i < mutation.addedNodes.length; i++) {
const node = mutation.addedNodes[i];
if (node.nodeType === 1) { // Element node
if (node.classList && (
node.classList.contains('section') ||
node.classList.contains('content') ||
node.classList.contains('content-hidden')
)) {
node.style.display = 'block';
node.style.visibility = 'visible';
node.style.opacity = '1';
node.classList.remove('content-hidden');
}
}
}
}
});
});
// Start observing the document body for changes
observer.observe(document.body, {
childList: true,
subtree: true
});
+23
View File
@@ -5,3 +5,26 @@
# Core Topics
- [Getting Started](getting-started.md)
- [RHCSA](rhcsa.md)
# Practice Scenarios
- [Overview](practice-scenarios/README.md)
- [Practice Scenarios v1](practice-scenarios/rhcsa_practice_scenarios.md)
- [Practice Scenarios v2](practice-scenarios/rhcsa_practice_scenarios_v2.md)
- [Practice Scenarios v3](practice-scenarios/rhcsa_practice_scenarios_v3.md)
- [Practice Scenarios v4](practice-scenarios/rhcsa_practice_scenarios_v4.md)
- [Practice Scenarios v5](practice-scenarios/rhcsa_practice_scenarios_v5.md)
- [Mock RHCSA Exam](practice-scenarios/mock-rhcsa-exam.md)
- [Mock RHCSA Exam v2](practice-scenarios/mock-rhcsa-exam-v2.md)
# My Solutions Portfolio
- [Portfolio Overview](solutions/README.md)
- [User Management Solutions [👤]](solutions/user-management.md)
- [Storage Management Solutions [💾]](solutions/storage-management.md)
- [Service Management Solutions [⚙️]](solutions/service-management.md)
- [Network Solutions [🌐]](solutions/networking.md)
- [Security Solutions [🔒]](solutions/security.md)
- [Container Management Solutions [📦]](solutions/container-management.md)
- [System Recovery Solutions [🔧]](solutions/system-recovery.md)
- [Shell Scripting Solutions [📜]](solutions/shell-scripting.md)
- [Mock Exam Solutions [🎯]](solutions/mock-exam-solutions.md)
- [Mock Exam v2 Solutions [🎯]](solutions/mock-exam-solutions-v2.md)
+30
View File
@@ -0,0 +1,30 @@
# RHCSA Practice Scenarios
This directory contains various practice scenarios and mock exams to help prepare for the Red Hat Certified System Administrator (RHCSA) exam.
## Available Practice Materials
- **Practice Scenarios v1-v5**: Incremental practice scenarios covering individual RHCSA objectives
- **Mock RHCSA Exam**: A comprehensive mock exam that simulates the actual RHCSA exam environment and tasks
- **Mock RHCSA Exam v2**: An advanced mock exam with more complex tasks covering additional RHCSA objectives
## How to Use These Materials
1. Start with the practice scenarios to build specific skills
2. Once comfortable with individual components, attempt the mock exams
3. Time yourself to simulate exam conditions (2.5 hours)
4. Review and practice areas where you struggled
5. Use the second mock exam to further challenge yourself with more advanced tasks
## Key Focus Areas
- User and group management
- Storage configuration (partitions, LVM, STRATIS, VDO, encryption)
- Service management and automation
- Network configuration
- Security (firewall, SELinux, SSH)
- Container management
- System boot and troubleshooting
- Advanced shell scripting
Remember that the actual RHCSA exam is performance-based, so hands-on practice in a lab environment is essential for success.
@@ -0,0 +1,156 @@
# Mock RHCSA (EX200) Practice Exam - Version 2
## Introduction
This is the second version of our mock RHCSA exam, featuring new tasks to further test your Red Hat system administration skills. Like the first version, it covers the key objectives of the official RHCSA exam (EX200).
**Exam Guidelines:**
- Duration: 2.5 hours
- All configurations must persist after system reboot
- Complete as many tasks as possible - 70% is the passing score
- You may use Red Hat documentation available on the system
**Exam Environment:**
- Red Hat Enterprise Linux 9
- Virtual machine with 4GB RAM, 40GB disk space
- Internet access is NOT available
- Root access is available
## Exam Tasks
### Task 1: User and Group Management
1. Create a user named `devops` with UID 3030
2. Set the password for `devops` to `DevOps2023`
3. Configure the `devops` account to expire on December 31, 2023
4. Create a group named `developers` with GID 4040
5. Create 3 users: `dev1`, `dev2`, and `dev3`, all belonging to the `developers` group as their primary group
6. Ensure the primary group for all new users created in the system is `developers`
7. Configure all members of the `developers` group to have a password change required every 60 days
### Task 2: File System Management
1. Create a directory `/projects` owned by `devops` with `developers` as the group owner
2. Set special permissions on the `/projects` directory so all new files created within it inherit the `developers` group ownership
3. Configure permissions so that:
- Members of the `developers` group can create files in the directory
- Only file owners can delete their own files (using the sticky bit)
- Users outside the `developers` group cannot access the directory
4. Create a file `/projects/readme.md` with the content "Development Projects Directory"
5. Set ACLs on the `/projects` directory to give user `dev1` full control, while `dev2` and `dev3` have read and execute permissions only
### Task 3: LVM Storage Configuration
1. Create a 2GB partition on an available disk
2. Create a volume group named `vg_projects` using this partition
3. Create two logical volumes in the `vg_projects` volume group:
- `lv_data` (800MB)
- `lv_backup` (400MB)
4. Format `lv_data` with XFS filesystem and `lv_backup` with ext4 filesystem
5. Mount `lv_data` at `/projects/data` and `lv_backup` at `/projects/backup` permanently
6. Configure the system to automatically snapshot `lv_data` daily (hint: you'll need to leave free space in the volume group)
### Task 4: Storage with VDO and Stratis
1. Install the necessary packages for VDO (Virtual Data Optimizer)
2. Create a 1GB partition on an available disk
3. Configure VDO on this partition with a logical size of 3GB
4. Format the VDO volume with XFS and mount it at `/vdo` permanently
5. Install the Stratis storage management tools
6. Create a Stratis pool named `stratis_pool` using another 1GB partition
7. Create a Stratis filesystem named `stratis_fs` and mount it at `/stratis` permanently
### Task 5: Advanced Container Management
1. Install the container tools (podman)
2. Configure a persistent container storage location at `/container_storage`
3. Pull the MariaDB container image
4. Run a MariaDB container named `db_server` with:
- The container accessible on port 3306
- A root password of `dbpassword`
- A persistent volume at `/container_storage/mysql_data` mounted to the container's `/var/lib/mysql`
- Environment variables set for a database named `webapp` and a database user `webuser` with password `webpass`
5. Configure the container to start automatically at system boot using systemd
6. Create a simple bash script `/usr/local/bin/db_backup.sh` that creates a backup of the MariaDB container data
### Task 6: Automating System Tasks
1. Create a systemd timer that runs a filesystem usage check every 4 hours and logs the results to `/var/log/disk_usage.log`
2. Configure a cron job for the `devops` user to run every Monday at 2:30 AM that:
- Archives files older than 30 days in `/projects/data`
- Moves the archives to `/projects/backup`
3. Configure a systemd service called `project-backup` that:
- Creates a tar archive of the `/projects` directory
- Runs automatically at system shutdown
- Places the backup in `/var/backups` with a timestamp in the filename
### Task 7: System Boot Configuration
1. Configure the system to boot into emergency mode with a 5-second timeout
2. Create a new GRUB menu entry that boots the system with the kernel parameter `enforcing=0`
3. Set the default boot target to multi-user (non-graphical)
4. Create a custom systemd target called `developer-mode.target` that:
- Starts all the services of multi-user target
- Additionally starts the MariaDB container
- Mounts all project-related filesystems
### Task 8: Network Configuration and Services
1. Configure the primary network interface with:
- Static IP: 192.168.10.200/24
- Gateway: 192.168.10.1
- DNS servers: 192.168.10.1 and 8.8.8.8
2. Configure the hostname as `rhcsa-server`
3. Add a second IP address (192.168.10.201/24) to the same interface
4. Install and configure an NFS server that:
- Exports `/projects/data` as read-write to 192.168.10.0/24
- Exports `/projects/backup` as read-only to 192.168.10.0/24
5. Configure the firewall to allow NFS and MariaDB traffic from the local network only
### Task 9: Security Configuration
1. Configure SELinux contexts so that:
- The web server can access files in `/projects/data`
- The MariaDB container can access `/container_storage/mysql_data`
2. Configure SSH to:
- Allow access only for the `devops` user
- Disable password authentication (key-based only)
- Listen on an alternate port (2222)
3. Set up key-based authentication for the `devops` user
4. Configure the firewall to allow SSH on the new port
5. Create a sudo configuration that allows `devops` to run commands as root without a password, but logs all commands
### Task 10: System Analysis and Troubleshooting
1. Configure system logging to:
- Keep logs for 90 days
- Forward system and audit logs to the `rsyslog` service
- Create separate log files for container operations
2. Create a script `/usr/local/bin/system_health.sh` that:
- Checks system load average
- Monitors memory usage
- Verifies connectivity to the gateway
- Reports if any key services are down
- Emails the report to `root@localhost`
3. Create a systemd service and timer to run this health check script every hour
### Task 11: Advanced Shell Scripting
1. Create a script `/usr/local/bin/user_report.sh` that:
- Finds all users in the `developers` group
- Reports their last login time
- Lists all files owned by each user in the `/projects` directory
- Sorts the output by file size
- Saves a formatted report to `/var/reports/user_report.txt`
2. Make the script executable and set up a weekly cron job to run it
3. Create a directory `/var/reports` with appropriate permissions for storing reports
### Task 12: Advanced FileSystem Management
1. Create a 500MB file using `dd` to serve as a loopback device
2. Configure this file as a loopback device
3. Create a LUKS encrypted container on the loopback device
4. Format the encrypted container with XFS
5. Configure the system to automatically unlock the encrypted container at boot using a key file
6. Mount the encrypted filesystem at `/projects/secure` permanently
## Scoring Guide
Each task has approximately equal weight. To pass this mock exam, you need to successfully complete 70% of the tasks.
After completing the exam, test your configurations by:
1. Rebooting the system to verify persistence
2. Logging in as the created users to verify access
3. Testing that services start correctly
4. Verifying container operation
5. Checking encrypted storage and mounts
Good luck with your practice exam!
+117
View File
@@ -0,0 +1,117 @@
# Mock RHCSA (EX200) Practice Exam
## Introduction
This mock exam is designed to help you prepare for the Red Hat Certified System Administrator (RHCSA) exam (EX200). It covers the key objectives outlined in the official exam requirements and will test your practical skills in system administration.
**Exam Guidelines:**
- Duration: 2.5 hours (just like the real exam)
- All tasks must be completed within the allotted time
- Your configurations must persist after reboot
- You may reference Red Hat documentation included with the system
**Exam Environment:**
- Red Hat Enterprise Linux 9
- Virtual machine with 4GB RAM, 20GB disk space
- Internet access is NOT available during the exam
- Root access is available
## Exam Tasks
### Task 1: Essential Tools and User Management
1. Create a user named `analyst` with UID 2525
2. Set the password for `analyst` to `RedHat123`
3. The password should expire after 90 days
4. Create a group named `research` with GID 3535
5. Add the `analyst` user to the `research` group as a secondary group
6. Create a directory `/data/research` owned by `analyst` with group ownership set to `research`
7. Set special permissions on the directory so that all files created in `/data/research` will automatically be owned by the `research` group
### Task 2: File Management and Permissions
1. Create a file `/data/research/readme.txt` with the content "Research data repository"
2. Set permissions on `/data/research/readme.txt` so that:
- The owner has read and write permissions
- The group has read-only permissions
- Others have no permissions
3. Create a hard link named `/home/analyst/data-link` to the readme.txt file
4. Create a soft link named `/home/analyst/data-symlink` to the `/data/research` directory
### Task 3: Storage Configuration
1. Create a 1GB partition on the available disk (check with `lsblk` for available space)
2. Create a volume group named `vg_data` using the partition you created
3. Create a 500MB logical volume named `lv_data` in the `vg_data` volume group
4. Format the logical volume with the XFS filesystem
5. Mount the filesystem at `/mnt/data` permanently (should persist after reboot)
6. Create a 256MB swap partition and enable it permanently
### Task 4: Configure STRATIS Storage
1. Install the STRATIS storage management tools
2. Create a 1GB partition on the available disk
3. Create a STRATIS pool named `pool1` using the partition
4. Create a filesystem named `fs1` in the STRATIS pool
5. Mount the filesystem at `/mnt/stratis` permanently
### Task 5: Container Management
1. Install the container tools (podman)
2. Find and pull the latest httpd container image
3. Run a container named `webserver` using the httpd image with the following specifications:
- The container should be accessible on port 8080 of the host
- The container should start automatically when the system boots
- Create a simple HTML file with the content "RHCSA Practice Exam" accessible through the web server
### Task 6: Service Configuration
1. Install and configure the chronyd service to synchronize time with `time.nist.gov`
2. Configure the chronyd service to start automatically on boot
3. Configure the system to use the timezone America/New_York
### Task 7: System Management
1. Configure the system to boot into the multi-user target by default
2. Create a scheduled task using cron for the `analyst` user that creates a backup of `/etc/passwd` to `/home/analyst/passwd.bak` every day at 3:00 AM
3. Create a systemd timer that runs a script to check disk space and writes the output to `/var/log/diskspace.log` every hour
### Task 8: Networking Configuration
1. Configure the network interface with the following settings:
- IP address: 192.168.1.100/24
- Gateway: 192.168.1.1
- DNS server: 8.8.8.8
- DNS search domain: example.com
2. The configuration should persist after reboot
3. Configure the hostname as `rhcsa-exam`
### Task 9: Security Configuration
1. Configure the firewall to allow HTTP (port 80) and HTTPS (port 443) traffic
2. Configure SELinux to allow the web server to connect to the network
3. Set up SSH key-based authentication for the `analyst` user
4. Configure the system to prevent the root user from logging in via SSH
### Task 10: Storage Expansion
1. Extend the logical volume `lv_data` to 750MB
2. Extend the corresponding XFS filesystem to use the additional space
3. Verify that the filesystem is successfully expanded and functioning correctly
### Task 11: Bash Scripting
1. Create a script named `/usr/local/bin/system_info.sh` that:
- Displays the current system time
- Shows the system hostname
- Lists the current disk usage
- Shows current memory usage
2. Make the script executable
3. Ensure the script runs properly when called without a full path
### Task 12: NFS Configuration
1. Configure the system as an NFS server exporting `/mnt/data` to 192.168.1.0/24 with read-write access
2. Configure the firewall to allow NFS traffic
3. Start the NFS service and ensure it starts automatically on boot
## Scoring Guide
Each task has approximately equal weight. To pass this mock exam (like the real RHCSA), you need to successfully complete 70% of the tasks.
After completing the exam, test your configurations by:
1. Rebooting the system to verify persistence
2. Logging in as the created users
3. Verifying services are running correctly
4. Checking that mounted filesystems are accessible
5. Testing that the container is accessible
Good luck with your practice!
@@ -0,0 +1,62 @@
# RHCSA Practice Scenarios
## Scenario 1: User and Permission Management ✅
Task:
1. Create a new user called 'analyst1' with home directory '/home/analyst1'
2. Create a group called 'datateam'
3. Add 'analyst1' to 'datateam'
4. Create a directory '/data/reports' owned by 'datateam' with SGID set
5. Ensure members of 'datateam' can read/write, others can only read
6. Set password expiry for 'analyst1' to 90 days
## Scenario 2: Storage Management ✅
Task:
1. Create a new 2GB partition on /dev/sdb
2. Create a physical volume from this partition
3. Create a volume group called 'datavg'
4. Create a 1GB logical volume called 'datalv'
5. Format the logical volume with XFS filesystem
6. Mount it persistently at /mnt/data using UUID
7. Extend the logical volume by 500MB
## Scenario 3: Service and Security Management ✅
Task:
1. Configure chronyd to sync with time server 'time.example.com'
2. Configure firewall to allow HTTP (port 80) and HTTPS (port 443)
3. Create an SELinux policy to allow Apache to listen on port 8080
4. Configure SSH to disable root login and only allow key-based authentication
5. Set up a cron job to run system updates every Sunday at 2 AM
## Scenario 4: Container Management ✅
Task:
1. Pull the latest nginx container image from registry.access.redhat.com
2. Create a persistent volume at /data/web
3. Run nginx container with the persistent volume mounted at /usr/share/nginx/html
4. Configure the container to start automatically on boot
5. Expose the container on port 8080
## Scenario 5: System Recovery and Maintenance
Task:
1. Reset root password using emergency mode
2. Identify and kill a process consuming excessive CPU
3. Configure system to boot into multi-user target by default
4. Configure autofs to automatically mount an NFS share
5. Create a backup of /etc using tar with bzip2 compression
## Scenario 6: Shell Scripting
Create a script that:
1. Accepts a directory path as an argument
2. Finds all files larger than 100MB
3. Creates a report of these files including size and last modified date
4. Archives files older than 30 days into a tar.gz file
5. Logs all actions to /var/log/cleanup.log
## Scenario 7: Network Configuration
Task:
1. Configure static IPv4 address: 192.168.1.100/24
2. Configure static IPv6 address: 2001:db8:1234:5678::100/64
3. Set hostname to 'rhcsa.example.com'
4. Configure DNS resolution using /etc/resolv.conf
5. Implement network access restrictions using firewalld zones
Each scenario tests multiple objectives from the exam requirements. Would you like to work through any specific scenario with detailed steps?
@@ -0,0 +1,75 @@
# RHCSA Practice Scenarios - Version 2
## Scenario 1: System Access and File Management
Task:
1. Configure SSH to listen on port 2222 instead of default 22
2. Create a user 'devops1' with custom shell /bin/bash
3. Set up password-less SSH authentication for 'devops1'
4. Create directory structure /opt/projects with subdirectories dev, test, prod
5. Configure appropriate permissions where only devops1 can access prod
6. Create both soft and hard links for important config files
## Scenario 2: Storage Configuration
Task:
1. Create three 1GB partitions on /dev/sdc using GPT
2. Set up LVM using these partitions
3. Create a volume group named 'appvg'
4. Create two logical volumes: 'applv' (2GB) and 'logslv' (1GB)
5. Format applv with ext4 and logslv with xfs
6. Configure persistent mounts using labels
7. Add a new swap partition of 2GB
## Scenario 3: Process and Service Management
Task:
1. Configure system to start in graphical.target
2. Set up Apache web server to start at boot
3. Create a systemd service for a custom application
4. Configure process nice levels for specific applications
5. Set up logging rotation for application logs
6. Configure journald for persistent logging
## Scenario 4: Container Operations
Task:
1. Pull MariaDB container from registry.redhat.io
2. Configure persistent storage for database files
3. Create a pod with both MariaDB and phpMyAdmin
4. Configure container networking for internal communication
5. Set up automatic container restart policies
6. Create a systemd service file for the pod
## Scenario 5: Security Implementation
Task:
1. Configure SELinux for a custom web application running on port 8443
2. Set up firewalld rich rules to allow access only from specific IP range
3. Implement file access controls using ACLs
4. Configure sudo access for specific commands
5. Set up password complexity requirements
6. Configure SELinux boolean settings for web services
## Scenario 6: Automation Script
Create a script that:
1. Monitors disk space usage
2. Sends alerts when filesystems exceed 80% usage
3. Automatically cleans up /tmp older than 7 days
4. Generates daily system health report
5. Uses getopts for command line options
## Scenario 7: Network and Storage Troubleshooting
Task:
1. Diagnose and repair failed NFS mounts
2. Recover from a failed LVM configuration
3. Fix network connectivity issues
4. Restore correct SELinux contexts after file restoration
5. Configure autofs for user home directories
6. Set up network teaming for redundancy
## Scenario 8: System Maintenance
Task:
1. Configure local repository for package management
2. Set up automated security updates
3. Configure logrotate for custom application logs
4. Create a backup strategy for system configuration
5. Schedule system maintenance tasks using cron and at
6. Configure time synchronization with multiple time sources
Each scenario is designed to integrate multiple exam objectives and simulate real-world tasks. Would you like detailed steps for any particular scenario?
@@ -0,0 +1,121 @@
# RHCSA Practice Scenarios - Version 3
## Scenario 1: Advanced User Management
Task:
1. Create a departmental structure with groups: 'engineering', 'qa', and 'ops'
2. Add users 'eng1', 'eng2', 'qa1', 'ops1' to respective groups
3. Configure shared directory /opt/shared with:
- Engineering can read/write their directory
- QA can read engineering, read/write QA directory
- Ops can read/write all directories
4. Implement password policies:
- Minimum 12 characters
- Maximum age 60 days
- Warning 7 days before expiry
## Scenario 2: Dynamic Storage Management
Task:
1. Set up a 4GB partition using GPT on /dev/sdd
2. Create a VDO volume with 3:1 compression ratio
3. Create LVM structure on top of VDO
4. Configure thin provisioning for development environments
5. Create a 2GB XFS filesystem with quota support
6. Implement user and group quotas
7. Configure automated filesystem growth triggers
## Scenario 3: Boot Management and Recovery
Task:
1. Configure system with multiple boot targets
2. Create a custom boot target for minimal services
3. Configure GRUB2 with password protection
4. Set up system to boot with specific kernel parameters
5. Create a recovery procedure for:
- Forgotten root password
- Failed boot
- Corrupted GRUB
6. Configure crash dump collection
## Scenario 4: Advanced Container Deployment
Task:
1. Create a multi-container application using podman
2. Configure container health checks
3. Set up container networking with port mapping
4. Implement container resource limits
5. Create persistent storage for containers
6. Configure logging drivers
7. Set up container monitoring
## Scenario 5: Comprehensive Security Setup
Task:
1. Implement a complete SELinux security strategy:
- Custom policy module
- Port definitions
- File contexts
- Boolean settings
2. Configure firewalld with:
- Multiple zones
- Custom services
- Forward ports
- Rich rules
3. Set up SSH with:
- Custom port
- AllowUsers configuration
- Rate limiting
- Key-based authentication only
## Scenario 6: System Automation
Create scripts for:
1. System inventory script that:
- Lists all installed packages
- Shows disk usage
- Reports running services
- Checks SELinux status
2. Backup script that:
- Uses tar with incremental backups
- Implements retention policy
- Verifies backup integrity
- Logs all operations
## Scenario 7: Network Services Configuration
Task:
1. Configure network with:
- Bonded interface with active-backup
- VLAN configuration
- Static routes
2. Set up DNS resolution with:
- Multiple DNS servers
- Search domains
- Local host entries
3. Implement network security with:
- TCP Wrappers
- IPtables rules
- Fail2ban configuration
## Scenario 8: Advanced File System Management
Task:
1. Create a stratis storage pool
2. Configure automated NFS mounts with autofs
3. Set up ACL configurations for:
- Default permissions
- User-specific access
- Group collaboration
4. Implement file system encryption
5. Configure file system compression
6. Set up file system snapshots
## Scenario 9: Service Management and Monitoring
Task:
1. Configure systemd services with:
- Dependencies
- Custom environment files
- Restart policies
2. Set up service monitoring with:
- Custom status checks
- Email notifications
- Automatic recovery
3. Implement logging with:
- Remote syslog
- Custom journald configuration
- Log forwarding
Each scenario integrates multiple exam objectives and provides real-world challenges. Would you like detailed steps for any particular scenario?
@@ -0,0 +1,155 @@
# RHCSA Practice Scenarios - Version 4
## Scenario 1: Disaster Recovery Planning
Task:
1. Create a backup strategy for:
- System configuration files (/etc)
- User home directories
- Custom application data
2. Implement backup script using:
- tar with exclude patterns
- Different compression methods (gzip vs bzip2)
- Verification checksums
3. Configure backup rotation:
- Daily incremental
- Weekly full
- Monthly archives
4. Test recovery procedures
## Scenario 2: Advanced Storage Architecture
Task:
1. Create a tiered storage setup:
- Fast SSD partition for databases (/dev/nvme0n1)
- HDD partition for archives (/dev/sdb)
2. Configure LVM:
- Create volume group 'datavg' spanning both devices
- Create logical volumes with different stripe sizes
- Implement LVM caching using SSD
3. Set up filesystem:
- XFS for database volume with optimal parameters
- Ext4 for archive volume with large file support
4. Configure automated storage monitoring
## Scenario 3: Multi-User Environment Setup
Task:
1. Create departmental structure:
- Research team (researchers, analysts)
- IT team (admins, support)
- Management (managers, directors)
2. Configure shared workspace:
- /projects/research (SGID, collaborative)
- /projects/it (restricted access)
- /projects/management (confidential)
3. Implement access controls:
- File ACLs for specific user access
- Umask settings per department
- Special permissions for project leads
## Scenario 4: Service High Availability
Task:
1. Configure critical services:
- Apache web server with custom configuration
- MariaDB database with specific port
- Custom application service
2. Implement service monitoring:
- Create systemd service files with dependencies
- Configure service recovery options
- Set up notification for service failures
3. Create failover procedures:
- Service restart automation
- Backup service configuration
- Recovery documentation
## Scenario 5: Container Orchestration
Task:
1. Set up development environment:
- Create pod with multiple containers
- Configure inter-container networking
- Set up shared storage volumes
2. Implement container security:
- SELinux contexts for containers
- Resource limitations
- Network isolation
3. Create deployment automation:
- Container health checks
- Automatic updates
- Backup procedures
## Scenario 6: Network Security Implementation
Task:
1. Configure secure network access:
- Set up SSH jump host
- Implement port knocking
- Configure fail2ban
2. Set up firewall rules:
- Create custom zones
- Configure service-specific rules
- Implement rate limiting
3. Monitor network security:
- Configure logging
- Set up alerts
- Create security reports
## Scenario 7: System Performance Tuning
Task:
1. Optimize system performance:
- Configure tuned profiles
- Adjust process priorities
- Set resource limits
2. Monitor system resources:
- Create monitoring scripts
- Set up performance alerts
- Configure resource quotas
3. Implement performance logging:
- Configure performance metrics
- Create trending reports
- Set up automated analysis
## Scenario 8: Automated System Maintenance
Create scripts for:
1. System health check:
- Disk space monitoring
- Service status verification
- Log analysis
- Performance metrics collection
2. Maintenance tasks:
- Log rotation and cleanup
- Temporary file cleanup
- Cache clearing
- System updates
3. Reporting:
- Daily status emails
- Weekly performance reports
- Monthly trend analysis
## Scenario 9: SELinux Management
Task:
1. Configure SELinux for custom application:
- Create custom policy module
- Set up file contexts
- Configure port labels
2. Troubleshoot SELinux issues:
- Analyze audit logs
- Debug policy violations
- Create policy fixes
3. Implement SELinux best practices:
- Boolean management
- Context verification
- Policy testing
## Scenario 10: Advanced File System Operations
Task:
1. Implement advanced storage features:
- Configure deduplication
- Set up compression
- Enable quotas
2. Create filesystem snapshots:
- LVM snapshots
- Filesystem-level snapshots
- Backup integration
3. Configure automated maintenance:
- Periodic defragmentation
- Integrity checking
- Performance optimization
Each scenario tests multiple exam objectives while presenting realistic system administration challenges.
@@ -0,0 +1,168 @@
# RHCSA Practice Scenarios - Version 5
## Scenario 1: Emergency System Recovery
Task:
1. Recover from failed boot scenarios:
- Reset root password without boot media
- Repair corrupted fstab entries
- Fix incorrect GRUB configuration
2. Implement recovery procedures for:
- Broken network configuration
- Failed LVM setup
- Corrupted file permissions
3. Create emergency documentation:
- Recovery steps for each scenario
- Required commands and procedures
- Verification methods
## Scenario 2: Advanced Storage Integration
Task:
1. Configure multi-level storage:
- Set up /dev/sdc with 3 partitions (GPT)
- Create RAID1 using /dev/sdd1 and /dev/sde1
- Implement LVM on top of RAID
2. Configure storage hierarchy:
- /apps (XFS, 10GB)
- /data (Ext4, 20GB)
- /backup (XFS with quota)
3. Implement automated management:
- Storage monitoring
- Alert system
- Expansion procedures
## Scenario 3: Comprehensive User Environment
Task:
1. Set up development environment:
- Create users: dev1, dev2, dev3
- Configure groups: developers, testers, deployers
- Set up project directories with appropriate permissions
2. Implement access controls:
- Configure sudo access per group
- Set up restricted shells where needed
- Create shared directories with SGID
3. Configure user environment:
- Custom shell profiles
- Group-specific environment variables
- Access control lists
## Scenario 4: Service Integration
Task:
1. Configure web services:
- Apache with custom virtual hosts
- Nginx as reverse proxy
- PHP-FPM integration
2. Implement security measures:
- SELinux contexts for web services
- Custom firewall rules
- SSL certificate configuration
3. Set up monitoring:
- Service status checks
- Resource usage monitoring
- Log analysis
## Scenario 5: Container Development Environment
Task:
1. Create development containers:
- Frontend container (Nginx)
- Backend container (Python)
- Database container (PostgreSQL)
2. Configure container networking:
- Internal network for container communication
- Port mapping for external access
- DNS resolution between containers
3. Implement persistence:
- Volume mounts for data
- Configuration persistence
- Log management
## Scenario 6: Network Security Hardening
Task:
1. Implement secure access:
- Configure SSH with security best practices
- Set up IP-based access controls
- Implement connection rate limiting
2. Configure advanced firewall:
- Multiple zone configuration
- Custom service definitions
- Rich rules for complex scenarios
3. Set up monitoring:
- Failed access attempts
- Service availability
- Network performance
## Scenario 7: Automated System Administration
Create automation for:
1. User management:
- Bulk user creation/modification
- Group membership management
- Password policy enforcement
2. System maintenance:
- Automated updates
- Security scans
- Performance optimization
3. Reporting system:
- System health reports
- Security audit reports
- Resource utilization trends
## Scenario 8: Storage Performance Optimization
Task:
1. Optimize storage performance:
- Configure I/O scheduling
- Implement disk caching
- Set up read-ahead values
2. Monitor storage metrics:
- I/O statistics
- Throughput measurements
- Latency monitoring
3. Implement improvements:
- Performance tuning
- Resource allocation
- Bottleneck resolution
## Scenario 9: Security Compliance
Task:
1. Implement security policies:
- Password complexity requirements
- Account lockout policies
- Session timeout settings
2. Configure SELinux:
- Custom policy modules
- Port definitions
- File contexts
3. Set up security monitoring:
- Audit configuration
- Log analysis
- Compliance reporting
## Scenario 10: System Backup and Recovery
Task:
1. Implement backup strategy:
- System configuration backup
- User data backup
- Database backup
2. Configure automation:
- Scheduled backups
- Verification procedures
- Retention policies
3. Create recovery procedures:
- Full system recovery
- Individual file recovery
- Service restoration
## Scenario 11: Performance Monitoring and Tuning
Task:
1. Configure system monitoring:
- CPU usage tracking
- Memory utilization
- I/O performance
2. Implement tuning:
- Process priority adjustment
- Resource limits
- System profile optimization
3. Set up reporting:
- Performance metrics
- Threshold alerts
- Trend analysis
Each scenario integrates multiple exam objectives while presenting realistic administrative challenges.
+168
View File
@@ -0,0 +1,168 @@
# RHCSA Practice Scenarios - Version 5
## Scenario 1: Emergency System Recovery
Task:
1. Recover from failed boot scenarios:
- Reset root password without boot media
- Repair corrupted fstab entries
- Fix incorrect GRUB configuration
2. Implement recovery procedures for:
- Broken network configuration
- Failed LVM setup
- Corrupted file permissions
3. Create emergency documentation:
- Recovery steps for each scenario
- Required commands and procedures
- Verification methods
## Scenario 2: Advanced Storage Integration
Task:
1. Configure multi-level storage:
- Set up /dev/sdc with 3 partitions (GPT)
- Create RAID1 using /dev/sdd1 and /dev/sde1
- Implement LVM on top of RAID
2. Configure storage hierarchy:
- /apps (XFS, 10GB)
- /data (Ext4, 20GB)
- /backup (XFS with quota)
3. Implement automated management:
- Storage monitoring
- Alert system
- Expansion procedures
## Scenario 3: Comprehensive User Environment
Task:
1. Set up development environment:
- Create users: dev1, dev2, dev3
- Configure groups: developers, testers, deployers
- Set up project directories with appropriate permissions
2. Implement access controls:
- Configure sudo access per group
- Set up restricted shells where needed
- Create shared directories with SGID
3. Configure user environment:
- Custom shell profiles
- Group-specific environment variables
- Access control lists
## Scenario 4: Service Integration
Task:
1. Configure web services:
- Apache with custom virtual hosts
- Nginx as reverse proxy
- PHP-FPM integration
2. Implement security measures:
- SELinux contexts for web services
- Custom firewall rules
- SSL certificate configuration
3. Set up monitoring:
- Service status checks
- Resource usage monitoring
- Log analysis
## Scenario 5: Container Development Environment
Task:
1. Create development containers:
- Frontend container (Nginx)
- Backend container (Python)
- Database container (PostgreSQL)
2. Configure container networking:
- Internal network for container communication
- Port mapping for external access
- DNS resolution between containers
3. Implement persistence:
- Volume mounts for data
- Configuration persistence
- Log management
## Scenario 6: Network Security Hardening
Task:
1. Implement secure access:
- Configure SSH with security best practices
- Set up IP-based access controls
- Implement connection rate limiting
2. Configure advanced firewall:
- Multiple zone configuration
- Custom service definitions
- Rich rules for complex scenarios
3. Set up monitoring:
- Failed access attempts
- Service availability
- Network performance
## Scenario 7: Automated System Administration
Create automation for:
1. User management:
- Bulk user creation/modification
- Group membership management
- Password policy enforcement
2. System maintenance:
- Automated updates
- Security scans
- Performance optimization
3. Reporting system:
- System health reports
- Security audit reports
- Resource utilization trends
## Scenario 8: Storage Performance Optimization
Task:
1. Optimize storage performance:
- Configure I/O scheduling
- Implement disk caching
- Set up read-ahead values
2. Monitor storage metrics:
- I/O statistics
- Throughput measurements
- Latency monitoring
3. Implement improvements:
- Performance tuning
- Resource allocation
- Bottleneck resolution
## Scenario 9: Security Compliance
Task:
1. Implement security policies:
- Password complexity requirements
- Account lockout policies
- Session timeout settings
2. Configure SELinux:
- Custom policy modules
- Port definitions
- File contexts
3. Set up security monitoring:
- Audit configuration
- Log analysis
- Compliance reporting
## Scenario 10: System Backup and Recovery
Task:
1. Implement backup strategy:
- System configuration backup
- User data backup
- Database backup
2. Configure automation:
- Scheduled backups
- Verification procedures
- Retention policies
3. Create recovery procedures:
- Full system recovery
- Individual file recovery
- Service restoration
## Scenario 11: Performance Monitoring and Tuning
Task:
1. Configure system monitoring:
- CPU usage tracking
- Memory utilization
- I/O performance
2. Implement tuning:
- Process priority adjustment
- Resource limits
- System profile optimization
3. Set up reporting:
- Performance metrics
- Threshold alerts
- Trend analysis
Each scenario integrates multiple exam objectives while presenting realistic administrative challenges.
+1056 -21
View File
File diff suppressed because it is too large Load Diff
+71
View File
@@ -0,0 +1,71 @@
# My RHCSA Practice Solutions Portfolio
Welcome to my RHCSA practice solutions portfolio. This section documents my hands-on experience solving various Linux system administration scenarios. Each solution demonstrates my practical skills and approach to real-world problems.
## Solutions Categories
This portfolio is organized into the following categories:
| Category | Icon | Description | Related Scenarios |
|----------|------|-------------|-------------------|
| **User Management** | 👤 | User creation, permissions, group management | v1-S1, v2-S1, v3-S1 |
| **Storage Management** | 💾 | Partitioning, LVM, filesystem management | v1-S2, v2-S2, v3-S2, v3-S8 |
| **Service Management** | ⚙️ | Service configuration, systemd, process control | v1-S3 (partial), v2-S3, v3-S9 |
| **Networking** | 🌐 | Interface configuration, routing, DNS | v1-S7, v2-S7, v3-S7 |
| **Security** | 🔒 | SELinux, firewalld, SSH hardening | v1-S3 (partial), v2-S5, v3-S5 |
| **Container Management** | 📦 | Podman, container configuration | v1-S4, v2-S4, v3-S4 |
| **System Recovery & Maintenance** | 🔧 | Boot management, troubleshooting | v1-S5, v2-S8, v3-S3 |
| **Shell Scripting** | 📜 | Automation, system monitoring | v1-S6, v2-S6, v3-S6 |
## Scenario Reference System
Each scenario solution is tagged with a reference code that makes it easy to identify:
- **v1-S1**: Version 1, Scenario 1
- **v2-S3**: Version 2, Scenario 3
- **v3-S5**: Version 3, Scenario 5
## Solution Documentation Format
When documenting a solution, I follow this format:
```markdown
# Scenario Title
## Original Problem
[Description of the scenario]
## Environment
- OS Version:
- Initial State:
- Required Outcome:
## Solution Steps
1. Step 1
```bash
# Command used
```
Explanation of what this command does
2. Step 2
```bash
# Command used
```
Explanation of what this command does
## Verification
Commands used to verify the solution works correctly
## Key Learnings
- Learning point 1
- Learning point 2
## Additional Notes
Any extra information or alternative approaches
```
## Skills Demonstrated
- System Administration
- Problem-Solving
- Documentation
- Best Practices Implementation
- Security Awareness
+170
View File
@@ -0,0 +1,170 @@
# Container Management Solutions [📦]
This section documents my solutions to container-related scenarios, including Podman/Docker management, container networking, and persistent storage.
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S4] | Container Management - Practice Scenarios v1 |
| [v2-S4] | Container Operations - Practice Scenarios v2 |
| [v3-S4] | Advanced Container Deployment - Practice Scenarios v3 |
## Scenario: [v1-S4] Container Management
### Original Problem
From Practice Scenarios v1, Scenario 4:
1. Pull the latest nginx container image from registry.access.redhat.com
2. Create a persistent volume at /data/web
3. Run nginx container with the persistent volume mounted at /usr/share/nginx/html
4. Configure the container to start automatically on boot
5. Expose the container on port 8080
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Clean system with Podman installed
- Required Outcome: Running nginx container with persistent storage that starts on boot
### Solution Steps
1. Pull the nginx container image
```bash
podman pull nginx:latest
```
This command pulls the latest nginx container image from the registry.access.redhat.com registry.
2. Create and configure the persistent volume
```bash
podman volume create webdata
```
This command creates a persistent volume named webdata.
3. Run the container with the volume mounted
```bash
podman run -d --name web-server -v webdata:/usr/share/nginx/html -p 8080:80 nginx:latest
```
This command runs the nginx container with the webdata volume mounted at /usr/share/nginx/html and exposes it on port 8080.
4. Configure automatic startup
```bash
podman generate systemd --new --name web-server # Generate systemd service file
mv web-server.service ~/.config/systemd/user/ # Move service file to user systemd directory
systemctl --user enable web-server # Enable service to start on boot
systemctl --user start web-server # Start service immediately
```
This command generates a systemd service file for the web-server container.
### Verification
```bash
podman ps
```
This command lists all running containers.
### Key Learnings
- Podman configuration for container management and persistence
- Systemd service configuration for container auto-start
- Container networking and port mapping
## Skills Demonstrated
- Container Management
- Volume Configuration
- System Integration
- Container Security
## Scenario: [v2-S4] Container Operations
### Original Problem
From Practice Scenarios v2, Scenario 4:
1. Pull MariaDB container from registry.redhat.io
2. Configure persistent storage for database files
3. Create a pod with both MariaDB and phpMyAdmin
4. Configure container networking for internal communication
5. Set up automatic container restart policies
6. Create a systemd service file for the pod
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Clean system with Podman installed
- Required Outcome: Fully functional MariaDB and phpMyAdmin deployment with persistence and auto-restart
### Solution Steps
1. Pull container images
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. Configure persistent storage
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Create and configure pod
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Set up systemd service
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
## Scenario: [v3-S4] Advanced Container Deployment
### Original Problem
From Practice Scenarios v3, Scenario 4:
1. Create a multi-container application using podman
2. Configure container health checks
3. Set up container networking with port mapping
4. Implement container resource limits
5. Create persistent storage for containers
6. Configure logging drivers
7. Set up container monitoring
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Clean system with Podman installed
- Required Outcome: Production-ready multi-container application with monitoring, resource limits, and health checks
### Solution Steps
1. Design container architecture
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. Configure container networking
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Implement resource limits and health checks
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Set up monitoring and logging
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
+614
View File
@@ -0,0 +1,614 @@
# Mock RHCSA Exam v2 - Solutions
This document provides solutions for the [Mock RHCSA Exam - Version 2](../practice-scenarios/mock-rhcsa-exam-v2.md). Use these solutions to check your work after attempting the exam yourself.
## Task 1: User and Group Management
```bash
# Create user with specific UID
sudo useradd -u 3030 devops
# Set password
sudo passwd devops
# Enter DevOps2023 when prompted
# Set account expiration date
sudo chage -E 2023-12-31 devops
# Create group with specific GID
sudo groupadd -g 4040 developers
# Create users with developers as primary group
sudo useradd -g developers dev1
sudo useradd -g developers dev2
sudo useradd -g developers dev3
# Set default group for new users
sudo sed -i 's/^GROUP=.*/GROUP=developers/' /etc/default/useradd
# Configure password expiration for developers group members
for user in $(grep "developers" /etc/group | cut -d: -f4 | tr ',' ' '); do
sudo chage -M 60 $user
done
```
## Task 2: File System Management
```bash
# Create directory with proper ownership
sudo mkdir -p /projects
sudo chown devops:developers /projects
# Set SGID bit for group inheritance
sudo chmod 2775 /projects
# Set sticky bit and appropriate permissions
# 2 = SGID, 7 = rwx for owner, 7 = rwx for group, 5 = r-x for others
# t (sticky bit) makes it so only owners can delete their files
sudo chmod 2775 /projects
sudo chmod +t /projects
# Create file with content
echo "Development Projects Directory" | sudo tee /projects/readme.md
# Set ACLs
sudo setfacl -m u:dev1:rwx /projects
sudo setfacl -m u:dev2:r-x /projects
sudo setfacl -m u:dev3:r-x /projects
```
## Task 3: LVM Storage Configuration
```bash
# Check available disks
lsblk
# Create partition (assuming /dev/sdb is available)
sudo fdisk /dev/sdb
# n (new), p (primary), 1 (partition number), enter (default), +2G, w (write)
# Create volume group
sudo vgcreate vg_projects /dev/sdb1
# Create logical volumes
sudo lvcreate -L 800M -n lv_data vg_projects
sudo lvcreate -L 400M -n lv_backup vg_projects
# Format filesystems
sudo mkfs.xfs /dev/vg_projects/lv_data
sudo mkfs.ext4 /dev/vg_projects/lv_backup
# Create mount points
sudo mkdir -p /projects/data /projects/backup
# Add to fstab for persistence
echo "/dev/vg_projects/lv_data /projects/data xfs defaults 0 0" | sudo tee -a /etc/fstab
echo "/dev/vg_projects/lv_backup /projects/backup ext4 defaults 0 0" | sudo tee -a /etc/fstab
# Mount filesystems
sudo mount -a
# Configure daily snapshots
# Create a script for creating and managing snapshots
cat << 'EOF' | sudo tee /usr/local/bin/lvm_snapshot.sh
#!/bin/bash
# Create a snapshot with date in the name
DATE=$(date +%Y%m%d)
# Remove old snapshots
sudo lvremove -f /dev/vg_projects/lv_data_snap_* 2>/dev/null
# Create new snapshot (100MB size)
sudo lvcreate -L 100M -s -n lv_data_snap_$DATE /dev/vg_projects/lv_data
EOF
# Make script executable
sudo chmod +x /usr/local/bin/lvm_snapshot.sh
# Create cron job for daily snapshots
echo "0 1 * * * root /usr/local/bin/lvm_snapshot.sh" | sudo tee /etc/cron.d/lvm-snapshots
```
## Task 4: Storage with VDO and Stratis
```bash
# Install VDO packages
sudo dnf install -y vdo kmod-kvdo
# Create a partition (assuming /dev/sdc is available)
sudo fdisk /dev/sdc
# n (new), p (primary), 1 (partition number), enter (default), +1G, w (write)
# Create VDO volume
sudo vdo create --name=vdo_vol1 --device=/dev/sdc1 --vdoLogicalSize=3G
# Format VDO volume with XFS
sudo mkfs.xfs -K /dev/mapper/vdo_vol1
# Create mount point
sudo mkdir -p /vdo
# Add to fstab for persistence
echo "/dev/mapper/vdo_vol1 /vdo xfs defaults,x-systemd.requires=vdo.service 0 0" | sudo tee -a /etc/fstab
# Mount VDO
sudo mount -a
# Install Stratis
sudo dnf install -y stratisd stratis-cli
# Create a partition (assuming /dev/sdd is available)
sudo fdisk /dev/sdd
# n (new), p (primary), 1 (partition number), enter (default), +1G, w (write)
# Start Stratis service
sudo systemctl enable --now stratisd
# Create Stratis pool
sudo stratis pool create stratis_pool /dev/sdd1
# Create Stratis filesystem
sudo stratis filesystem create stratis_pool stratis_fs
# Create mount point
sudo mkdir -p /stratis
# Add to fstab for persistence
# Get UUID for the stratis filesystem
STRATIS_UUID=$(sudo stratis filesystem list | grep stratis_fs | awk '{print $4}')
echo "UUID=$STRATIS_UUID /stratis xfs defaults,x-systemd.requires=stratisd.service 0 0" | sudo tee -a /etc/fstab
# Mount Stratis
sudo mount -a
```
## Task 5: Advanced Container Management
```bash
# Install container tools
sudo dnf install -y podman
# Create persistent storage location
sudo mkdir -p /container_storage/mysql_data
sudo chown -R 27:27 /container_storage/mysql_data # MySQL standard user/group ID
# Pull MariaDB image
sudo podman pull mariadb:latest
# Run MariaDB container
sudo podman run -d --name db_server \
-p 3306:3306 \
-v /container_storage/mysql_data:/var/lib/mysql:Z \
-e MYSQL_ROOT_PASSWORD=dbpassword \
-e MYSQL_DATABASE=webapp \
-e MYSQL_USER=webuser \
-e MYSQL_PASSWORD=webpass \
mariadb:latest
# Create systemd service for auto-start
sudo mkdir -p /etc/systemd/system
sudo podman generate systemd --name db_server --files --new
# Copy and enable the service
sudo cp container-db_server.service /etc/systemd/system/
sudo systemctl enable container-db_server.service
# Create backup script
cat << 'EOF' | sudo tee /usr/local/bin/db_backup.sh
#!/bin/bash
DATE=$(date +%Y%m%d)
BACKUP_DIR="/container_storage/backups"
mkdir -p $BACKUP_DIR
sudo podman exec db_server mysqldump -u root -pdbpassword --all-databases > $BACKUP_DIR/mysql_all_$DATE.sql
find $BACKUP_DIR -name "mysql_all_*.sql" -mtime +7 -delete
EOF
# Make script executable
sudo chmod +x /usr/local/bin/db_backup.sh
```
## Task 6: Automating System Tasks
```bash
# Create filesystem usage check script
cat << 'EOF' | sudo tee /usr/local/bin/disk_check.sh
#!/bin/bash
DATE=$(date +"%Y-%m-%d %H:%M:%S")
echo "Filesystem usage report - $DATE" > /var/log/disk_usage.log
df -h >> /var/log/disk_usage.log
echo "----------------------------" >> /var/log/disk_usage.log
EOF
# Make script executable
sudo chmod +x /usr/local/bin/disk_check.sh
# Create systemd service
cat << 'EOF' | sudo tee /etc/systemd/system/disk-check.service
[Unit]
Description=Check disk usage
[Service]
Type=oneshot
ExecStart=/usr/local/bin/disk_check.sh
EOF
# Create systemd timer
cat << 'EOF' | sudo tee /etc/systemd/system/disk-check.timer
[Unit]
Description=Run disk usage check every 4 hours
[Timer]
OnBootSec=10min
OnUnitActiveSec=4h
[Install]
WantedBy=timers.target
EOF
# Enable and start timer
sudo systemctl enable --now disk-check.timer
# Create archive script for cron job
cat << 'EOF' | sudo tee /usr/local/bin/archive_old_files.sh
#!/bin/bash
DATE=$(date +%Y%m%d)
find /projects/data -type f -mtime +30 -print0 | xargs -0 tar czf /projects/backup/old_files_$DATE.tar.gz 2>/dev/null
find /projects/data -type f -mtime +30 -delete
EOF
# Make script executable
sudo chmod +x /usr/local/bin/archive_old_files.sh
# Create cron job for devops user
sudo -u devops crontab -l > /tmp/devops-crontab
echo "30 2 * * 1 /usr/local/bin/archive_old_files.sh" >> /tmp/devops-crontab
sudo -u devops crontab /tmp/devops-crontab
rm /tmp/devops-crontab
# Create project backup script
cat << 'EOF' | sudo tee /usr/local/bin/backup-projects.sh
#!/bin/bash
DATE=$(date +%Y%m%d-%H%M%S)
mkdir -p /var/backups
tar czf /var/backups/projects-$DATE.tar.gz /projects
EOF
# Make script executable
sudo chmod +x /usr/local/bin/backup-projects.sh
# Create systemd service for shutdown backup
cat << 'EOF' | sudo tee /etc/systemd/system/project-backup.service
[Unit]
Description=Backup projects directory
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup-projects.sh
TimeoutStartSec=0
[Install]
WantedBy=shutdown.target reboot.target halt.target
EOF
# Enable the service
sudo systemctl enable project-backup.service
```
## Task 7: System Boot Configuration
```bash
# Edit grub configuration
sudo cp /etc/default/grub /etc/default/grub.backup
sudo sed -i 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=5/' /etc/default/grub
sudo sed -i 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="rd.break"/' /etc/default/grub
# Create custom menu entry
cat << 'EOF' | sudo tee /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.
menuentry 'RHEL 9 with SELinux Permissive' {
linux /boot/vmlinuz-$(uname -r) root=/dev/mapper/rhel-root ro enforcing=0
initrd /boot/initramfs-$(uname -r).img
}
EOF
# Update grub configuration
sudo chmod +x /etc/grub.d/40_custom
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
# Set default target
sudo systemctl set-default multi-user.target
# Create custom systemd target
cat << 'EOF' | sudo tee /etc/systemd/system/developer-mode.target
[Unit]
Description=Developer Mode
Requires=multi-user.target container-db_server.service
After=multi-user.target container-db_server.service
Wants=container-db_server.service
[Install]
WantedBy=multi-user.target
EOF
# Create symlinks for filesystem mounts
sudo ln -sf /usr/lib/systemd/system/local-fs.target /etc/systemd/system/developer-mode.target.wants/
```
## Task 8: Network Configuration and Services
```bash
# Configure network interface (assuming eth0 is the interface name)
sudo nmcli connection add con-name static-eth0 ifname eth0 type ethernet ip4 192.168.10.200/24 gw4 192.168.10.1
sudo nmcli connection modify static-eth0 ipv4.dns "192.168.10.1 8.8.8.8"
sudo nmcli connection up static-eth0
# Add secondary IP
sudo nmcli connection modify static-eth0 +ipv4.addresses 192.168.10.201/24
sudo nmcli connection up static-eth0
# Set hostname
sudo hostnamectl set-hostname rhcsa-server
# Install NFS server
sudo dnf install -y nfs-utils
# Create exports file entries
echo "/projects/data 192.168.10.0/24(rw,sync,no_root_squash)" | sudo tee -a /etc/exports
echo "/projects/backup 192.168.10.0/24(ro,sync)" | sudo tee -a /etc/exports
# Start and enable NFS server
sudo systemctl enable --now nfs-server
# Export the shares
sudo exportfs -ra
# Configure firewall
sudo firewall-cmd --permanent --add-service=nfs
sudo firewall-cmd --permanent --add-service=rpc-bind
sudo firewall-cmd --permanent --add-service=mountd
sudo firewall-cmd --permanent --add-service=mysql
sudo firewall-cmd --permanent --add-source=192.168.10.0/24
sudo firewall-cmd --reload
```
## Task 9: Security Configuration
```bash
# Configure SELinux context for web server access
sudo semanage fcontext -a -t httpd_sys_content_t "/projects/data(/.*)?"
sudo restorecon -Rv /projects/data
# Configure SELinux context for container storage
sudo semanage fcontext -a -t container_file_t "/container_storage/mysql_data(/.*)?"
sudo restorecon -Rv /container_storage/mysql_data
# Configure SSH
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup
sudo sed -i 's/#Port 22/Port 2222/' /etc/ssh/sshd_config
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
# Create AllowUsers directive
echo "AllowUsers devops" | sudo tee -a /etc/ssh/sshd_config
# Set up key-based authentication for devops
sudo -u devops mkdir -p /home/devops/.ssh
sudo -u devops chmod 700 /home/devops/.ssh
sudo -u devops ssh-keygen -t rsa -f /home/devops/.ssh/id_rsa -N ""
sudo -u devops cat /home/devops/.ssh/id_rsa.pub >> /home/devops/.ssh/authorized_keys
sudo -u devops chmod 600 /home/devops/.ssh/authorized_keys
# Configure firewall for SSH
sudo firewall-cmd --permanent --remove-service=ssh
sudo firewall-cmd --permanent --add-port=2222/tcp
sudo firewall-cmd --reload
# Create sudo configuration for devops
echo "devops ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/devops
echo "Defaults:devops logfile=/var/log/devops_sudo.log" | sudo tee -a /etc/sudoers.d/devops
# Restart SSH service
sudo systemctl restart sshd
```
## Task 10: System Analysis and Troubleshooting
```bash
# Configure system logging
sudo cp /etc/rsyslog.conf /etc/rsyslog.conf.backup
# Set log rotation to 90 days
sudo sed -i 's/^\$FileOwner.*/$FileOwner root\n$MaxFileDays 90/' /etc/rsyslog.conf
# Create separate log file for containers
cat << 'EOF' | sudo tee /etc/rsyslog.d/container.conf
if $programname contains 'podman' or $programname contains 'container' then /var/log/container.log
& stop
EOF
# Restart rsyslog
sudo systemctl restart rsyslog
# Create system health check script
cat << 'EOF' | sudo tee /usr/local/bin/system_health.sh
#!/bin/bash
DATE=$(date +"%Y-%m-%d %H:%M:%S")
REPORT_FILE="/tmp/system_health_$$.tmp"
echo "System Health Report - $DATE" > $REPORT_FILE
echo "============================" >> $REPORT_FILE
# Load average
echo "" >> $REPORT_FILE
echo "System Load:" >> $REPORT_FILE
uptime | awk '{print $10 $11 $12}' >> $REPORT_FILE
# Memory usage
echo "" >> $REPORT_FILE
echo "Memory Usage:" >> $REPORT_FILE
free -h >> $REPORT_FILE
# Disk usage
echo "" >> $REPORT_FILE
echo "Disk Usage:" >> $REPORT_FILE
df -h >> $REPORT_FILE
# Network connectivity
echo "" >> $REPORT_FILE
echo "Network Connectivity:" >> $REPORT_FILE
ping -c 1 192.168.10.1 >> $REPORT_FILE 2>&1
# Service status
echo "" >> $REPORT_FILE
echo "Service Status:" >> $REPORT_FILE
systemctl status nfs-server container-db_server | grep Active >> $REPORT_FILE
# Send email
mail -s "System Health Report" root@localhost < $REPORT_FILE
rm $REPORT_FILE
EOF
# Make script executable
sudo chmod +x /usr/local/bin/system_health.sh
# Create systemd service
cat << 'EOF' | sudo tee /etc/systemd/system/system-health.service
[Unit]
Description=System Health Check
[Service]
Type=oneshot
ExecStart=/usr/local/bin/system_health.sh
EOF
# Create systemd timer
cat << 'EOF' | sudo tee /etc/systemd/system/system-health.timer
[Unit]
Description=Run system health check hourly
[Timer]
OnBootSec=5min
OnUnitActiveSec=1h
[Install]
WantedBy=timers.target
EOF
# Enable and start timer
sudo systemctl enable --now system-health.timer
```
## Task 11: Advanced Shell Scripting
```bash
# Create directory for reports
sudo mkdir -p /var/reports
sudo chmod 755 /var/reports
# Create user report script
cat << 'EOF' | sudo tee /usr/local/bin/user_report.sh
#!/bin/bash
REPORT_FILE="/var/reports/user_report.txt"
DATE=$(date +"%Y-%m-%d %H:%M:%S")
echo "User Activity Report - $DATE" > $REPORT_FILE
echo "===============================" >> $REPORT_FILE
# Get all users in the developers group
USERS=$(grep "^developers" /etc/group | cut -d: -f4 | tr ',' ' ')
for user in $USERS; do
echo "" >> $REPORT_FILE
echo "User: $user" >> $REPORT_FILE
echo "----------------" >> $REPORT_FILE
# Last login time
echo "Last Login:" >> $REPORT_FILE
lastlog -u $user | tail -1 >> $REPORT_FILE
# Files owned by user
echo "" >> $REPORT_FILE
echo "Files in /projects owned by $user (sorted by size):" >> $REPORT_FILE
find /projects -user $user -type f -exec ls -lh {} \; | sort -k5 -h >> $REPORT_FILE
done
EOF
# Make script executable
sudo chmod +x /usr/local/bin/user_report.sh
# Create weekly cron job
echo "0 0 * * 0 root /usr/local/bin/user_report.sh" | sudo tee /etc/cron.d/user-report
```
## Task 12: Advanced FileSystem Management
```bash
# Create file for loopback
sudo dd if=/dev/zero of=/root/secure.img bs=1M count=500
# Configure as loopback device
sudo losetup -f /root/secure.img
LOOP_DEV=$(sudo losetup -a | grep secure.img | cut -d: -f1)
# Create key file for encryption
sudo dd if=/dev/urandom of=/root/luks-key bs=512 count=4
sudo chmod 400 /root/luks-key
# Create LUKS encrypted container
sudo cryptsetup luksFormat --batch-mode --key-file=/root/luks-key $LOOP_DEV
# Open LUKS container
sudo cryptsetup luksOpen --key-file=/root/luks-key $LOOP_DEV secure-volume
# Format with XFS
sudo mkfs.xfs /dev/mapper/secure-volume
# Create mount point
sudo mkdir -p /projects/secure
# Configure auto-unlock in crypttab
echo "secure-volume $LOOP_DEV /root/luks-key luks" | sudo tee -a /etc/crypttab
# Add to fstab for persistence
echo "/dev/mapper/secure-volume /projects/secure xfs defaults,x-systemd.requires=cryptsetup.target 0 0" | sudo tee -a /etc/fstab
# Mount
sudo mount -a
```
## Verification Steps
```bash
# Reboot to verify persistence
sudo reboot
# Test user login
su - devops
su - dev1
su - dev2
su - dev3
# Test services
systemctl status nfs-server
systemctl status container-db_server
systemctl status stratisd
systemctl status vdo
# Test file systems
df -h
ls -la /projects
ls -la /projects/data
ls -la /projects/backup
ls -la /projects/secure
ls -la /vdo
ls -la /stratis
# Test container
sudo podman ps
mysql -h 127.0.0.1 -P 3306 -u webuser -pwebpass
# Test encryption
sudo cryptsetup status secure-volume
```
+318
View File
@@ -0,0 +1,318 @@
# Mock RHCSA Exam - Solutions
This document provides solutions for the [Mock RHCSA Exam](../practice-scenarios/mock-rhcsa-exam.md). Use these solutions to check your work after attempting the exam yourself.
## Task 1: Essential Tools and User Management
```bash
# Create user with specific UID
sudo useradd -u 2525 analyst
# Set password and expiration
sudo passwd analyst
# Enter RedHat123 when prompted
sudo chage -M 90 analyst
# Create group with specific GID
sudo groupadd -g 3535 research
# Add user to group as secondary
sudo usermod -aG research analyst
# Create directory with proper ownership
sudo mkdir -p /data/research
sudo chown analyst:research /data/research
# Set SGID bit on directory
sudo chmod g+s /data/research
```
## Task 2: File Management and Permissions
```bash
# Create file with content
echo "Research data repository" | sudo tee /data/research/readme.txt
# Set permissions
sudo chmod 640 /data/research/readme.txt
# Create hard link
sudo ln /data/research/readme.txt /home/analyst/data-link
# Create soft link
sudo ln -s /data/research /home/analyst/data-symlink
```
## Task 3: Storage Configuration
```bash
# Check available disks
lsblk
# Create partition (assuming /dev/sdb is available)
sudo fdisk /dev/sdb
# n (new), p (primary), 1 (partition number), enter (default), +1G, w (write)
# Create volume group
sudo vgcreate vg_data /dev/sdb1
# Create logical volume
sudo lvcreate -L 500M -n lv_data vg_data
# Format with XFS
sudo mkfs.xfs /dev/vg_data/lv_data
# Create mount point
sudo mkdir /mnt/data
# Add to fstab for persistence
echo "/dev/vg_data/lv_data /mnt/data xfs defaults 0 0" | sudo tee -a /etc/fstab
# Mount
sudo mount -a
# Create swap partition (assuming /dev/sdc is available)
sudo fdisk /dev/sdc
# n (new), p (primary), 1 (partition number), enter (default), +256M, t (type), 82 (swap), w (write)
# Format as swap
sudo mkswap /dev/sdc1
# Add to fstab
echo "/dev/sdc1 none swap defaults 0 0" | sudo tee -a /etc/fstab
# Enable swap
sudo swapon -a
```
## Task 4: Configure STRATIS Storage
```bash
# Install STRATIS tools
sudo dnf install -y stratisd stratis-cli
# Create partition (assuming /dev/sdd is available)
sudo fdisk /dev/sdd
# n (new), p (primary), 1 (partition number), enter (default), +1G, w (write)
# Start STRATIS service
sudo systemctl enable --now stratisd
# Create STRATIS pool
sudo stratis pool create pool1 /dev/sdd1
# Create filesystem
sudo stratis filesystem create pool1 fs1
# Create mount point
sudo mkdir /mnt/stratis
# Add to fstab (get UUID first)
STRATIS_UUID=$(sudo stratis filesystem list | grep fs1 | awk '{print $4}')
echo "UUID=${STRATIS_UUID} /mnt/stratis xfs defaults,x-systemd.requires=stratisd.service 0 0" | sudo tee -a /etc/fstab
# Mount filesystem
sudo mount -a
```
## Task 5: Container Management
```bash
# Install container tools
sudo dnf install -y podman
# Pull httpd image
sudo podman pull httpd:latest
# Create directory for web content
sudo mkdir -p /var/www/html
# Create HTML file
echo "<html><body><h1>RHCSA Practice Exam</h1></body></html>" | sudo tee /var/www/html/index.html
# Run container
sudo podman run -d --name webserver -p 8080:80 -v /var/www/html:/usr/local/apache2/htdocs:Z httpd:latest
# Create systemd service for auto-start
sudo mkdir -p /etc/systemd/system
sudo podman generate systemd --name webserver --files --new
# Copy and enable the service
sudo cp container-webserver.service /etc/systemd/system/
sudo systemctl enable --now container-webserver.service
```
## Task 6: Service Configuration
```bash
# Install chronyd if not already installed
sudo dnf install -y chrony
# Configure chrony
sudo sed -i 's/^pool.*/server time.nist.gov iburst/' /etc/chrony.conf
# Enable and start service
sudo systemctl enable --now chronyd
# Set timezone
sudo timedatectl set-timezone America/New_York
```
## Task 7: System Management
```bash
# Set default target to multi-user
sudo systemctl set-default multi-user.target
# Create cron job for analyst
sudo -u analyst crontab -e
# Add: 0 3 * * * cp /etc/passwd /home/analyst/passwd.bak
# Create systemd timer for disk space check
cat << 'EOF' | sudo tee /usr/local/bin/disk_check.sh
#!/bin/bash
df -h > /var/log/diskspace.log
EOF
sudo chmod +x /usr/local/bin/disk_check.sh
# Create service file
cat << 'EOF' | sudo tee /etc/systemd/system/disk-check.service
[Unit]
Description=Check disk space
[Service]
Type=oneshot
ExecStart=/usr/local/bin/disk_check.sh
EOF
# Create timer file
cat << 'EOF' | sudo tee /etc/systemd/system/disk-check.timer
[Unit]
Description=Run disk space check hourly
[Timer]
OnBootSec=1min
OnUnitActiveSec=1h
[Install]
WantedBy=timers.target
EOF
# Enable and start timer
sudo systemctl enable --now disk-check.timer
```
## Task 8: Networking Configuration
```bash
# Configure network interface (assuming interface name is eth0)
sudo nmcli connection add con-name static-eth0 ifname eth0 type ethernet ip4 192.168.1.100/24 gw4 192.168.1.1
sudo nmcli connection modify static-eth0 ipv4.dns "8.8.8.8"
sudo nmcli connection modify static-eth0 ipv4.dns-search "example.com"
sudo nmcli connection up static-eth0
# Set hostname
sudo hostnamectl set-hostname rhcsa-exam
```
## Task 9: Security Configuration
```bash
# Configure firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
# Configure SELinux boolean for web server
sudo setsebool -P httpd_can_network_connect on
# Set up SSH key-based authentication for analyst
sudo -u analyst mkdir -p /home/analyst/.ssh
sudo -u analyst chmod 700 /home/analyst/.ssh
sudo -u analyst ssh-keygen -t rsa -f /home/analyst/.ssh/id_rsa -N ""
sudo -u analyst cat /home/analyst/.ssh/id_rsa.pub >> /home/analyst/.ssh/authorized_keys
sudo -u analyst chmod 600 /home/analyst/.ssh/authorized_keys
# Prevent root SSH login
sudo sed -i 's/^#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
sudo systemctl restart sshd
```
## Task 10: Storage Expansion
```bash
# Extend logical volume
sudo lvextend -L 750M /dev/vg_data/lv_data
# Extend XFS filesystem
sudo xfs_growfs /mnt/data
# Verify expansion
df -h /mnt/data
```
## Task 11: Bash Scripting
```bash
# Create script
cat << 'EOF' | sudo tee /usr/local/bin/system_info.sh
#!/bin/bash
echo "Current system time: $(date)"
echo "System hostname: $(hostname)"
echo "Disk usage:"
df -h
echo "Memory usage:"
free -h
EOF
# Make executable
sudo chmod +x /usr/local/bin/system_info.sh
# Test script
system_info.sh
```
## Task 12: NFS Configuration
```bash
# Install NFS server
sudo dnf install -y nfs-utils
# Create exports file entry
echo "/mnt/data 192.168.1.0/24(rw,sync)" | sudo tee -a /etc/exports
# Start and enable NFS server
sudo systemctl enable --now nfs-server
# Configure firewall
sudo firewall-cmd --permanent --add-service=nfs
sudo firewall-cmd --permanent --add-service=rpc-bind
sudo firewall-cmd --permanent --add-service=mountd
sudo firewall-cmd --reload
```
## Verification Steps
```bash
# Reboot to verify configurations persist
sudo reboot
# Test user login
su - analyst
# Test services
systemctl status chronyd
systemctl status stratisd
systemctl status nfs-server
systemctl status container-webserver.service
# Test file systems
df -h
ls -la /mnt/data
ls -la /mnt/stratis
# Test container
curl http://localhost:8080
```
+159
View File
@@ -0,0 +1,159 @@
# Network Solutions [🌐]
This section documents my solutions to networking scenarios, including network configuration, troubleshooting, and security.
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S7] | Network Configuration - Practice Scenarios v1 |
| [v2-S7] | Network and Storage Troubleshooting - Practice Scenarios v2 |
| [v3-S7] | Network Services Configuration - Practice Scenarios v3 |
## Scenario: [v1-S7] Network Interface Configuration
### Original Problem
From Practice Scenarios v1, Scenario 7:
1. Configure static IPv4 address: 192.168.1.100/24
2. Configure static IPv6 address: 2001:db8:1234:5678::100/64
3. Set hostname to 'rhcsa.example.com'
4. Configure DNS resolution using /etc/resolv.conf
5. Implement network access restrictions using firewalld zones
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: DHCP-configured network interface
- Required Outcome: Properly configured static network settings with hostname and firewall zones
### Solution Steps
1. Check Current Network Configuration
```bash
# Check network interfaces
ip addr show
# Check routing
ip route show
```
The first step is to identify the current network configuration to understand what needs to be changed.
2. Configure Static IPv4 and IPv6 Addresses
```bash
# Configure static IPv4 address
sudo nmcli connection modify eth0 ipv4.addresses 192.168.1.100/24 ipv4.method manual
# Configure static IPv6 address
sudo nmcli connection modify eth0 ipv6.addresses 2001:db8:1234:5678::100/64 ipv6.method manual
# Set default gateways
sudo nmcli connection modify eth0 ipv4.gateway 192.168.1.1
sudo nmcli connection modify eth0 ipv6.gateway 2001:db8:1234:5678::1
```
This configures the static IP addresses on the network interface.
3. Set Hostname
```bash
# Set hostname
sudo hostnamectl set-hostname rhcsa.example.com
# Update /etc/hosts
sudo echo "127.0.0.1 rhcsa.example.com rhcsa" >> /etc/hosts
```
This sets the system hostname and updates the hosts file.
4. Configure DNS Resolution
```bash
# Configure DNS servers
sudo nmcli connection modify eth0 ipv4.dns "8.8.8.8 8.8.4.4"
# Apply changes
sudo nmcli connection up eth0
```
This configures the DNS servers and applies all the network configuration changes.
5. Configure Firewall Zones
```bash
# Create a new zone for restricted access
sudo firewall-cmd --permanent --new-zone=restricted
# Add services to the zone
sudo firewall-cmd --permanent --zone=restricted --add-service=ssh
sudo firewall-cmd --permanent --zone=restricted --add-service=http
# Add source network to the zone
sudo firewall-cmd --permanent --zone=restricted --add-source=192.168.1.0/24
# Reload firewall
sudo firewall-cmd --reload
```
This sets up a new firewall zone that restricts access to only SSH and HTTP from the local network.
### Verification
```bash
# Verify IP configuration
ip addr show
# Verify hostname
hostname
# Verify DNS resolution
dig google.com
# Verify firewall zones
sudo firewall-cmd --list-all-zones
```
### Key Learnings
- Network configuration with NetworkManager
- IPv4 and IPv6
- Firewall zone management
- DNS configuration
## Skills Demonstrated
- Network Configuration
- DNS Management
- Network Troubleshooting
- Network Security
## Scenario: [v2-S7] Network and Storage Troubleshooting
### Original Problem
From Practice Scenarios v2, Scenario 7:
1. Diagnose and repair failed NFS mounts
2. Recover from a failed LVM configuration
3. Fix network connectivity issues
4. Restore correct SELinux contexts after file restoration
5. Configure autofs for user home directories
6. Set up network teaming for redundancy
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: System with various network and storage issues
- Required Outcome: Fully functional system with resolved issues and properly configured network
### Solution Steps
[To be filled when I complete this exercise]
## Scenario: [v3-S7] Network Services Configuration
### Original Problem
From Practice Scenarios v3, Scenario 7:
1. Configure network with:
- Bonded interface with active-backup
- VLAN configuration
- Static routes
2. Set up DNS resolution with:
- Multiple DNS servers
- Search domains
- Local host entries
3. Implement network security with:
- TCP Wrappers
- IPtables rules
- Fail2ban configuration
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Basic network configuration with single interface
- Required Outcome: Advanced network configuration with bonding, VLANs, and security features
### Solution Steps
[To be filled when I complete this exercise]
+161
View File
@@ -0,0 +1,161 @@
# Security Solutions [🔒]
This section documents my solutions to security-related scenarios, including SELinux, firewall configuration, and security hardening.
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S3] | Service and Security Management (Security Part) - Practice Scenarios v1 |
| [v2-S5] | Security Implementation - Practice Scenarios v2 |
| [v3-S5] | Comprehensive Security Setup - Practice Scenarios v3 |
## Scenario: [v1-S3] SELinux and Firewall Configuration
### Original Problem
From Practice Scenarios v1, Scenario 3 (Security Part):
- Configure firewall to allow HTTP (port 80) and HTTPS (port 443)
- Create an SELinux policy to allow Apache to listen on port 8080
- Configure SSH to disable root login and only allow key-based authentication
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Default security configuration with SELinux in enforcing mode
- Required Outcome: Secured system with custom SELinux policy and proper firewall/SSH configuration
### Solution Steps
1. Check Current SELinux Status
```bash
# Check SELinux status
getenforce
# Check SELinux contexts
ls -Z /var/www/html
```
First we verify that SELinux is in enforcing mode and check the current contexts for the web server directory.
2. Configure SELinux Policies
```bash
# Install SELinux policy utilities
sudo dnf install policycoreutils-python-utils
# Allow Apache to listen on port 8080
sudo semanage port -a -t http_port_t -p tcp 8080
# Set SELinux boolean for network connections
sudo setsebool -P httpd_can_network_connect on
```
This configures SELinux to allow Apache to listen on port 8080 and enables network connections.
3. Configure Firewall
```bash
# Check current firewall status
sudo firewall-cmd --list-all
# Allow HTTP and HTTPS
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
# Allow custom port 8080
sudo firewall-cmd --permanent --add-port=8080/tcp
# Reload firewall
sudo firewall-cmd --reload
```
This configures the firewall to allow incoming connections on ports 80, 443, and 8080.
4. Secure SSH Configuration
```bash
# Make a backup of sshd_config
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
# Edit SSH configuration
sudo vi /etc/ssh/sshd_config
```
Add or modify these lines:
```
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
```
```bash
# Restart SSH service
sudo systemctl restart sshd
```
This secures SSH by disabling root login and password authentication, requiring key-based authentication.
### Verification
```bash
# Verify SELinux port configuration
sudo semanage port -l | grep http_port_t
# Verify firewall configuration
sudo firewall-cmd --list-all
# Verify SSH configuration
sudo sshd -T | grep -E 'permitrootlogin|passwordauthentication|pubkeyauthentication'
# Test Apache on port 8080
curl localhost:8080
```
### Key Learnings
- Understanding of SELinux port contexts
- Firewall configuration with firewalld
- SSH security best practices
- Verification methodology
## Skills Demonstrated
- SELinux Management
- Firewall Configuration
- Security Auditing
- System Hardening
## Scenario: [v2-S5] Security Implementation
### Original Problem
From Practice Scenarios v2, Scenario 5:
1. Configure SELinux for a custom web application running on port 8443
2. Set up firewalld rich rules to allow access only from specific IP range
3. Implement file access controls using ACLs
4. Configure sudo access for specific commands
5. Set up password complexity requirements
6. Configure SELinux boolean settings for web services
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Default security configuration
- Required Outcome: Hardened system with granular access controls and application-specific security
### Solution Steps
[To be filled when I complete this exercise]
## Scenario: [v3-S5] Comprehensive Security Setup
### Original Problem
From Practice Scenarios v3, Scenario 5:
1. Implement a complete SELinux security strategy:
- Custom policy module
- Port definitions
- File contexts
- Boolean settings
2. Configure firewalld with:
- Multiple zones
- Custom services
- Forward ports
- Rich rules
3. Set up SSH with:
- Custom port
- AllowUsers configuration
- Rate limiting
- Key-based authentication only
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Default security configuration
- Required Outcome: Enterprise-grade security implementation with custom policies
### Solution Steps
[To be filled when I complete this exercise]
+248
View File
@@ -0,0 +1,248 @@
# Service Management Solutions [⚙️]
This section documents my solutions to service management scenarios, including systemd services, process management, and service configuration.
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S3] | Service and Security Management - Practice Scenarios v1 |
| [v2-S3] | Process and Service Management - Practice Scenarios v2 |
| [v3-S9] | Service Management and Monitoring - Practice Scenarios v3 |
## Scenario: [v1-S3] Web Server Configuration
### Original Problem
[To be filled with actual scenario]
### Environment
- OS Version: RHEL/Rocky Linux
- Initial State: [Initial service state]
- Required Outcome: [Desired service configuration]
### Solution Steps
1. Install and Enable Service
```bash
# Install service
sudo dnf install httpd
# Enable and start service
sudo systemctl enable --now httpd
```
[Explanation of installation]
2. Configure Service
```bash
# Configuration commands
sudo vi /etc/httpd/conf/httpd.conf
```
[Explanation of configuration]
3. Manage Service State
```bash
# Restart service
sudo systemctl restart httpd
# Check status
sudo systemctl status httpd
```
[Explanation of management]
### Verification
```bash
# Check service status
systemctl status httpd
# Check port listening
ss -tunlp | grep httpd
# Test service
curl localhost
```
### Key Learnings
- Understanding of systemd
- Service configuration best practices
- Troubleshooting methodology
## Skills Demonstrated
- Service Management
- Process Control
- Log Analysis
- Security Configuration
---
---
## Scenario: [v1-S3] Time Synchronization and Security Configuration
### Original Problem
- Configure chronyd to sync with time server 'time.example.com'
- Configure firewall to allow HTTP (port 80) and HTTPS (port 443)
- Create an SELinux policy to allow Apache to listen on port 8080
- Configure SSH to disable root login and only allow key-based authentication
- Set up a cron job to run system updates every Sunday at 2 AM
### Environment
- OS Version: RHEL/Rocky Linux
- Initial State: Default installation without time sync or security configurations
- Required Outcome: Properly configured time synchronization, firewall, SELinux, SSH, and automated updates
### Solution Steps
1. Configure chronyd to sync with time server 'time.example.com'
```bash
# Install chrony
sudo dnf install chrony
# Configure chronyd to sync with time server 'time.example.com'
sudo vi /etc/chrony.conf
# Add the following line to the file
server time.example.com iburst
# Save and exit
:wq
# Enable and start service
sudo systemctl enable chronyd
sudo systemctl start chronyd
sudo systemctl status chronyd
```
The output should show the chrony service enabled and running
2. Configure firewall to allow HTTP (port 80) and HTTPS (port 443)
```bash
# Install firewalld
sudo dnf install firewalld
# Enable and start firewalld
sudo systemctl enable --now firewalld
# Configure firewall to allow HTTP (port 80) and HTTPS (port 443)
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
```
The output should show the firewall rules added
3. Create an SELinux policy to allow Apache to listen on port 8080
```bash
# Install policycoreutils
sudo dnf install policycoreutils
# Create an SELinux policy to allow Apache to listen on port 8080
sudo semanage port -a -t http_port_t -p tcp 8080
```
The output should show the SELinux policy created
4. Configure SSH to disable root login and only allow key-based authentication
```bash
# Configure SSH to disable root login and only allow key-based authentication
sudo vi /etc/ssh/sshd_config
# Disable root login
PermitRootLogin no
# Allow key-based authentication
PubkeyAuthentication yes
# Save and exit
:wq
# Restart SSH service
sudo systemctl restart sshd
```
The output should show the SSH configuration updated
5. Set up a cron job to run system updates every Sunday at 2 AM
```bash
# Set up a cron job to run system updates every Sunday at 2 AM
sudo crontab -e
# Add the following line to the file
0 2 * * 0 sudo dnf update
# Save and exit
:wq
# Check status of cron service
sudo systemctl status cron
```
The output should show the cron job added
### Verification
```bash
# Check chrony status
sudo systemctl status chronyd
# Check firewall status
sudo firewall-cmd --list-all
# Check SELinux status
sudo getenforce
# Check SSH status
sudo systemctl status sshd
# Check cron status
sudo systemctl status cron
```
### Key Learnings
- Understanding of systemd
- Understanding of SELinux
- Understanding of SSH
- Understanding of cron
- Understanding of firewall
- Understanding of time synchronization
## Skills Demonstrated
- Service Management
- SELinux Management
- SSH Configuration
- Cron Job Management
- Firewall Configuration
- Time Synchronization
## Scenario: [v2-S3] Process and Service Management
### Original Problem
From Practice Scenarios v2, Scenario 3:
1. Configure system to start in graphical.target
2. Set up Apache web server to start at boot
3. Create a systemd service for a custom application
4. Configure process nice levels for specific applications
5. Set up logging rotation for application logs
6. Configure journald for persistent logging
### Environment
- OS Version: [To be filled]
- Initial State: [To be filled]
- Required Outcome: [To be filled]
### Solution Steps
[Your solution will be added here]
## Scenario: [v3-S9] Service Management and Monitoring
### Original Problem
From Practice Scenarios v3, Scenario 9:
1. Configure systemd services with:
- Dependencies
- Custom environment files
- Restart policies
2. Set up service monitoring with:
- Custom status checks
- Email notifications
- Automatic recovery
3. Implement logging with:
- Remote syslog
- Custom journald configuration
- Log forwarding
### Environment
- OS Version: [To be filled]
- Initial State: [To be filled]
- Required Outcome: [To be filled]
### Solution Steps
[Your solution will be added here]
+176
View File
@@ -0,0 +1,176 @@
# Shell Scripting Solutions [📜]
This section documents my solutions to shell scripting scenarios, including automation, monitoring, and system management scripts.
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S6] | Shell Scripting - Practice Scenarios v1 |
| [v2-S6] | Automation Script - Practice Scenarios v2 |
| [v3-S6] | System Automation - Practice Scenarios v3 |
## Scenario: [v1-S6] Shell Scripting
### Original Problem
From Practice Scenarios v1, Scenario 6:
Create a script that:
1. Accepts a directory path as an argument
2. Finds all files larger than 100MB
3. Creates a report of these files including size and last modified date
4. Archives files older than 30 days into a tar.gz file
5. Logs all actions to /var/log/cleanup.log
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: System without the necessary script
- Required Outcome: Fully functional cleanup script with reporting and archiving capability
### Solution Steps
1. Create the script structure
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. Implement file finding and reporting
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Add archiving functionality
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Implement logging
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
5. Test the script
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
## Skills Demonstrated
- Shell Scripting
- File Management
- Log Management
- Process Automation
- System Maintenance
## Scenario: [v2-S6] Automation Script
### Original Problem
From Practice Scenarios v2, Scenario 6:
Create a script that:
1. Monitors disk space usage
2. Sends alerts when filesystems exceed 80% usage
3. Automatically cleans up /tmp older than 7 days
4. Generates daily system health report
5. Uses getopts for command line options
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: System without monitoring or maintenance automation
- Required Outcome: Comprehensive system monitoring and maintenance script
### Solution Steps
1. Create script with command-line options
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. Implement disk space monitoring
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Add cleanup functionality
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Create reporting feature
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
## Scenario: [v3-S6] System Automation
### Original Problem
From Practice Scenarios v3, Scenario 6:
Create scripts for:
1. System inventory script that:
- Lists all installed packages
- Shows disk usage
- Reports running services
- Checks SELinux status
2. Backup script that:
- Uses tar with incremental backups
- Implements retention policy
- Verifies backup integrity
- Logs all operations
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: System without inventory or backup automation
- Required Outcome: Complete system inventory and backup solution with proper logging and verification
### Solution Steps
1. Create system inventory script
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. Implement package and service reporting
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Create backup script with incremental support
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Add verification and logging
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
+284
View File
@@ -0,0 +1,284 @@
# Storage Management Solutions [💾]
This section documents my solutions to storage management scenarios, including partitioning, LVM, filesystem management, and storage troubleshooting.
<div class="toc">
## Table of Contents
- [Scenario Tags](#scenario-tags)
- [Scenario: LVM Configuration and Management](#scenario-v1-s2-lvm-configuration-and-management)
- [Scenario: Create a new 2GB partition](#scenario-v1-s2-create-a-new-2gb-partition-on-devsdb-and-extend-the-logical-volume-by-500mb-using-lvm)
- [Scenario: Storage Configuration](#scenario-v2-s2-storage-configuration)
- [Scenario: Dynamic Storage Management](#scenario-v3-s2-dynamic-storage-management)
- [Scenario: Advanced File System Management](#scenario-v3-s8-advanced-file-system-management)
</div>
<div id="scenario-tags"></div>
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S2] | Storage Management - Practice Scenarios v1 |
| [v2-S2] | Storage Configuration - Practice Scenarios v2 |
| [v3-S2] | Dynamic Storage Management - Practice Scenarios v3 |
| [v3-S8] | Advanced File System Management - Practice Scenarios v3 |
[Back to Top](#storage-management-solutions-)
<div id="scenario-v1-s2-lvm-configuration-and-management"></div>
## Scenario: [v1-S2] LVM Configuration and Management
### Original Problem
Create a new 2GB partition and configure it with LVM.
### Environment
- OS Version: RHEL/Rocky Linux
- Initial State: [Initial disk/storage configuration]
- Required Outcome: [Desired storage setup]
### Solution Steps
1. Check Current Storage Configuration
```bash
# List block devices
lsblk
# Check existing volume groups
vgs
```
[Explanation of current state]
2. Create Physical Volumes
```bash
# Commands for PV creation
```
[Explanation of steps]
3. Configure Volume Groups
```bash
# Commands for VG management
```
[Explanation of configuration]
### Verification
```bash
# Verification commands
pvs
vgs
lvs
df -h
```
### Key Learnings
- Understanding of LVM concepts
- Storage management best practices
- Importance of verification
## Skills Demonstrated
- LVM Management
- Disk Partitioning
- Filesystem Management
- Storage Troubleshooting
[Back to Top](#storage-management-solutions-)
<div id="scenario-v1-s2-create-a-new-2gb-partition-on-devsdb-and-extend-the-logical-volume-by-500mb-using-lvm"></div>
## Scenario: [v1-S2] Create a new 2GB partition on /dev/sdb and extend the logical volume by 500MB using LVM
### Original Problem
- Create a new 2GB partition on /dev/sdb
- Create a physical volume from this partition
- Create a volume group called 'datavg'
- Create a 1GB logical volume called 'datalv'
- Format the logical volume with XFS filesystem
- Mount it persistently at /mnt/data using UUID
- Extend the logical volume by 500MB
### Environment
- OS Version: RHEL/Rocky Linux
- Initial State: No partition on /dev/sdb
- Required Outcome: /dev/sdb1 as a physical volume, datavg volume group, datalv logical volume, /mnt/data mounted with XFS filesystem, 1.5GB of space available
### Solution Steps
1. Check Current Storage Configuration
```bash
# List block devices
lsblk -f
# Check existing volume groups
sudo vgs
```
The output should show no partitions on /dev/sdb
2. Create a new 2GB partition on /dev/sdb
```bash
# Create a new 2GB partition on /dev/sdb
sudo fdisk /dev/sdb
# Select the option to create a new partition
n
# Select the default partition number
p
# Select the default starting sector
Enter
# Select the default ending sector
+2G
# Write the changes
w
```
The output should show a new partition on /dev/sdb1
3. Create a physical volume from this partition
```bash
# Create a physical volume from this partition
sudo pvcreate /dev/sdb1
```
The output should show a new physical volume on /dev/sdb1
4. Create a volume group called 'datavg'
```bash
# Create a volume group called 'datavg'
sudo vgcreate datavg /dev/sdb1
```
The output should show a new volume group called 'datavg'
5. Create a 1GB logical volume called 'datalv'
```bash
# Create a 1GB logical volume called 'datalv'
sudo lvcreate -n datalv -L 1G datavg
```
The output should show a new logical volume called 'datalv'
6. Format the logical volume with XFS filesystem
```bash
# Format the logical volume with XFS filesystem
sudo mkfs.xfs /dev/datavg/datalv
```
The output should show a new XFS filesystem on /dev/datavg/datalv
7. Mount it persistently at /mnt/data using UUID
```bash
# Mount it persistently at /mnt/data using UUID
sudo mkdir -p /mnt/data
# Check the UUID of the logical volume
lsblk -f
# Mount the logical volume using /etc/fstab and UUID
sudo echo "UUID=3cf01c3e-6a65-42e7-bd3c-67d32a973cce /mnt/data xfs defaults 0 0" >> /etc/fstab
# Mount the logical volume
sudo mount -a
```
The output should show the logical volume mounted at /mnt/data
8. Extend the logical volume by 500MB
```bash
# Extend the logical volume by 500MB
sudo lvextend -L +500M /dev/datavg/datalv
```
The output should show the logical volume extended by 500MB
### Verification
```bash
# Verification commands
pvs
vgs
lvs
df -h
lsblk -f
```
### Key Learnings
- Understanding of LVM concepts
- Storage management best practices
- Importance of verification
## Skills Demonstrated
- LVM Management
- Disk Partitioning
- Filesystem Management
- Storage Troubleshooting
[Back to Top](#storage-management-solutions-)
<div id="scenario-v2-s2-storage-configuration"></div>
## Scenario: [v2-S2] Storage Configuration
### Original Problem
From Practice Scenarios v2, Scenario 2:
1. Create three 1GB partitions on /dev/sdc using GPT
2. Set up LVM using these partitions
3. Create a volume group named 'appvg'
4. Create two logical volumes: 'applv' (2GB) and 'logslv' (1GB)
5. Format applv with ext4 and logslv with xfs
6. Configure persistent mounts using labels
7. Add a new swap partition of 2GB
### Environment
- OS Version: [To be filled]
- Initial State: [To be filled]
- Required Outcome: [To be filled]
### Solution Steps
[Your solution will be added here]
[Back to Top](#storage-management-solutions-)
<div id="scenario-v3-s2-dynamic-storage-management"></div>
## Scenario: [v3-S2] Dynamic Storage Management
### Original Problem
From Practice Scenarios v3, Scenario 2:
1. Set up a 4GB partition using GPT on /dev/sdd
2. Create a VDO volume with 3:1 compression ratio
3. Create LVM structure on top of VDO
4. Configure thin provisioning for development environments
5. Create a 2GB XFS filesystem with quota support
6. Implement user and group quotas
7. Configure automated filesystem growth triggers
### Environment
- OS Version: [To be filled]
- Initial State: [To be filled]
- Required Outcome: [To be filled]
### Solution Steps
[Your solution will be added here]
[Back to Top](#storage-management-solutions-)
<div id="scenario-v3-s8-advanced-file-system-management"></div>
## Scenario: [v3-S8] Advanced File System Management
### Original Problem
From Practice Scenarios v3, Scenario 8:
1. Create a stratis storage pool
2. Configure automated NFS mounts with autofs
3. Set up ACL configurations for:
- Default permissions
- User-specific access
- Group collaboration
4. Implement file system encryption
5. Configure file system compression
6. Set up file system snapshots
### Environment
- OS Version: [To be filled]
- Initial State: [To be filled]
- Required Outcome: [To be filled]
### Solution Steps
[Your solution will be added here]
[Back to Top](#storage-management-solutions-)
+179
View File
@@ -0,0 +1,179 @@
# System Recovery & Maintenance Solutions [🔧]
This section documents my solutions to system recovery and maintenance scenarios, including boot issues, emergency mode, and system troubleshooting.
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S5] | System Recovery and Maintenance - Practice Scenarios v1 |
| [v2-S8] | System Maintenance - Practice Scenarios v2 |
| [v3-S3] | Boot Management and Recovery - Practice Scenarios v3 |
## Scenario: [v1-S5] System Recovery and Maintenance
### Original Problem
From Practice Scenarios v1, Scenario 5:
1. Reset root password using emergency mode
2. Identify and kill a process consuming excessive CPU
3. Configure system to boot into multi-user target by default
4. Configure autofs to automatically mount an NFS share
5. Create a backup of /etc using tar with bzip2 compression
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: System with locked root password and various issues
- Required Outcome: Recovered system with proper configuration and backup
### Solution Steps
1. Reset root password using emergency mode
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. Identify and kill high CPU process
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Configure default boot target
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Set up autofs for NFS
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
5. Create backups
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
## Skills Demonstrated
- System Recovery
- Process Management
- Boot Configuration
- Backup and Restore
- File System Management
## Scenario: [v2-S8] System Maintenance
### Original Problem
From Practice Scenarios v2, Scenario 8:
1. Configure local repository for package management
2. Set up automated security updates
3. Configure logrotate for custom application logs
4. Create a backup strategy for system configuration
5. Schedule system maintenance tasks using cron and at
6. Configure time synchronization with multiple time sources
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Basic system without maintenance configuration
- Required Outcome: Fully configured maintenance system with automated tasks
### Solution Steps
1. Configure local repository
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. Set up automated updates
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Configure log rotation
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Implement backup strategy
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
5. Schedule maintenance tasks
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
## Scenario: [v3-S3] Boot Management and Recovery
### Original Problem
From Practice Scenarios v3, Scenario 3:
1. Configure system with multiple boot targets
2. Create a custom boot target for minimal services
3. Configure GRUB2 with password protection
4. Set up system to boot with specific kernel parameters
5. Create a recovery procedure for:
- Forgotten root password
- Failed boot
- Corrupted GRUB
6. Configure crash dump collection
### Environment
- OS Version: RHEL/Rocky Linux 8.x
- Initial State: Standard boot configuration
- Required Outcome: Advanced boot configuration with security and recovery options
### Solution Steps
1. Configure boot targets
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
2. GRUB2 configuration
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
3. Recovery procedures
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
4. Configure crash dumps
```bash
# To be filled with my solution
```
[My explanation will go here after completing the exercise]
### Verification
```bash
# To be filled with my verification steps
```
### Key Learnings
- [To be filled after completing the exercise]
+205
View File
@@ -0,0 +1,205 @@
# User Management Solutions [👤]
This section contains my solutions to various user management scenarios from the practice exercises.
<div class="toc">
## Table of Contents
- [Scenario Tags](#scenario-tags)
- [Scenario: Creating Users with Specific Requirements](#scenario-creating-users-with-specific-requirements)
- [Scenario: Creating Users with Specific Requirements (Expanded)](#scenario-creating-users-with-specific-requirements-1)
- [Scenario: System Access and File Management](#scenario-v2-s1-system-access-and-file-management)
- [Scenario: Advanced User Management](#scenario-v3-s1-advanced-user-management)
</div>
<div id="scenario-tags"></div>
## Scenario Tags
| Tag | Description |
|-----|-------------|
| [v1-S1] | User and Permission Management - Practice Scenarios v1 |
| [v2-S1] | System Access and File Management - Practice Scenarios v2 |
| [v3-S1] | Advanced User Management - Practice Scenarios v3 |
[Back to Top](#user-management-solutions-)
<div id="scenario-creating-users-with-specific-requirements"></div>
## Scenario: Creating Users with Specific Requirements
### Original Problem
From Practice Scenarios v1: Create a user named 'john' with a custom shell and home directory.
### Environment
- OS Version: Rocky Linux 8.x
- Initial State: No user 'john' exists
- Required Outcome: User 'john' created with specific requirements
### Solution Steps
1. Create the user with specific requirements
```bash
# Create user with custom home directory
sudo useradd -m -d /custom/home/john -s /bin/bash john
# Set password
sudo passwd john
```
This creates the user 'john' with a custom home directory and bash shell
2. Verify user creation
```bash
# Check user entry in /etc/passwd
grep john /etc/passwd
# Verify home directory
ls -la /custom/home/john
```
### Key Learnings
- Understanding of useradd command options
- Importance of verifying user creation
- Best practices for user management
## Skills Demonstrated
- User Account Management
- Command Line Proficiency
- Security Best Practices
- System Verification
[Back to Top](#user-management-solutions-)
<div id="scenario-creating-users-with-specific-requirements-1"></div>
## Scenario: Creating Users with Specific Requirements (Expanded)
### Original Problem
- Create a new user called 'analyst1' with home directory '/home/analyst1'
- Create a group called 'datateam'
- Add 'analyst1' to 'datateam'
- Create a directory '/data/reports' owned by 'datateam' with SGID set
- Ensure members of 'datateam' can read/write, others can only read
- Set password expiry for 'analyst1' to 90 days
### Environment
- OS Version: RHEL 9.5
- Initial State: No user 'analyst1' exists
- Required Outcome: User 'analyst1' created with specific requirements
### Solution Steps
1. Step 1 - Create the user 'analyst1'
```bash
sudo useradd -m -d /home/analyst1 analyst1
```
This creates the user 'analyst1' with a home directory '/home/analyst1'
2. Step 2
```bash
sudo groupadd datateam
```
This creates the group 'datateam'
3. Step 3 - Add 'analyst1' to 'datateam'
```bash
sudo usermod -aG datateam analyst1
```
This adds 'analyst1' to the 'datateam' group
4. Step 4 - Create the directory '/data/reports' owned by 'datateam' with SGID set
```bash
sudo mkdir -p /data/reports
sudo chown :datateam /data/reports
sudo chmod 2775 /data/reports
```
This creates the directory '/data/reports' owned by 'datateam' with SGID set
5. Step 5 - Ensure members of 'datateam' can read/write, others can only read
```bash
sudo chmod 2775 /data/reports
```
This ensures members of 'datateam' can read/write, others can only read
6. Step 6 - Set password expiry for 'analyst1' to 90 days
```bash
sudo chage -E $(date -d '90 days' +%Y-%m-%d) analyst1
```
This sets the password expiry for 'analyst1' to 90 days
### Verification
Commands used to verify the solution works correctly:
```bash
# Verify user creation
id analyst1
# Verify group membership
groups analyst1
# Verify directory permissions
ls -la /data/reports
# Verify password expiry
sudo chage -l analyst1
```
### Key Learnings
- Understanding of useradd, groupadd, usermod, mkdir, chown, chmod, chage commands
- Importance of verifying user creation
- Importance of setting password expiry
### Additional Notes
> [NOTE]
> This scenario is a good example of how to create a user with a specific home directory, add them to a group, create a directory owned by the group with SGID set, and set password expiry.
[Back to Top](#user-management-solutions-)
<div id="scenario-v2-s1-system-access-and-file-management"></div>
## Scenario: [v2-S1] System Access and File Management
### Original Problem
From Practice Scenarios v2, Scenario 1:
1. Configure SSH to listen on port 2222 instead of default 22
2. Create a user 'devops1' with custom shell /bin/bash
3. Set up password-less SSH authentication for 'devops1'
4. Create directory structure /opt/projects with subdirectories dev, test, prod
5. Configure appropriate permissions where only devops1 can access prod
6. Create both soft and hard links for important config files
### Environment
- OS Version: [To be filled]
- Initial State: [To be filled]
- Required Outcome: [To be filled]
### Solution Steps
[Your solution will be added here]
[Back to Top](#user-management-solutions-)
<div id="scenario-v3-s1-advanced-user-management"></div>
## Scenario: [v3-S1] Advanced User Management
### Original Problem
From Practice Scenarios v3, Scenario 1:
1. Create a departmental structure with groups: 'engineering', 'qa', and 'ops'
2. Add users 'eng1', 'eng2', 'qa1', 'ops1' to respective groups
3. Configure shared directory /opt/shared with:
- Engineering can read/write their directory
- QA can read engineering, read/write QA directory
- Ops can read/write all directories
4. Implement password policies:
- Minimum 12 characters
- Maximum age 60 days
- Warning 7 days before expiry
### Environment
- OS Version: [To be filled]
- Initial State: [To be filled]
- Required Outcome: [To be filled]
### Solution Steps
[Your solution will be added here]
[Back to Top](#user-management-solutions-)