Archived
更新文案描述
This commit is contained in:
+2
-5
@@ -32,11 +32,10 @@ Components: main contrib non-free-firmware
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
```
|
||||
|
||||
这里将使用 [中国科技大(USTC)](http://mirrors.ustc.edu.cn/help/proxmox.html) 的镜像仓库进行替换,使用如下命令。
|
||||
这里将使用 [中国科技大(USTC)](http://mirrors.ustc.edu.cn/help/proxmox.html) 的镜像仓库进行替换,执行以下命令。
|
||||
|
||||
```bash
|
||||
## 配置 PVE 系统默认软件源脚本
|
||||
|
||||
$ cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
||||
Types: deb
|
||||
URIs: https://mirrors.ustc.edu.cn/debian
|
||||
@@ -62,7 +61,6 @@ EOF
|
||||
|
||||
```bash
|
||||
## 配置 PVE 系统免订阅软件源脚本
|
||||
|
||||
$ cat > /etc/apt/sources.list.d/pve-no-subscription.sources <<EOF
|
||||
Types: deb
|
||||
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve
|
||||
@@ -80,7 +78,6 @@ EOF
|
||||
|
||||
```bash
|
||||
## 配置 PVE Ceph 免订阅软件源脚本
|
||||
|
||||
$ if [ -f /etc/apt/sources.list.d/ceph.sources ]; then
|
||||
CEPH_CODENAME=`ceph -v | grep ceph | awk '{print $(NF-1)}'`
|
||||
source /etc/os-release
|
||||
@@ -161,7 +158,7 @@ $ apt full-upgrade
|
||||
$ apt update
|
||||
|
||||
## 安装系统软件
|
||||
$ apt install btop lm-sensors curl tmux neovim unzip 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
|
||||
|
||||
+29
-19
@@ -24,6 +24,20 @@ Press <enter> to keep the current choice[*], or type selection number: 2
|
||||
update-alternatives: using /usr/bin/nvim to provide /usr/bin/editor (editor) in manual mode
|
||||
```
|
||||
|
||||
若需完全禁用 `neovim` 鼠标功能;即关闭所有鼠标交互,右键行为完全交给终端 / 控制台处理,需执行以下命令。
|
||||
|
||||
```bash
|
||||
## 创建 nvim 配置目录
|
||||
$ mkdir -p /etc/xdg/nvim
|
||||
|
||||
## 配置 nvim 鼠标交互行为脚本
|
||||
$ tee /etc/xdg/nvim/sysinit.vim << 'EOF'
|
||||
set mouse=
|
||||
|
||||
EOF
|
||||
|
||||
```
|
||||
|
||||
## 1.系统时区
|
||||
|
||||
如果在安装 PVE 系统时选错了时区,导致系统时间和北京时间不一致,可以执行以下命令修正。
|
||||
@@ -210,15 +224,13 @@ WantedBy=multi-user.target
|
||||
$ systemctl daemon-reload
|
||||
```
|
||||
|
||||
执行以下命令让 `cpupower` 服务开机自启动。
|
||||
执行以下命令让 `cpupower` 服务立即启动并置为开机自启状态。
|
||||
|
||||
```bash
|
||||
## 设置 cpupower 服务开机自启
|
||||
$ systemctl enable cpupower.service
|
||||
$ systemctl enable --now cpupower.service
|
||||
```
|
||||
|
||||
修改完成后,需重启 PVE 服务器,并再次查看 CPU 调度器,检验配置文件是否生效。
|
||||
|
||||
这里提供两个额外命令,方便实时查看 CPU 当前频率和温度状况。
|
||||
|
||||
```bash
|
||||
@@ -248,7 +260,7 @@ $ crontab -e
|
||||
```bash
|
||||
## 定时任务配置项
|
||||
|
||||
30 2 1,16 * * /usr/sbin/reboot
|
||||
30 2 1,16 * * /usr/sbin/shutdown --reboot now
|
||||
|
||||
```
|
||||
|
||||
@@ -258,7 +270,7 @@ $ crontab -e
|
||||
|
||||
配置系统自动更新之前,需检查系统当前定时器状态。
|
||||
|
||||
后续将手动调整该定时器的时间,使其每 `5` 天的 `01:30` 进行触发。
|
||||
后续将手动调整该定时器的时间,使其每 `10` 天的 `01:30` 进行触发。
|
||||
|
||||
```bash
|
||||
## 检查系统定时器
|
||||
@@ -267,12 +279,12 @@ $ systemctl status apt-daily-upgrade.timer
|
||||
#### 系统定时器示例输出
|
||||
● apt-daily-upgrade.timer - Daily apt upgrade and clean activities
|
||||
Loaded: loaded (/usr/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled)
|
||||
Active: active (waiting) since Wed 2025-08-27 13:41:10 CST; 1h 37min ago
|
||||
Invocation: 26ebb62a4f6545998522fff8c4104b3e
|
||||
Trigger: Thu 2025-08-28 06:14:37 CST; 14h left
|
||||
Active: active (waiting) since Mon 2026-08-10 09:51:05 CST; 27min ago
|
||||
Invocation: edb5962fda4c4a8395cb2c04c736db45
|
||||
Trigger: Tue 2026-08-11 06:21:38 CST; 20h left
|
||||
Triggers: ● apt-daily-upgrade.service
|
||||
|
||||
Aug 27 13:41:10 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities.
|
||||
Aug 10 09:51:05 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities.
|
||||
```
|
||||
|
||||
### 4.2.配置更新策略
|
||||
@@ -289,12 +301,9 @@ $ dpkg-reconfigure -plow unattended-upgrades
|
||||
<Yes>
|
||||
```
|
||||
|
||||
进一步调整 `20auto-upgrades` 配置文件。
|
||||
开始调整 `20auto-upgrades` 配置文件。
|
||||
|
||||
```bash
|
||||
## 进入 apt 的配置目录
|
||||
$ cd /etc/apt/apt.conf.d
|
||||
|
||||
## 编辑 20auto-upgrades 配置文件
|
||||
$ editor /etc/apt/apt.conf.d/20auto-upgrades
|
||||
```
|
||||
@@ -408,13 +417,14 @@ $ systemctl status apt-daily-upgrade.timer
|
||||
Loaded: loaded (/usr/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled)
|
||||
Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d
|
||||
└─override.conf
|
||||
Active: active (waiting) since Wed 2025-08-27 15:23:29 CST; 8s ago
|
||||
Invocation: e38354f06d284894b084a52e1f19af73
|
||||
Trigger: Thu 2025-08-28 01:30:00 CST; 10h left
|
||||
Active: active (waiting) since Mon 2026-08-10 10:35:09 CST; 5s ago
|
||||
Invocation: e73c9dd167cc4814836a1da4dab015db
|
||||
Trigger: Tue 2026-08-11 01:30:00 CST; 14h left
|
||||
Triggers: ● apt-daily-upgrade.service
|
||||
|
||||
Aug 27 15:23:29 node01 systemd[1]: Stopping apt-daily-upgrade.timer - Daily apt upgrade and clean activities...
|
||||
Aug 27 15:23:29 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities.
|
||||
Aug 10 10:35:09 node01 systemd[1]: Stopping apt-daily-upgrade.timer - Daily apt upgrade and clean activities...
|
||||
Aug 10 10:35:09 node01 systemd[1]: Stopped apt-daily-upgrade.timer - Daily apt upgrade and clean activities.
|
||||
Aug 10 10:35:09 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt upgrade and clean activities.
|
||||
```
|
||||
|
||||
## 5.硬件直通
|
||||
|
||||
+1
-1
@@ -293,7 +293,7 @@ IPv6 使用 `静态` 地址后,并不影响虚拟机通过主路由获取 IPv6
|
||||
|
||||
- 系统: Debian 13
|
||||
|
||||
- 用途: 内网 DNS 服务器 ( 模板 )
|
||||
- 用途: 内网服务器 ( 模板 )
|
||||
|
||||
- 自启: 否
|
||||
|
||||
|
||||
+31
-18
@@ -8,7 +8,7 @@
|
||||
|
||||
因为 Debian 的云镜像默认使用 SSH 秘钥登录,因此切换到左侧菜单的 `控制台` 进行登录。
|
||||
|
||||

|
||||

|
||||
|
||||
在虚拟机的命令行界面,使用 `vim` 编辑器编辑 `sshd` 服务的配置文件,执行以下命令。
|
||||
|
||||
@@ -53,7 +53,6 @@ $ sudo systemctl restart ssh.service
|
||||
|
||||
```bash
|
||||
## 配置 Debian 系统默认软件源脚本
|
||||
|
||||
$ sudo bash -c 'cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
||||
Types: deb
|
||||
URIs: https://mirrors.ustc.edu.cn/debian
|
||||
@@ -162,6 +161,20 @@ Press <enter> to keep the current choice[*], or type selection number: 2
|
||||
update-alternatives: using /usr/bin/nvim to provide /usr/bin/editor (editor) in manual mode
|
||||
```
|
||||
|
||||
若需完全禁用 `neovim` 鼠标功能;即关闭所有鼠标交互,右键行为完全交给终端 / 控制台处理,需执行以下命令。
|
||||
|
||||
```bash
|
||||
## 创建 nvim 配置目录
|
||||
$ sudo mkdir -p /etc/xdg/nvim
|
||||
|
||||
## 配置 nvim 鼠标交互行为脚本
|
||||
$ sudo tee /etc/xdg/nvim/sysinit.vim << 'EOF'
|
||||
set mouse=
|
||||
|
||||
EOF
|
||||
|
||||
```
|
||||
|
||||
### 1.6.调整内核参数
|
||||
|
||||
由于该虚拟机将作为内网 DNS 服务器的克隆模板,需调整内核参数以优化性能。
|
||||
@@ -177,7 +190,7 @@ $ sudo editor /etc/sysctl.d/99-sysctl.conf
|
||||
|
||||
```bash
|
||||
# This configuration file is customized by fox,
|
||||
# Optimize sysctl parameters for local DNS server.
|
||||
# Optimize sysctl parameters for local TPL server.
|
||||
|
||||
kernel.panic = 20
|
||||
kernel.panic_on_oops = 1
|
||||
@@ -226,7 +239,7 @@ $ sudo timedatectl set-timezone Asia/Shanghai
|
||||
$ date -R
|
||||
|
||||
#### 系统时间示例输出
|
||||
Wed, 27 Aug 2025 17:02:17 +0800
|
||||
Mon, 10 Aug 2026 11:23:56 +0800
|
||||
```
|
||||
|
||||
Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需要调整为使用国内 NTP 服务器。
|
||||
@@ -268,21 +281,21 @@ $ sudo systemctl status systemd-timesyncd.service
|
||||
#### NTP 服务示例输出
|
||||
● systemd-timesyncd.service - Network Time Synchronization
|
||||
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
|
||||
Active: active (running) since Wed 2025-08-27 17:03:13 CST; 6s ago
|
||||
Invocation: 7dcb974725ac43638a4ae3df51644f84
|
||||
Active: active (running) since Mon 2026-08-10 11:24:43 CST; 5s ago
|
||||
Invocation: 95cd4555913e45d8a7235347cf3d571a
|
||||
Docs: man:systemd-timesyncd.service(8)
|
||||
Main PID: 4540 (systemd-timesyn)
|
||||
Main PID: 6516 (systemd-timesyn)
|
||||
Status: "Contacted time server 203.107.6.88:123 (ntp.aliyun.com)."
|
||||
Tasks: 2 (limit: 2317)
|
||||
Memory: 1.5M (peak: 2.2M)
|
||||
CPU: 261ms
|
||||
Tasks: 2 (limit: 2189)
|
||||
Memory: 1.6M (peak: 2.3M)
|
||||
CPU: 136ms
|
||||
CGroup: /system.slice/systemd-timesyncd.service
|
||||
└─4540 /usr/lib/systemd/systemd-timesyncd
|
||||
└─6516 /usr/lib/systemd/systemd-timesyncd
|
||||
|
||||
Aug 27 17:03:12 TPL01 systemd[1]: Starting systemd-timesyncd.service - Network Time Synchronization...
|
||||
Aug 27 17:03:13 TPL01 systemd[1]: Started systemd-timesyncd.service - Network Time Synchronization.
|
||||
Aug 27 17:03:13 TPL01 systemd-timesyncd[4540]: Contacted time server 203.107.6.88:123 (ntp.aliyun.com).
|
||||
Aug 27 17:03:13 TPL01 systemd-timesyncd[4540]: Initial clock synchronization to Wed 2025-08-27 17:03:13.200663 CST.
|
||||
Aug 10 11:24:43 TPL01 systemd[1]: Starting systemd-timesyncd.service - Network Time Synchronization...
|
||||
Aug 10 11:24:43 TPL01 systemd[1]: Started systemd-timesyncd.service - Network Time Synchronization.
|
||||
Aug 10 11:24:43 TPL01 systemd-timesyncd[6516]: Contacted time server 203.107.6.88:123 (ntp.aliyun.com).
|
||||
Aug 10 11:24:43 TPL01 systemd-timesyncd[6516]: Initial clock synchronization to Mon 2026-08-10 11:24:43.569158 CST.
|
||||
```
|
||||
|
||||
### 1.8.配置自动更新
|
||||
@@ -306,7 +319,7 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
||||
<Yes>
|
||||
```
|
||||
|
||||
进一步调整 `20auto-upgrades` 配置文件。
|
||||
开始调整 `20auto-upgrades` 配置文件。
|
||||
|
||||
```bash
|
||||
## 编辑 20auto-upgrades 配置文件
|
||||
@@ -334,7 +347,7 @@ APT::Periodic::CleanInterval "1";
|
||||
$ sudo editor /etc/apt/apt.conf.d/50unattended-upgrades
|
||||
```
|
||||
|
||||
因为该配置文件很长,完整的配置文件可查看 [debian_dns_50unattended_upgrades.conf](./src/debian/debian_dns_50unattended_upgrades.conf) 以便对比。
|
||||
因为该配置文件很长,完整的配置文件可查看 [debian_tpl_50unattended_upgrades.conf](./src/debian/debian_tpl_50unattended_upgrades.conf) 以便对比。
|
||||
|
||||
```bash
|
||||
## 删除以下行前面的注释符 // ,代表启用
|
||||
@@ -405,7 +418,7 @@ $ sudo crontab -e
|
||||
```bash
|
||||
## 定时任务配置项
|
||||
|
||||
30 4 8,24 * * /usr/sbin/reboot
|
||||
30 4 8,24 * * /usr/sbin/shutdown --reboot now
|
||||
|
||||
```
|
||||
|
||||
|
||||
+19
-6
@@ -56,7 +56,6 @@ $ sudo systemctl restart ssh.service
|
||||
|
||||
```bash
|
||||
## 配置 Debian 系统默认软件源脚本
|
||||
|
||||
$ sudo bash -c 'cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
||||
Types: deb
|
||||
URIs: https://mirrors.ustc.edu.cn/debian
|
||||
@@ -112,7 +111,7 @@ $ sudo apt install qemu-guest-agent btop curl tmux logrotate cron neovim zsh git
|
||||
$ sudo apt install unattended-upgrades powermgmt-base
|
||||
|
||||
## 安装网络工具
|
||||
$ sudo apt install ethtool dnsmasq conntrack nftables sshguard lsof knot-dnsutils
|
||||
$ sudo apt install nftables sshguard lsof knot-dnsutils ethtool dnsmasq conntrack
|
||||
|
||||
## 安装 TS
|
||||
$ curl -fsSL https://tailscale.com/install.sh | sh
|
||||
@@ -168,6 +167,20 @@ Press <enter> to keep the current choice[*], or type selection number: 2
|
||||
update-alternatives: using /usr/bin/nvim to provide /usr/bin/editor (editor) in manual mode
|
||||
```
|
||||
|
||||
若需完全禁用 `neovim` 鼠标功能;即关闭所有鼠标交互,右键行为完全交给终端 / 控制台处理,需执行以下命令。
|
||||
|
||||
```bash
|
||||
## 创建 nvim 配置目录
|
||||
$ sudo mkdir -p /etc/xdg/nvim
|
||||
|
||||
## 配置 nvim 鼠标交互行为脚本
|
||||
$ sudo tee /etc/xdg/nvim/sysinit.vim << 'EOF'
|
||||
set mouse=
|
||||
|
||||
EOF
|
||||
|
||||
```
|
||||
|
||||
### 1.6.调整内核模块
|
||||
|
||||
编辑 **内核模块** 配置文件,执行以下命令。
|
||||
@@ -327,7 +340,7 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
||||
<Yes>
|
||||
```
|
||||
|
||||
进一步调整 `20auto-upgrades` 配置文件。
|
||||
开始调整 `20auto-upgrades` 配置文件。
|
||||
|
||||
```bash
|
||||
## 编辑 20auto-upgrades 配置文件
|
||||
@@ -336,13 +349,13 @@ $ sudo editor /etc/apt/apt.conf.d/20auto-upgrades
|
||||
|
||||
清空当前全部配置项后,输入以下内容,并保存。
|
||||
|
||||
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`7` 表示更新周期为 `7` 天。
|
||||
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`5` 表示更新周期为 `5` 天。
|
||||
|
||||
```bash
|
||||
## 系统更新周期配置项
|
||||
|
||||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "7";
|
||||
APT::Periodic::Unattended-Upgrade "5";
|
||||
APT::Periodic::AutocleanInterval "1";
|
||||
APT::Periodic::CleanInterval "1";
|
||||
|
||||
@@ -673,7 +686,7 @@ WantedBy=multi-user.target
|
||||
$ sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
执行以下命令让 `tailscale-nic-optim` 服务开机自启动。
|
||||
执行以下命令让 `tailscale-nic-optim` 服务立即启动并置为开机自启状态。
|
||||
|
||||
```bash
|
||||
## 设置 tailscale-nic-optim 服务开机自启
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 199 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 140 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 127 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 91 KiB |
@@ -1,5 +1,5 @@
|
||||
# This configuration file is customized by fox,
|
||||
# Optimize sysctl parameters for local DNS server.
|
||||
# Optimize sysctl parameters for local TPL server.
|
||||
|
||||
kernel.panic = 20
|
||||
kernel.panic_on_oops = 1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "7";
|
||||
APT::Periodic::Unattended-Upgrade "5";
|
||||
APT::Periodic::AutocleanInterval "1";
|
||||
APT::Periodic::CleanInterval "1";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "5";
|
||||
APT::Periodic::Unattended-Upgrade "10";
|
||||
APT::Periodic::AutocleanInterval "1";
|
||||
APT::Periodic::CleanInterval "1";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user