From 05565fc0c1a5202c5f95961fa6c8682c439dcd23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8B=90=E7=8B=B8Nomad?= <9463297+callmer@user.noreply.gitee.com> Date: Sun, 4 Dec 2022 07:31:27 +0000 Subject: [PATCH] =?UTF-8?q?update=203.PVE=E7=B3=BB=E7=BB=9F=E8=B0=83?= =?UTF-8?q?=E6=95=B4.md.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 狐狸Nomad <9463297+callmer@user.noreply.gitee.com> --- 3.PVE系统调整.md | 85 ++++-------------------------------------------- 1 file changed, 7 insertions(+), 78 deletions(-) diff --git a/3.PVE系统调整.md b/3.PVE系统调整.md index 1760c6c..60dcd9b 100644 --- a/3.PVE系统调整.md +++ b/3.PVE系统调整.md @@ -23,76 +23,7 @@ apt install intel-microcode (amd64-microcode) 本文后续命令,均在 SSH 终端下完成。 - -## 1.Fail2ban 配置(停用) - -安装好 `fail2ban` 后,检查其服务状态: - -```bash -## 检查 Fail2ban 系统服务状态 -systemctl status fail2ban.service -``` - -在 `Loaded` 行,检查是否存在 `enable` : - -```bash -## 参考输出 - -● fail2ban.service - Fail2Ban Service - Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled) - Active: active (running) since Sat 2022-07-16 05:03:53 CST; 4 days ago - Docs: man:fail2ban(1) - Process: 777 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS) - Main PID: 792 (fail2ban-server) - Tasks: 5 (limit: 18904) - Memory: 13.3M - CPU: 4min 53.764s - CGroup: /system.slice/fail2ban.service - └─792 /usr/bin/python3 /usr/bin/fail2ban-server -xf start - -Jul 16 05:03:53 hyper systemd[1]: Starting Fail2Ban Service... -Jul 16 05:03:53 hyper systemd[1]: Started Fail2Ban Service. -Jul 16 05:03:53 hyper fail2ban-server[792]: Server ready -``` - -其中第 1 个 `enable` 表示当前服务开机自动启动,第 2 个 `enable` 表示该软件的默认启用状态。 - -如果第 1 个不为 `enable` 状态,需要用以下命令进行调整: - -```bash -## 开机自启 fail2ban 服务 -systemctl enable fail2ban.service - -## 参考输出 -Synchronizing state of fail2ban.service with SysV service script with /lib/systemd/systemd-sysv-install. -Executing: /lib/systemd/systemd-sysv-install enable fail2ban -Created symlink /etc/systemd/system/multi-user.target.wants/fail2ban.service → /lib/systemd/system/fail2ban.service. -``` - -执行完成后,再次通过前面的命令检查服务自启状态。 - -后续如果想查看 `Fail2ban` 有关 `sshd` 的执行状态,可使用如下命令: - -```bash -## 检查 sshd 的执行情况 -fail2ban-client status sshd - -## 参考输出 -Status for the jail: sshd -|- Filter -| |- Currently failed: 0 -| |- Total failed: 0 -| `- File list: /var/log/auth.log -`- Actions - |- Currently banned: 0 - |- Total banned: 0 - `- Banned IP list: -``` - -如果均为 0 ,表示当前 PVE 系统没有 SSH 错误密码的尝试记录。 - - -## 2.系统时区配置 +## 1.系统时区配置 如果在安装 PVE 系统时选错了时区,导致系统时间和北京时间不一致,可以使用以下命令修正: @@ -110,7 +41,7 @@ Wed, 20 Jul 2022 16:21:28 +0800 输出结果如果和北京时间一致,则代表修改正确。 -## 3.CPU调度器配置 +## 2.CPU调度器配置 安装好 `cpufrequtils` 后,先检查当前 CPU 的调度器: @@ -228,8 +159,7 @@ watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq watch sensors ``` - -## 4.PVE 定时重启配置 +## 3.PVE 定时重启配置 有时候我们需要让 PVE 服务器周期性的定时重启,则可使用以下命令: @@ -250,10 +180,9 @@ crontab -e crontab -l ``` +## 4.PVE系统自动更新 -## 5.PVE系统自动更新 - -### 5.1.检查系统定时器 +### 4.1.检查系统定时器 配置系统自动更新之前,先检查当前系统定时器状态: @@ -275,7 +204,7 @@ Jul 16 12:03:53 hyper systemd[1]: Started Daily apt upgrade and clean activities 我们后续将手动调整该定时器的时间为,每 10 天的凌晨 02:00 进行触发。 -### 5.2.配置自动更新策略 +### 4.2.配置自动更新策略 ```bash ## 配置自动更新策略 @@ -346,7 +275,7 @@ Unattended-Upgrade::Automatic-Reboot-Time "05:00"; 仔细再仔细确认无误后,`esc` 键退出编辑模式,`:wq` 命令保存退出。 -### 5.3.重设自动更新触发器 +### 4.3.重设自动更新触发器 ```bash ## 重设自动更新触发器时间为凌晨 02:00