From 517def13760a156c4e85c9d0e3d70f753fa270f3 Mon Sep 17 00:00:00 2001 From: CallMeR <9463297+callmer@user.noreply.gitee.com> Date: Sat, 15 Aug 2026 10:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20PVE=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E5=AE=9A=E6=97=B6=E9=87=8D=E5=90=AF=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02.PVE初始化配置.md | 2 +- 03.PVE系统调整.md | 43 ++++++++++------------------------------- 05.PVE制作虚拟机模板.md | 7 +++++++ 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/02.PVE初始化配置.md b/02.PVE初始化配置.md index e159ef4..0bd72a8 100644 --- a/02.PVE初始化配置.md +++ b/02.PVE初始化配置.md @@ -160,7 +160,7 @@ $ apt full-upgrade $ apt update ## 安装系统软件 -$ apt install btop lm-sensors curl tmux cronie neovim unattended-upgrades powermgmt-base sshguard knot-dnsutils +$ apt install btop lm-sensors curl tmux neovim unattended-upgrades powermgmt-base sshguard knot-dnsutils ## 安装 CPU 调度调整工具 $ apt install linux-cpupower diff --git a/03.PVE系统调整.md b/03.PVE系统调整.md index 65c5b43..5ddbfaa 100644 --- a/03.PVE系统调整.md +++ b/03.PVE系统调整.md @@ -224,32 +224,9 @@ $ watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq $ watch -d sensors ``` -## 3. PVE 定时重启 +## 3. PVE 自动更新 -有时需要让 PVE 服务器周期性的定时重启,则可执行以下命令。 - -参数表示每月 `1` 、 `16` 号的 `02:30` 执行系统重启命令。 - -```bash -## 创建 PVE 定时重启任务 -$ tee /etc/cron.d/pve-reboot >/dev/null <<'EOF' -30 2 1,16 * * root /usr/sbin/shutdown --reboot now -EOF - -## 设置定时任务文件权限 -$ chmod 0644 /etc/cron.d/pve-reboot -``` - -系统全局定时任务排期状态可使用以下命令进行查看。 - -```bash -## 查看系统定时任务 -$ cronnext -acl -``` - -## 4. PVE 自动更新 - -### 4.1.系统定时器 +### 3.1.系统定时器 配置系统自动更新之前,需检查系统当前定时器状态。 @@ -270,7 +247,7 @@ $ systemctl status apt-daily-upgrade.timer Aug 10 09:51:05 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. ``` -### 4.2.配置更新策略 +### 3.2.配置更新策略 执行以下命令,启用系统自动更新。 @@ -356,7 +333,7 @@ Unattended-Upgrade::Automatic-Reboot-Time "02:30"; ``` -### 4.3.重设触发器 +### 3.3.重设触发器 系统自动更新配置文件修改完成后,需要重设自动更新定时器,执行以下命令。 @@ -403,9 +380,9 @@ Aug 10 10:35:09 node01 systemd[1]: Stopped apt-daily-upgrade.timer - Daily apt u Aug 10 10:35:09 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities. ``` -## 5.硬件直通 +## 4.硬件直通 -### 5.1.修改 Grub +### 4.1.修改 Grub 参考官方文档 [qm_pci_passthrough](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_pci_passthrough) 和 [Pci passthrough](https://pve.proxmox.com/wiki/Pci_passthrough) 开启 PVE 硬件直通功能。 @@ -441,7 +418,7 @@ GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt" $ update-grub ``` -### 5.2.添加内核模块 +### 4.2.添加内核模块 编辑 **内核模块** 配置文件,增加必要的系统模块,执行以下命令。 @@ -464,7 +441,7 @@ EOF $ update-initramfs -u -k all ``` -### 5.3.检查硬件直通 +### 4.3.检查硬件直通 PVE 服务器重启完成后,再次使用终端工具登录,并执行以下命令检查硬件直通状态。 @@ -528,7 +505,7 @@ $ find /sys/kernel/iommu_groups/ -type l /sys/kernel/iommu_groups/9/devices/0000:00:14.1 ``` -## 6. BTRFS 调整 +## 5. BTRFS 调整 **额外说明:** - 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节 @@ -582,7 +559,7 @@ proc /proc proc defaults 0 0 /swap/swapfile none swap defaults 0 0 ``` -## 7.系统清理 +## 6.系统清理 PVE 系统配置完成后,可执行以下命令,对系统进行清理。 diff --git a/05.PVE制作虚拟机模板.md b/05.PVE制作虚拟机模板.md index 0bcf9c6..fe3d218 100644 --- a/05.PVE制作虚拟机模板.md +++ b/05.PVE制作虚拟机模板.md @@ -394,6 +394,13 @@ EOF $ sudo chmod 0644 /etc/cron.d/guest-os-reboot ``` +系统全局定时任务排期状态可使用以下命令进行查看。 + +```bash +## 查看系统定时任务 +$ sudo cronnext -acl +``` + ### 1.10.清理系统 Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对系统进行清理。