适用对象:已经有一定 Linux / 服务器实战经验,正在系统化学习 RHEL / RHCSA 的学习者
目标版本:RHEL 10 / EX200 思路
使用方法:按周推进;每天固定遵循 输入 → 实操 → 复盘 → 验证 四段式;所有配置都要 验证,关键项都要 重启验证
学习总规则
第一段:输入
20 到 30 分钟
看官方文档、课程目录、简短视频、你自己的旧笔记
第二段:实操
60 到 120 分钟
必须上虚拟机做
每个命令至少自己打 3 次,不复制粘贴
第三段:复盘
10 到 20 分钟只记:
- 常用命令
- 常见报错
第四段:验证
10 到 20 分钟
凡是服务、挂载、网络、firewalld、SELinux、timer、容器等配置,至少做一次:
- 当前会话验证
- 重启后验证
标准操作步骤
环境搭建
目标
把实验环境搭成能长期训练的状态
配套资料
官方主线
- EX200:红帽认证系统管理员考试(RHCSA)
https://www.redhat.com/zh-cn/services/training/ex200-red-hat-certified-system-administrator-rhcsa-exam - RH199:红帽认证系统管理员快速提升课程
https://www.redhat.com/zh-cn/services/training/rh199-red-hat-certified-system-administrator-rapid-track-course - RHEL 10 官方文档总目录(中文)
https://docs.redhat.com/zh-cn/documentation/red_hat_enterprise_linux/10
环境与实验
- No-cost RHEL 下载(官方)
https://developers.redhat.com/products/rhel/download - Red Hat Developer Sandbox
https://developers.redhat.com/developer-sandbox - RHEL Interactive Labs
https://www.redhat.com/en/interactive-labs/enterprise-linux
速查
- RHEL 10 Cheat Sheet
https://developers.redhat.com/cheat-sheets/red-hat-enterprise-linux-10-cheat-sheet - Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/linux-commands-cheat-sheet
这一节建议重点查
- 安装 RHEL
- SSH
dnfsystemctljournalctlhostnamectl
安装虚拟机
1 | RHEL 10 Minimal |
初始化系统
1 | 修改主机名 |
做快照
1 | fresh-install |
通过标准
- 能从宿主机 SSH 登录
- 会
dnf install - 会
systemctl status/start/stop/restart/enable/disable - 会
journalctl -u 服务名 - 会建用户并给 sudo
命令行基础 + 文件搜索与文本处理
目标
练到看到一个需求,能立刻想到用 find、grep、管道去解决
配套资料
官方主线
- RH124:红帽系统管理一
https://www.redhat.com/zh-cn/services/training/rh124-red-hat-system-administration-i - Learn Linux(Developer 官方学习入口)
https://developers.redhat.com/learn/linux
速查
- Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/linux-commands-cheat-sheet - Intermediate Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/intermediate-linux-commands-cheat-sheet - Advanced Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
本机文档建议
1 | man find |
必学命令
1 | pwd |
必学资料入口
1 | /usr/share/doc |
Day 1
1 | pwd |
练习:
1 | 建 3 级目录 |
通过标准:
1 | 不查资料能完成基本目录操作 |
Day 2
1 | cat |
练习:
1 | 查看 /etc/passwd |
通过标准:
1 | 知道什么时候用 cat,什么时候用 less |
Day 3
1 | grep |
练习:
1 | grep root /etc/passwd |
通过标准:
1 | 能用 grep 查内容、过滤内容 |
Day 4
1 | find |
练习:
1 | find /etc -name "*.conf" |
通过标准:
1 | 能按名字、类型、用户、大小找文件 |
Day 5
1 | 管道 |
练习:
1 | cat /etc/passwd | grep bash |
通过标准:
1 | 会把多个命令串起来解决问题 |
Day 6
练习:
1 | 用 man 查 chmod |
整合练习:
- 找出
/etc下所有.conf - 找出
/var/log里包含error的行 - 统计当前系统可登录用户数量
- 找出所有属于
root的普通文件
Day 7
复盘:
- 自己手写 20 条
find - 自己手写 20 条
grep - 整理一页命令模板
归档、压缩、解压
目标
把 tar 和常见压缩操作练熟,做到看到需求能立刻打出正确命令
配套资料
官方主线
- EX200:考试目标
https://www.redhat.com/zh-cn/services/training/ex200-red-hat-certified-system-administrator-rhcsa-exam - RH134:红帽系统管理二
https://www.redhat.com/zh-cn/services/training/rh134-red-hat-system-administration-ii
速查
- Advanced Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
本机文档建议
1 | man tar |
必学命令
1 | tar |
Day 1
1 | tar 基础 |
练习:
1 | 创建一个目录 testdir |
Day 2
1 | tar + gzip |
练习:
1 | 把目录打成 test.tar.gz |
Day 3
1 | tar + bzip2 |
练习:
1 | 把目录打成 test.tar.bz2 |
Day 4
1 | xz |
练习:
1 | 把目录打成 test.tar.xz |
Day 5
1 | 查看归档内容 |
练习:
1 | 不解压先看归档里有哪些文件 |
Day 6
整合练习:
- 把
/etc某几个配置文件打成归档 - 用
gzip压缩日志文件 - 把归档解压到指定目录
- 验证文件内容和权限是否正常
Day 7
复盘:
- 整理
tar常用参数模板 - 整理
tar.gz / tar.bz2 / tar.xz模板 - 整理常见报错和排查思路
软件包、仓库、RPM 管理
目标
把 RHEL 软件管理练熟,做到会查、会装、会删、会看包内容、会从本地文件安装
配套资料
官方主线
- 使用 DNF 工具管理软件(RHEL 10)
https://docs.redhat.com/zh-cn/documentation/red_hat_enterprise_linux/10/html-single/managing_software_with_the_dnf_tool/index - DNF 配置章节(英文)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/managing_software_with_the_dnf_tool/configuring-dnf - RHEL Interactive Labs:Install software using package managers
https://www.redhat.com/en/interactive-labs/enterprise-linux
本机文档建议
1 | man dnf |
必学命令
1 | dnf |
Day 1
1 | dnf repolist |
练习:
1 | 查看当前可用仓库 |
通过标准:
1 | 知道怎么查包、看包描述、看来源 |
Day 2
1 | dnf install |
练习:
1 | 安装 tmux |
通过标准:
1 | 会安装、卸载、验证软件包 |
Day 3
1 | rpm -q |
练习:
1 | 查看 bash 是否安装 |
通过标准:
1 | 会用 rpm 查包、查文件归属、查安装内容 |
Day 4
1 | dnf history |
练习:
1 | 查看最近安装历史 |
通过标准:
1 | 从本地文件系统安装一个 rpm |
Day 5
整合练习:
- 从仓库安装一个包
- 从本地 rpm 文件安装一个包
- 用 rpm 查询包内容与文件归属
- 删除并重新安装
- 重启后验证命令仍可用
Day 6
复盘:
- 整理
dnf常用命令模板 - 整理
rpm查询模板 - 整理“查不到命令 / 查不到文件归属 / 安装失败”排障模板
Day 7
缓冲 / 补漏:
- 把前面不会的包管理命令再手打一遍
- 补齐自己的常用软件安装清单
用户、组、权限、ACL
目标
把 Linux 权限模型练熟,这周是 RHCSA 地基
配套资料
官方主线
- RH124:课程内容摘要
https://www.redhat.com/zh-cn/services/training/rh124-red-hat-system-administration-i - 在 RHEL 中配置身份验证和授权(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/configuring_authentication_and_authorization_in_rhel/index
速查
- Intermediate Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/intermediate-linux-commands-cheat-sheet - Advanced Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
本机文档建议
1 | man useradd |
必学命令
1 | useradd |
Day 1
1 | cat /etc/passwd |
练习:
1 | 建 3 个用户 |
Day 2
1 | groupadd |
练习:
1 | 建 devops、ops |
Day 3
1 | 权限位 |
练习:
1 | 建目录 /shared |
Day 4
1 | umask |
练习:
1 | 不同 umask 下创建文件和目录 |
Day 5
1 | ACL |
练习:
1 | setfacl -m u:alice:rwx /shared |
Day 6
1 | sudo -l |
练习:
1 | 查看某用户当前 sudo 权限 |
整合练习:
- 建 3 个用户、2 个组
- 给共享目录设置属主、属组、权限、ACL
- 让某个用户能写,另一个只能读
- 给某用户配置 sudo 权限并验证
Day 7
复盘:
- 自己画一张权限模型图
整理:
- 用户管理模板
- 权限修改模板
- ACL 操作模板
- 密码老化模板
- sudo 验证模板
进程、systemd、日志、任务调度
目标
把服务和进程这块做扎实
配套资料
官方主线
- 使用 systemd 单元文件自定义和优化您的系统(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/using_systemd_unit_files_to_customize_and_optimize_your_system/index - RH199:课程大纲
https://www.redhat.com/zh-cn/services/training/rh199-red-hat-certified-system-administrator-rapid-track-course
速查
- Intermediate Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/intermediate-linux-commands-cheat-sheet - Advanced Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
本机文档建议
1 | man ps |
必学命令
1 | ps |
Day 1
1 | ps |
练习:
1 | 找 sshd 进程 |
Day 2
1 | kill |
练习:
1 | 启动 sleep 300 |
Day 3
1 | nice |
练习:
1 | 后台运行命令 |
Day 4
1 | systemctl |
练习:
1 | 管理 sshd |
Day 5
1 | journalctl |
练习:
1 | journalctl -b |
Day 6
1 | crontab |
练习:
- 写一个每分钟执行的 cron
- 安排一个 5 分钟后执行的任务
Day 7
复盘整合:
- 找进程
- 杀进程
- 改优先级
- 起停服务
- 看日志
- 配定时任务
Shell 脚本基础
目标
把 shell 脚本练到能写简单自动化,不靠手工重复敲命令
配套资料
官方主线
- RH134:课程内容摘要(shell 脚本、自动化)
https://www.redhat.com/zh-cn/services/training/rh134-red-hat-system-administration-ii - Bash Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/bash-shell-cheat-sheet
补充
- Learn Linux
https://developers.redhat.com/learn/linux
本机文档建议
1 | help test |
必学命令
1 | bash |
Day 1
1 | 脚本基本结构 |
练习:
1 | 写第一个 hello.sh |
Day 2
1 | 变量 |
练习:
1 | 写脚本接收用户名参数 |
Day 3
1 | read |
练习:
1 | 写脚本询问一个目录名 |
Day 4
1 | if |
练习:
1 | 写脚本判断一个服务是否运行 |
Day 5
1 | for |
练习:
1 | 用 for 批量创建 5 个用户 |
Day 6
整合练习:
- 写一个脚本批量检查多个服务状态
- 写一个脚本批量创建目录
- 写一个脚本统计 /etc 下 .conf 文件数量
- 写一个脚本检查磁盘使用率并输出提示
Day 7
复盘:
- 自己手写 5 个小脚本
- 整理脚本模板
- 整理变量、判断、循环模板
systemd timer 专项
目标
把定时任务从 cron / at 扩展到 systemd timer,做到会写、会启、会查、会排障
配套资料
官方主线
- 使用 systemd 单元文件自定义和优化您的系统(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/using_systemd_unit_files_to_customize_and_optimize_your_system/index - RH134:课程内容摘要
https://www.redhat.com/zh-cn/services/training/rh134-red-hat-system-administration-ii
本机文档建议
1 | man systemd.timer |
必学命令
1 | systemctl |
Day 1
1 | timer 概念 |
练习:
1 | 查看系统已有 timer |
Day 2
1 | 写最简单的 oneshot service |
练习:
1 | 写一个 myecho.service |
Day 3
1 | 写最简单的 timer |
练习:
1 | 写一个 myecho.timer |
Day 4
1 | OnBootSec |
练习:
1 | 写一个开机 1 分钟后执行的 timer |
Day 5
1 | daemon-reload |
练习:
1 | 修改 timer 后重新加载 |
Day 6
整合练习:
- 写一个定时清理临时文件的 service + timer
- 写一个定时记录磁盘使用率的 service + timer
- 设置开机自动生效
- 重启后验证是否仍然有效
Day 7
复盘:
- 整理 service 模板
- 整理 timer 模板
- 整理 timer 排障模板
磁盘、文件系统、挂载、fstab
目标
从“会看磁盘”升级到“会真正管理存储”
配套资料
官方主线
- 管理文件系统(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/managing_file_systems/index - 管理存储设备(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/managing_storage_devices/index
速查
- Advanced Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
本机文档建议
1 | man lsblk |
必学命令
1 | lsblk |
Day 1
1 | lsblk |
练习:
1 | 看现有磁盘 |
Day 2
1 | fdisk |
练习:
1 | 给 VM 加一块新盘 |
Day 3
1 | mkfs.xfs |
练习:
1 | 新建文件系统 |
Day 4
1 | /etc/fstab |
练习:
1 | 使用 UUID 或 LABEL 写入 /etc/fstab |
Day 5
1 | mkswap |
练习:
1 | 新建 swap 分区或 swap 文件 |
Day 6
1 | mount -t nfs |
练习:
1 | 挂载一个 NFS 共享到 /mnt/nfs |
Day 7
整合练习:
- 新加磁盘
- 创建分区
- 创建文件系统
- 挂载到 /data
- 使用 UUID 或 LABEL 写进 fstab
- 重启验证
复盘:
- 默写挂载流程
- 默写 fstab 关键字段
- 整理磁盘排障笔记
LVM 专项周
目标
把 LVM 练成肌肉记忆
配套资料
官方主线
- 配置和管理逻辑卷(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/configuring_and_managing_logical_volumes/index - LVM 基础逻辑卷管理章节
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/configuring_and_managing_logical_volumes/basic-logical-volume-management
本机文档建议
1 | man pvcreate |
必学命令
1 | pvcreate |
Day 1
1 | PV / VG / LV 概念 |
练习:
1 | 看图理解结构 |
Day 2
练习:
1 | pvcreate /dev/sdb |
Day 3
练习:
1 | 格式化 LV |
Day 4
练习:
1 | 扩容 LV |
Day 5
练习:
1 | 再加一块盘 |
Day 6
整合练习:
- 从空盘开始,完整做一遍
PV → VG → LV → 文件系统 → 挂载 → 开机挂载
Day 7
复盘:
- 把完整流程写成 10 行以内命令清单
网络、SSH、SCP、SFTP、firewalld
目标
把远程管理和防火墙做稳
配套资料
官方主线
- 配置和管理网络(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/configuring_and_managing_networking/index - 配置防火墙和数据包过滤器(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/configuring_firewalls_and_packet_filters/index - 配置时间同步(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/configuring_time_synchronization/index
速查
- Intermediate Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/intermediate-linux-commands-cheat-sheet - Advanced Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
本机文档建议
1 | man nmcli |
必学命令
1 | ip |
Day 1
1 | ip a |
Day 2
1 | SSH 基础 |
练习:
1 | 主机间传文件 |
Day 3
1 | firewalld |
Day 4
练习:
1 | firewall-cmd --list-all |
Day 5
1 | nmcli |
练习:
1 | 放行端口 |
Day 6
1 | timedatectl |
练习:
1 | 查看当前时区 |
Day 7
整合练习:
- 配 SSH
- 传文件
- 起一个服务
- 防火墙放行
- 验证连通性
复盘:
- 整理 firewalld 模板
- 整理 SSH / SCP / SFTP 模板
- 整理 IPv6 / hosts / chronyd 模板
启动流程、target、救援模式
目标
把启动相关操作练熟,做到会切 target,会进救援,会做最基础启动排障
配套资料
官方主线
- 使用 systemd 单元文件自定义和优化您的系统(RHEL 10)
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/using_systemd_unit_files_to_customize_and_optimize_your_system/index - RH134:课程内容摘要(启动流程与故障排除)
https://www.redhat.com/zh-cn/services/training/rh134-red-hat-system-administration-ii - EX200:考试目标
https://www.redhat.com/zh-cn/services/training/ex200-red-hat-certified-system-administrator-rhcsa-exam
本机文档建议
1 | man systemctl |
必学命令
1 | systemctl get-default |
Day 1
1 | target 概念 |
练习:
1 | 查看当前默认 target |
Day 2
1 | systemctl get-default |
练习:
1 | 查看默认启动 target |
Day 3
1 | systemctl isolate |
练习:
1 | 切到 multi-user.target |
Day 4
1 | rescue 模式 |
练习:
1 | 进入 rescue 模式 |
Day 5
1 | 启动日志 |
练习:
1 | 看本次启动日志 |
Day 6
练习:
1 | 在 GRUB 菜单中临时编辑内核参数进入救援或维护环境 |
整合练习:
- 改默认 target
- 重启验证
- 进入 rescue 模式
- 查一个启动失败服务日志
- 恢复回正常启动状态
- 在 GRUB 菜单中临时编辑内核参数进入救援 / 维护环境
- 完成排障后恢复正常启动
Day 7
复盘:
- 整理 target 切换模板
- 整理 rescue / emergency 区别
- 整理 GRUB 中断启动模板
- 整理启动排障模板
SELinux
目标
把 SELinux 从“看不懂”变成“会查会修”
配套资料
官方主线
- 使用 SELinux(RHEL 10)
https://docs.redhat.com/zh-cn/documentation/red_hat_enterprise_linux/10/html-single/using_selinux/index - How SELinux improves Red Hat Enterprise Linux security
https://developers.redhat.com/articles/2023/09/21/how-selinux-improves-red-hat-enterprise-linux-security - Learn RHEL:Enhance RHEL with SELinux on the Developer Sandbox
https://developers.redhat.com/products/rhel/getting-started
速查
- RHEL 10 Cheat Sheet
https://developers.redhat.com/cheat-sheets/red-hat-enterprise-linux-10-cheat-sheet - Advanced Linux Commands Cheat Sheet
https://developers.redhat.com/cheat-sheets/advanced-linux-commands
本机文档建议
1 | man sestatus |
必学命令
1 | getenforce |
Day 1
1 | SELinux 是什么 |
练习:
1 | getenforce |
Day 2
1 | 安全上下文 |
练习:
1 | 看文件上下文 |
Day 3
1 | restorecon |
练习:
1 | 人为改坏上下文 |
Day 4
1 | semanage fcontext |
练习:
1 | semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?" |
Day 5
1 | getsebool |
练习:
1 | getsebool -a | grep httpd |
Day 6
故障题训练:
- 服务目录权限看着对,但访问失败
- 换目录后服务起不来
- 端口不符合策略导致失败
Day 7
复盘:
- 写一份“SELinux 排障 5 步法”
- 遇到异常先看什么,后看什么
Podman 基础容器管理
目标
把 Docker 经验迁移到 RHEL 容器工具链,练到会基础容器操作和简单持久化
配套资料
官方主线
- 构建、运行和管理容器(RHEL 10)
https://docs.redhat.com/zh-cn/documentation/red_hat_enterprise_linux/10/html-single/building_running_and_managing_containers/index - Containers Cheat Sheet
https://developers.redhat.com/cheat-sheets/containers - RHEL 10 Cheat Sheet
https://developers.redhat.com/cheat-sheets/red-hat-enterprise-linux-10-cheat-sheet
说明
- RHCSA 这里的重点是 basic container management
- 重点放在 Podman 基础命令 + RHEL 生态习惯
- 不要把精力放到 Compose 兼容层细节上
本机文档建议
1 | man podman |
必学命令
1 | podman |
Day 1
1 | podman 基础概念 |
练习:
1 | 安装 podman |
Day 2
1 | podman pull |
练习:
1 | 拉取 ubi 或 nginx 镜像 |
Day 3
1 | 端口映射 |
练习:
1 | 运行一个 nginx 容器 |
Day 4
1 | 挂载目录 |
练习:
1 | 把宿主机目录挂到容器里 |
Day 5
1 | podman exec |
练习:
1 | 进入容器执行命令 |
Day 6
故障题训练:
- 拉镜像
- 起容器
- 配端口映射
- 配目录挂载
- 查看日志
- 停止、启动、删除容器
Day 7
复盘:
- 整理 podman 基础命令模板
- 整理容器排障模板
- 对照 Docker 命令写一份迁移对照表
综合训练 + 模拟考试
目标
把前面所有内容连起来做
配套资料
训练前必看
- EX200:考试目标
https://www.redhat.com/zh-cn/services/training/ex200-red-hat-certified-system-administrator-rhcsa-exam - RH199:快速提升课程
https://www.redhat.com/zh-cn/services/training/rh199-red-hat-certified-system-administrator-rapid-track-course
模拟前最少过一遍
- RHEL 10 官方文档总目录
https://docs.redhat.com/zh-cn/documentation/red_hat_enterprise_linux/10 - RHEL 10 Cheat Sheet
https://developers.redhat.com/cheat-sheets/red-hat-enterprise-linux-10-cheat-sheet - Cheat Sheets 总入口
https://developers.redhat.com/cheat-sheets
资料使用规则
- 优先自己做
- 卡住先查
man - 再查
info - 再查
/usr/share/doc - 最后才回头翻网页笔记
这周规则
1 | 每次从干净快照恢复 |
每次练习后复盘
只记录:
- 哪一步不会
- 哪一步做慢了
- 哪一步忘记验证
- 哪一步本来可以直接查
man / info / /usr/share/doc解决
每天固定模板
先看
一个小主题
不超过 30 分钟
再做
至少 1 小时
自己手打命令
不复制粘贴
再记
只记三类:
命令模板
例如:
查找文件:
1 | find /path -name "*.conf" |
查找内容:
1 | grep -r ssh /etc |
故障模板
例如:
服务起不来:
1 | systemctl status |
标准流程模板
例如:
LVM 新建:
1 | pvcreate |
优先级
第一优先级
SELinux
第二优先级
find / grep / 管道 / 文本处理 / 系统文档
第三优先级
LVM / 挂载 / fstab / NFS / autofs
第四优先级
用户权限 / ACL / 密码老化
第五优先级
进程 / 任务 / firewalld / systemd timer
第六优先级
软件包管理 / 仓库 / 本地 RPM / Podman 基础
使用建议
- 每周至少做 1 次重启验证
- 每两周做 1 次综合训练
- 每次复盘都补 3 条“下次更快”的命令模板
- 不会的地方先查
man / info / /usr/share/doc,再查外部资料 - 所有配置类题目都要养成“做完立刻验证”的习惯