mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 05:52:52 +08:00
update PVE系统调整.md.
This commit is contained in:
+91
-1
@@ -200,4 +200,94 @@ crontab -l
|
||||
0 5 1,16 * * /usr/sbin/reboot
|
||||
```
|
||||
|
||||
这表示每月1、16号的5点0分执行系统重启命令。
|
||||
这表示每月1、16号的5点0分执行系统重启命令。
|
||||
|
||||
|
||||
## 5.PVE系统自动更新
|
||||
|
||||
### 5.1.检查系统定时器
|
||||
|
||||
进行自动配置之前,先检查当前系统定时器状态:
|
||||
|
||||
```bash
|
||||
## 检查系统定时器
|
||||
systemctl status apt-daily-upgrade.timer
|
||||
|
||||
## 示例输出
|
||||
● apt-daily-upgrade.timer - Daily apt upgrade and clean activities
|
||||
Loaded: loaded (/lib/systemd/system/apt-daily-upgrade.timer; enabled; vendor preset: enabled)
|
||||
Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d
|
||||
└─override.conf
|
||||
Active: active (waiting) since Sat 2022-07-16 07:03:53 CST; 4 days ago
|
||||
Trigger: Thu 2022-07-17 06:52:50 CST; 13h left
|
||||
Triggers: ● apt-daily-upgrade.service
|
||||
|
||||
Jul 16 12:03:53 hyper systemd[1]: Started Daily apt upgrade and clean activities.
|
||||
```
|
||||
|
||||
我们后续将手动调整该定时器的时间为,每10天的凌晨02:00进行触发。
|
||||
|
||||
### 5.2.配置自动更新策略
|
||||
|
||||
```bash
|
||||
## 配置自动更新策略
|
||||
dpkg-reconfigure -plow unattended-upgrades
|
||||
|
||||
## 选择 “是” (“YES”)
|
||||
## 示例输出
|
||||
Creating config file /etc/apt/apt.conf.d/20auto-upgrades with new version
|
||||
```
|
||||
|
||||
执行命令后,使用“左右”方向键进行选择,“回车”键进行确认。
|
||||
|
||||
然后开始调整 apt 的 20auto-upgrades 配置文件:
|
||||
|
||||
```bash
|
||||
## 进入 apt 的配置目录
|
||||
cd /etc/apt/apt.conf.d
|
||||
|
||||
## 编辑 20auto-upgrades 配置文件
|
||||
vim 20auto-upgrades
|
||||
|
||||
## 删除里面全部内容并填写以下内容
|
||||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "10";
|
||||
APT::Periodic::AutocleanInterval "1";
|
||||
APT::Periodic::CleanInterval "1";
|
||||
```
|
||||
|
||||
其中,用来控制 PVE 更新周期的为 `APT::Periodic::Unattended-Upgrade` 这行内容,其中的“10”表示更新周期为“10”天。
|
||||
|
||||
接下来调整 apt 的 `50unattended-upgrades` 配置文件,所有修改项目汇聚如下:
|
||||
|
||||
```bash
|
||||
## 编辑 50unattended-upgrades 配置文件
|
||||
vim 50unattended-upgrades
|
||||
|
||||
## 添加了 PVE 本身的更新项目
|
||||
"origin=Proxmox,codename=${distro_codename},label=Proxmox Debian Repository";
|
||||
|
||||
## 取消以下行的前面注释,并调整参数
|
||||
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||
|
||||
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
|
||||
|
||||
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
|
||||
|
||||
Unattended-Upgrade::Remove-Unused-Dependencies "true";
|
||||
|
||||
Unattended-Upgrade::Automatic-Reboot "true";
|
||||
|
||||
Unattended-Upgrade::Automatic-Reboot-Time "05:00";
|
||||
```
|
||||
|
||||
分别表示:
|
||||
- 增加并启用 PVE 自有仓库的更新,确保不会遗漏自有仓库的更新内容。
|
||||
- 自动修复被打断的Dpkg安装。
|
||||
- 自动移除无用的的内核包。
|
||||
- 自动移除因更新而出现的无用依赖包。
|
||||
- 自动移除以前的无用依赖包。
|
||||
- 自动重启:开启。
|
||||
- 自动重启时间:05:00。
|
||||
|
||||
因为该配置文件很长,教程中留下一份 PVE 7.2 中配置好的配置文件 [Fox_PVE_50unattended_Upgrades.conf](https://gitee.com/callmer/pve_toss_notes/blob/master/src/Fox_PVE_50unattended_Upgrades.conf),以便对比。
|
||||
Reference in New Issue
Block a user