Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0f4ef53a0 | ||
|
|
64595e5190 | ||
|
|
4a53123479 | ||
|
|
99b82b452b | ||
|
|
cf082486fa | ||
|
|
e87732ed00 | ||
|
|
0d97a04ea9 | ||
|
|
517def1376 | ||
|
|
a0a3a02a18 | ||
|
|
2fadc58a84 | ||
|
|
9beb1fba6a | ||
|
|
abccbcad01 | ||
|
|
a7bf1b06eb | ||
|
|
e6aab0f222 | ||
|
|
fcc5c2b019 | ||
|
|
e37d437f0f | ||
|
|
14595919e4 | ||
|
|
88e6f8b867 | ||
|
|
079898b167 | ||
|
|
345001bb14 | ||
|
|
12b5a4aec4 | ||
|
|
a41bd56bc3 | ||
|
|
f8cc6a7689 | ||
|
|
966660a77f | ||
|
|
7ebf3c80c8 | ||
|
|
fbd1e44d11 | ||
|
|
f991ec8525 | ||
|
|
996959f740 | ||
|
|
ed7f9c5fc9 | ||
|
|
730225be93 | ||
|
|
e29dc62978 | ||
|
|
13b46590d0 | ||
|
|
1984f7689e | ||
|
|
698969cadb | ||
|
|
47ebcd6628 | ||
|
|
190342575e | ||
|
|
68dcf6ab21 | ||
|
|
0a926f1bae | ||
|
|
5ce44529bb | ||
|
|
67378607b3 | ||
|
|
df1b4e8907 | ||
|
|
3989c31582 | ||
|
|
f5d82f7435 | ||
|
|
1794aa74fa | ||
|
|
fce332798e | ||
|
|
4a77288f57 | ||
|
|
4ddcd01688 | ||
|
|
ea2221c54c | ||
|
|
b9473852b9 | ||
|
|
8b8fc3e773 | ||
|
|
d2203618af | ||
|
|
96a23ad48f | ||
|
|
9f6a2fe42d | ||
|
|
55a391f95d | ||
|
|
68ae3b55eb | ||
|
|
edcefa98b3 | ||
|
|
96356ac5d1 | ||
|
|
e0ccdbd5db | ||
|
|
0b4d71977f | ||
|
|
93ffd7b960 | ||
|
|
bf387d1584 | ||
|
|
ae92d79d83 | ||
|
|
44a1ee787c | ||
|
|
578d953950 | ||
|
|
792ce9e9e0 | ||
|
|
df3cf10287 | ||
|
|
63316af2d6 | ||
|
|
77a41c719a | ||
|
|
5efe450d78 | ||
|
|
2131e6ae58 | ||
|
|
aefb7ceb00 | ||
|
|
c6ebb95ed3 | ||
|
|
4aaa101400 | ||
|
|
85c2d70b81 | ||
|
|
ade7a53cad | ||
|
|
c1812b2a45 | ||
|
|
c9aa60ecfd | ||
|
|
d912edeb89 | ||
|
|
115cbb68fc | ||
|
|
9082083465 | ||
|
|
3921329fe2 | ||
|
|
31be875c67 | ||
|
|
626dca3fd9 | ||
|
|
1ad903bf10 | ||
|
|
c7c5270356 | ||
|
|
d4f8fe6b52 | ||
|
|
9013217734 | ||
|
|
9995008d1d | ||
|
|
63c299f206 | ||
|
|
6f19505b83 | ||
|
|
53221483fd | ||
|
|
b0ede429fc | ||
|
|
c1446daf89 | ||
|
|
5b80990bd5 | ||
|
|
117020b8b4 | ||
|
|
d49c98b6df | ||
|
|
264bb156ff | ||
|
|
07efdcb28f | ||
|
|
fb78eec84e | ||
|
|
f5e85ddbc2 | ||
|
|
97ffd13089 | ||
|
|
8f08c4af81 | ||
|
|
1edfd2c06f | ||
|
|
fc27f25f94 | ||
|
|
5f8f9603dc | ||
|
|
c768194983 | ||
|
|
509e328c03 | ||
|
|
1dd2c5ae24 | ||
|
|
ea74679b4a | ||
|
|
8a6bdbe207 | ||
|
|
7c6c92d7ed | ||
|
|
01f00f4bc7 | ||
|
|
6d5693a73a | ||
|
|
a0c8b88bab | ||
|
|
1fe6812f30 | ||
|
|
19f5d89152 | ||
|
|
5e228452ec | ||
|
|
1e52d61178 | ||
|
|
d425c1275b | ||
|
|
b129dd215d | ||
|
|
613c562c1c | ||
|
|
184508f0fd | ||
|
|
2b24267c0c | ||
|
|
b5a44c52b2 | ||
|
|
1606e0c74b | ||
|
|
5293258eb8 | ||
|
|
1c88c7327f | ||
|
|
b3fb776f91 |
@@ -6,15 +6,11 @@ PVE 系统正式安装之前,需要准备 PVE 的安装镜像和一些必要
|
|||||||
|
|
||||||
PVE 下载地址:[Proxmox Virtual Environment](https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso)
|
PVE 下载地址:[Proxmox Virtual Environment](https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso)
|
||||||
|
|
||||||
页面中有多个 PVE 相关文件,本文以目前最新的 `Proxmox VE 8.3-1 ISO Installer` 作为演示。
|
页面中有多个 PVE 相关文件,本文以目前最新的 `Proxmox VE 9.x ISO Installer` 作为演示。
|
||||||
|
|
||||||
点击 `Proxmox VE 8.x ISO Installer` 链接,进入 PVE 下载页面。
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
下载 ISO 时请注意 `SHA256SUM` ,后续将使用该校验信息对下载下来的 ISO 进行校验,以确保 ISO 文件的完整性。
|
下载 ISO 时请注意 `SHA256SUM` ,后续将使用该校验信息对下载下来的 ISO 进行校验,以确保 ISO 文件的完整性。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 0.2.启动盘制作工具
|
### 0.2.启动盘制作工具
|
||||||
|
|
||||||
@@ -24,11 +20,9 @@ PVE 下载地址:[Proxmox Virtual Environment](https://www.proxmox.com/en/down
|
|||||||
|
|
||||||
官方网站地址:https://www.ventoy.net/cn/index.html
|
官方网站地址:https://www.ventoy.net/cn/index.html
|
||||||
|
|
||||||
强烈推荐的引导盘制作工具,优点是可以在一个 U 盘中放入复数个可引导的 ISO 文件。
|
其优点在于可在单个 U 盘内存储多个可引导 ISO 文件,省去多次格式化 U 盘并写入 ISO 的操作,使用便捷。
|
||||||
|
|
||||||
免去了多次格式化 U 盘再写入 ISO 文件的操作,非常友好。
|
缺点是仅支持 Windows 与 Linux 系统,且部分机型可能无法在 UEFI 模式下启用 Secure Boot(安全启动)。
|
||||||
|
|
||||||
缺点是只支持 Windows 、Linux 。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -52,7 +46,7 @@ PVE 下载地址:[Proxmox Virtual Environment](https://www.proxmox.com/en/down
|
|||||||
|
|
||||||
### 0.3.终端工具
|
### 0.3.终端工具
|
||||||
|
|
||||||
考虑到配置 PVE 服务器、路由器、DNS 服务器时,需要在 CLI 中输入命令,因此这里推荐几个常用的终端工具。
|
考虑到配置 PVE 服务器、路由器及 DNS 服务器时需在 CLI 中执行命令,以下推荐几款常用终端工具。
|
||||||
|
|
||||||
#### Windows Terminal
|
#### Windows Terminal
|
||||||
|
|
||||||
@@ -84,19 +78,21 @@ Microsoft 官方终端工具,可以在 Github 平台或 Microsoft 应用商店
|
|||||||
|
|
||||||
在设置 BIOS 时需要注意以下几点:
|
在设置 BIOS 时需要注意以下几点:
|
||||||
|
|
||||||
- 建议暂时关闭 **安全启动**
|
- 确保启用了硬件虚拟化支持
|
||||||
|
|
||||||
- 确保打开硬件虚拟化支持
|
- 确保启用了设备来电自启动
|
||||||
|
|
||||||
- 确保设备来电自动启动
|
|
||||||
|
|
||||||
- 对于不支持 `UEFI` 启动的设备,检查 `Legacy` 引导模式
|
|
||||||
|
|
||||||
- 检查 CPU 的功耗设置(可选)
|
- 检查 CPU 的功耗设置(可选)
|
||||||
|
|
||||||
|
- PVE 8.1 及后续版本支持安全启动,详情参考 [PVE - Secure Boot Setup](https://pve.proxmox.com/wiki/Secure_Boot_Setup)
|
||||||
|
|
||||||
|
- 若通过 Ventoy 引导安装 PVE 系统,建议参考 [UEFI 模式安全启动操作说明](https://www.ventoy.net/cn/doc_secure.html) 或 **临时关闭** 安全启动
|
||||||
|
|
||||||
|
- 对设备安全性有要求时,建议使用 Etcher 工具制作启动 U 盘并直接安装 PVE 系统
|
||||||
|
|
||||||
### 1.1.设备引导
|
### 1.1.设备引导
|
||||||
|
|
||||||
使用 Ventoy 进行设备引导后,出现如下画面,选择 PVE 的安装 ISO 。
|
使用 Ventoy 进行设备引导后出现如下画面,需选择 PVE 的安装 ISO 进行系统引导。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -118,23 +114,23 @@ Microsoft 官方终端工具,可以在 Github 平台或 Microsoft 应用商店
|
|||||||
|
|
||||||
使用 `方向键` 选择第一项 `Install Proxmox VE (Graphical)` 图形化安装界面,按键盘 `Enter` 进入下一步骤。
|
使用 `方向键` 选择第一项 `Install Proxmox VE (Graphical)` 图形化安装界面,按键盘 `Enter` 进入下一步骤。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
设备将继续跑码,直到出现最终用户许可协议 EULA ,按键盘组合键 `ALT + N ` 进入下一步骤。
|
设备将继续跑码,直到出现最终用户许可协议 EULA ,按键盘组合键 `ALT + N ` 进入下一步骤。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.3. PVE 硬盘选项
|
### 1.3. PVE 硬盘选项
|
||||||
|
|
||||||
此时会出现 `Target Harddisk` 选项,会显示出设备中存在的硬盘列表,可通过下拉框选择安装 PVE 的目标硬盘。
|
此时会出现 `Target Harddisk` 选项,会显示出设备中存在的硬盘列表,可通过下拉框选择安装 PVE 的目标硬盘。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
点击硬盘列表右侧的 `Options` ,对 PVE 的硬盘安装参数进行一些调整。
|
点击硬盘列表右侧的 `Options` ,对 PVE 的硬盘安装参数进行一些调整。
|
||||||
|
|
||||||
推荐将 `Filesystem` 也就是硬盘的文件系统,设置成 `xfs` 。
|
推荐将 `Filesystem` 也就是硬盘的文件系统,设置成 `xfs` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.4. PVE 时区选项
|
### 1.4. PVE 时区选项
|
||||||
|
|
||||||
@@ -142,7 +138,7 @@ Microsoft 官方终端工具,可以在 Github 平台或 Microsoft 应用商店
|
|||||||
|
|
||||||
在 `Contry` 处手动输入 `China` ,下方的 `Time zone` 将自动变更为 `Asia/Shanghai` 。
|
在 `Contry` 处手动输入 `China` ,下方的 `Time zone` 将自动变更为 `Asia/Shanghai` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.5. PVE 账户与邮箱
|
### 1.5. PVE 账户与邮箱
|
||||||
|
|
||||||
@@ -150,7 +146,7 @@ PVE 为最关键的虚拟化层,建议使用强密码,包含大小写字母
|
|||||||
|
|
||||||
`Email` 必须为一个 “合法” 的邮箱地址,不然系统会判定邮箱地址不合法并拒绝继续安装。
|
`Email` 必须为一个 “合法” 的邮箱地址,不然系统会判定邮箱地址不合法并拒绝继续安装。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.6. PVE 网络设置
|
### 1.6. PVE 网络设置
|
||||||
|
|
||||||
@@ -158,7 +154,7 @@ PVE 为最关键的虚拟化层,建议使用强密码,包含大小写字母
|
|||||||
|
|
||||||
而某些设备,其物理网口顺序与该页面显示的网口顺序 **不一致** ,因此保持默认设置即可。
|
而某些设备,其物理网口顺序与该页面显示的网口顺序 **不一致** ,因此保持默认设置即可。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
FQDN 为 PVE 的域,PVE 将使用 FQDN 中的二级域名作为其主机名。
|
FQDN 为 PVE 的域,PVE 将使用 FQDN 中的二级域名作为其主机名。
|
||||||
|
|
||||||
@@ -168,7 +164,7 @@ FQDN 为 PVE 的域,PVE 将使用 FQDN 中的二级域名作为其主机名。
|
|||||||
|
|
||||||
未来主路由的 IPv4 地址为 `172.16.1.1` ,因此均使用该地址作为 PVE 的网关地址和 DNS 地址。
|
未来主路由的 IPv4 地址为 `172.16.1.1` ,因此均使用该地址作为 PVE 的网关地址和 DNS 地址。
|
||||||
|
|
||||||
当 PVE 安装完成后, 将使用 PVE 提供的 WEB 管理页面,进一步对该管理口的设置进行调整。
|
PVE 安装完成后,可通过其提供的 Web 管理界面,进一步调整管理口的相关设置。
|
||||||
|
|
||||||
|参数|值|说明|
|
|参数|值|说明|
|
||||||
|--|--|--|
|
|--|--|--|
|
||||||
@@ -177,17 +173,17 @@ FQDN 为 PVE 的域,PVE 将使用 FQDN 中的二级域名作为其主机名。
|
|||||||
|Gateway|`172.16.1.1`|设置 PVE IPv4 网关|
|
|Gateway|`172.16.1.1`|设置 PVE IPv4 网关|
|
||||||
|DNS Server|`172.16.1.1`|设置 PVE IPv4 DNS |
|
|DNS Server|`172.16.1.1`|设置 PVE IPv4 DNS |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.7. PVE 参数确认
|
### 1.7. PVE 参数确认
|
||||||
|
|
||||||
该页面会显示当前 PVE 的安装配置总览,确认无误后即可开始安装。
|
该页面会显示当前 PVE 的安装配置总览,确认无误后即可开始安装。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
安装完成后,PVE 会告知用户登录的 `IP 地址` 和 `端口` 。
|
安装完成后,PVE 会告知用户登录的 `IP 地址` 和 `端口` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 2. PVE 安装后检查
|
## 2. PVE 安装后检查
|
||||||
|
|
||||||
@@ -211,9 +207,9 @@ $ cat /etc/fstab
|
|||||||
$ cat /etc/os-release
|
$ cat /etc/os-release
|
||||||
```
|
```
|
||||||
|
|
||||||
此处显示出 PVE 底层使用的是 Debian 的系统,代号为 `bookworm` ,该代号后续会使用到。
|
此处显示出 PVE 底层使用的是 Debian 的系统,代号为 `trixie` ,该代号后续会使用到。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
至此 PVE 的安装步骤已经完成。
|
至此 PVE 的安装步骤已经完成。
|
||||||
|
|
||||||
|
|||||||
@@ -2,89 +2,96 @@
|
|||||||
|
|
||||||
在上一篇文章 [01.PVE系统安装](./01.PVE系统安装.md) 中,从刚装好的 PVE 系统中获取了系统的一些参数。
|
在上一篇文章 [01.PVE系统安装](./01.PVE系统安装.md) 中,从刚装好的 PVE 系统中获取了系统的一些参数。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
此处显示出 PVE 底层使用的是 Debian 的系统,代号为 `bookworm` 。
|
此处显示出 PVE 底层使用的是 Debian 的系统,代号为 `trixie` 。
|
||||||
|
|
||||||
为了后续能对 PVE 系统进行升级,需要更换其镜像仓库,也就是大家熟知的软件源。
|
为了后续能对 PVE 系统进行升级,需要更换其镜像仓库,也就是大家熟知的软件源。
|
||||||
|
|
||||||
由于目前处于 **“离线”** 安装状态,因此更换完软件源后,在没有网络的情况下无法对系统更新。
|
当前处于 “离线” 安装状态,更换软件源后,因无网络连接,无法执行系统更新操作。
|
||||||
|
|
||||||
### 1.1.系统软件源
|
### 1.1.系统软件源
|
||||||
|
|
||||||
使用终端工具登录到 PVE 服务器,首先对现有的软件源配置进行备份。
|
使用终端工具登录到 PVE 服务器,查看现有软件源配置文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 进入系统软件源配置目录
|
## 查看系统默认软件源
|
||||||
$ cd /etc/apt
|
$ cat /etc/apt/sources.list.d/debian.sources
|
||||||
|
|
||||||
## 查看系统默认镜像配置
|
#### 系统默认软件源示例输出
|
||||||
$ cat sources.list
|
Types: deb
|
||||||
|
URIs: http://deb.debian.org/debian/
|
||||||
|
Suites: trixie trixie-updates
|
||||||
|
Components: main contrib non-free-firmware
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
## 将默认软件源配置文件进行备份
|
Types: deb
|
||||||
$ cp sources.list sources.list.bak
|
URIs: http://security.debian.org/debian-security/
|
||||||
|
Suites: trixie-security
|
||||||
|
Components: main contrib non-free-firmware
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
```
|
```
|
||||||
|
|
||||||
系统默认镜像配置记录如下。
|
这里将使用 [中国科技大(USTC)](http://mirrors.ustc.edu.cn/help/proxmox.html) 的镜像仓库进行替换,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
deb http://ftp.debian.org/debian bookworm main contrib
|
## 配置 PVE 系统默认软件源脚本
|
||||||
|
$ tee /etc/apt/sources.list.d/debian.sources >/dev/null <<'EOF'
|
||||||
|
Types: deb
|
||||||
|
URIs: https://mirrors.ustc.edu.cn/debian
|
||||||
|
Suites: trixie trixie-updates
|
||||||
|
Components: main contrib non-free non-free-firmware
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
deb http://ftp.debian.org/debian bookworm-updates main contrib
|
Types: deb
|
||||||
|
URIs: https://mirrors.ustc.edu.cn/debian-security
|
||||||
# security updates
|
Suites: trixie-security
|
||||||
deb http://security.debian.org bookworm-security main contrib
|
Components: main contrib non-free non-free-firmware
|
||||||
```
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
这里我将使用 [中国科技大(USTC)](http://mirrors.ustc.edu.cn/help/proxmox.html) 的镜像仓库进行替换,使用如下命令。
|
|
||||||
|
|
||||||
**注意:该命令为两行,在输入时请逐行输入并回车执行。**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 替换系统软件仓库
|
|
||||||
|
|
||||||
$ sed -i 's|^deb http://ftp.debian.org|deb https://mirrors.ustc.edu.cn|g' /etc/apt/sources.list
|
|
||||||
|
|
||||||
$ sed -i 's|^deb http://security.debian.org|deb https://mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
如果希望能更新 CPU 的 `microcode` ,则需要手动添加镜像 `non-free` 、 `non-free-firmware` 参数,完整系统源示例如下。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
|
|
||||||
|
|
||||||
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
|
|
||||||
|
|
||||||
# security updates
|
|
||||||
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.2. PVE 软件源
|
### 1.2. PVE 软件源
|
||||||
|
|
||||||
默认情况下,PVE 额外启用了 2 个官方源,且为订阅收费制,因此需要替换为免费源。
|
默认情况下,PVE 额外启用了 2 个官方源,且为订阅收费制,因此需要替换为免订阅源。
|
||||||
|
|
||||||
首先创建 PVE 免费软件源,执行以下命令。
|
首先创建 PVE 免订阅软件源,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 PVE 免费软件源
|
## 配置 PVE 系统免订阅软件源脚本
|
||||||
|
$ tee /etc/apt/sources.list.d/pve-no-subscription.sources >/dev/null <<'EOF'
|
||||||
$ source /etc/os-release
|
Types: deb
|
||||||
|
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve
|
||||||
$ echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve $VERSION_CODENAME pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
|
Suites: trixie
|
||||||
|
Components: pve-no-subscription
|
||||||
|
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
对于 Proxmox Backup Server 和 Proxmox Mail Gateway,请将以上命令中的 `pve` 分别替换为 `pbs` 和 `pmg` 。
|
对于 Proxmox Backup Server 和 Proxmox Mail Gateway,请将以上命令路径中的 `pve` 分别替换为 `pbs` 和 `pmg` 。
|
||||||
|
|
||||||
进一步创建 PVE Ceph 免费软件源,Ceph 软件源为 PVE 8 之后默认安装,执行以下命令。
|
进一步创建 PVE Ceph 免订阅软件源,Ceph 软件源为 PVE 8 之后默认安装,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 PVE Ceph 免费软件源脚本
|
## 配置 PVE Ceph 免订阅软件源脚本
|
||||||
|
$ if [ -f /etc/apt/sources.list.d/ceph.sources ]; then
|
||||||
|
(
|
||||||
|
. /etc/os-release
|
||||||
|
CEPH_CODENAME=$(ceph -v | awk '/^ceph version / { print $(NF - 1); exit }')
|
||||||
|
|
||||||
if [ -f /etc/apt/sources.list.d/ceph.list ]; then
|
if [ -z "$CEPH_CODENAME" ] || [ -z "${VERSION_CODENAME:-}" ]; then
|
||||||
CEPH_CODENAME=`ceph -v | grep ceph | awk '{print $(NF-1)}'`
|
echo "Unable to determine Ceph or Debian codename." >&2
|
||||||
source /etc/os-release
|
exit 1
|
||||||
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME $VERSION_CODENAME no-subscription" > /etc/apt/sources.list.d/ceph-no-subscription.list
|
fi
|
||||||
|
|
||||||
|
tee /etc/apt/sources.list.d/pve-ceph-no-subscription.sources >/dev/null <<EOF
|
||||||
|
Types: deb
|
||||||
|
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME
|
||||||
|
Suites: $VERSION_CODENAME
|
||||||
|
Components: no-subscription
|
||||||
|
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -94,7 +101,7 @@ fi
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 删除付费软件源
|
## 删除付费软件源
|
||||||
$ rm -rvf /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/ceph.list
|
$ rm -rvf /etc/apt/sources.list.d/pve-enterprise.sources /etc/apt/sources.list.d/ceph.sources
|
||||||
```
|
```
|
||||||
|
|
||||||
创建完成后对其进行检查。
|
创建完成后对其进行检查。
|
||||||
@@ -104,13 +111,7 @@ $ rm -rvf /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/ce
|
|||||||
$ cat /etc/apt/sources.list.d/*
|
$ cat /etc/apt/sources.list.d/*
|
||||||
```
|
```
|
||||||
|
|
||||||
如果输出结果中有 USTC 的镜像地址,则表示命令已经正确执行。
|
如果输出结果中均为 USTC 的镜像地址,则表示命令已经正确执行。
|
||||||
|
|
||||||
```bash
|
|
||||||
#### PVE 免费软件源示例输出
|
|
||||||
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription
|
|
||||||
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.3. PVE CT 源
|
### 1.3. PVE CT 源
|
||||||
|
|
||||||
@@ -119,11 +120,8 @@ deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
|
|||||||
由于该功能暂时未被使用,因此本文只做记录。
|
由于该功能暂时未被使用,因此本文只做记录。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 备份 CT Templates 源
|
|
||||||
$ cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm.bak
|
|
||||||
|
|
||||||
## 替换 CT Templates 链接
|
## 替换 CT Templates 链接
|
||||||
$ sed -i 's|http://download.proxmox.com|https://mirrors.ustc.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
|
$ sed -i.bak 's|http://download.proxmox.com|https://mirrors.ustc.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
|
||||||
|
|
||||||
## 重启 PVE API 守护进程
|
## 重启 PVE API 守护进程
|
||||||
$ systemctl restart pvedaemon.service
|
$ systemctl restart pvedaemon.service
|
||||||
@@ -136,7 +134,7 @@ $ pveam update
|
|||||||
|
|
||||||
更换完成系统源之后,需要同步系统源数据。
|
更换完成系统源之后,需要同步系统源数据。
|
||||||
|
|
||||||
考虑到 **“离线”** 安装时无法同步系统源,因此该步骤可以等到 PVE 正确连接 Internet 后再执行。
|
因 “离线” 安装时无法同步系统源,此步骤可待 PVE 成功连接 Internet 后再执行。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 清理软件包
|
## 清理软件包
|
||||||
@@ -151,49 +149,52 @@ $ apt full-upgrade
|
|||||||
|
|
||||||
## 2.安装必要软件
|
## 2.安装必要软件
|
||||||
|
|
||||||
安装软件前,同样需要让 PVE 能够访问外网。
|
|
||||||
|
|
||||||
安装 `iperf3` 后,系统将询问是否将其作为系统服务开机自启,选择 `no` 即可。
|
安装 `iperf3` 后,系统将询问是否将其作为系统服务开机自启,选择 `no` 即可。
|
||||||
|
|
||||||
其中 `unattended-upgrades` 为系统自动更新服务,后续会对其进行配置。
|
其中 `unattended-upgrades` 为系统自动更新服务,后续会对其进行配置。
|
||||||
|
|
||||||
`linux-cpupower` 为 CPU 调度器的配置工具,后续会对 CPU 调度算法进行调整。
|
`linux-cpupower` 为 CPU 调度器的配置工具,后续会对 CPU 调度器进行调整。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 同步镜像仓库
|
## 同步镜像仓库
|
||||||
$ apt update
|
$ apt update
|
||||||
|
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ apt install btop lm-sensors unzip neovim tmux unattended-upgrades powermgmt-base
|
$ apt install btop curl knot-dnsutils lm-sensors neovim powermgmt-base unattended-upgrades sshguard tmux
|
||||||
|
|
||||||
## 安装网络工具
|
|
||||||
$ apt install iperf iperf3 iftop sshguard openvswitch-switch
|
|
||||||
|
|
||||||
## 安装 CPU 调度调整工具
|
## 安装 CPU 调度调整工具
|
||||||
$ apt install linux-cpupower
|
$ apt install linux-cpupower
|
||||||
|
|
||||||
## 根据 CPU 厂商安装 CPU 微码工具
|
|
||||||
$ apt install intel-microcode (amd64-microcode)
|
|
||||||
|
|
||||||
## 更新 PCI 数据库
|
## 更新 PCI 数据库
|
||||||
$ update-pciids
|
$ update-pciids
|
||||||
|
|
||||||
|
## 安装 Open vSwitch(可选)
|
||||||
|
$ apt install openvswitch-switch
|
||||||
|
|
||||||
|
## 安装网络检测工具(可选)
|
||||||
|
$ apt install iftop iperf iperf3
|
||||||
|
|
||||||
|
## 根据 CPU 厂商安装 CPU 微码工具(可选,现已默认安装)
|
||||||
|
$ apt install intel-microcode (amd64-microcode)
|
||||||
|
|
||||||
|
## 刷新 systemd 日志分类索引
|
||||||
|
$ journalctl --update-catalog
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3.配置 PVE 网络
|
## 3.配置 PVE 网络
|
||||||
|
|
||||||
设置电脑的 IPv4 地址为静态地址,电脑 IPv4 地址段需要与 PVE 的地址段保持一致。
|
设置电脑的 IPv4 地址为静态地址,电脑 IPv4 地址段需要与 PVE 的地址段保持一致。
|
||||||
|
|
||||||
用网线将电脑的网口与 PVE 的管理网口,此时应该为编号最小的第一个网口,相连接。
|
用网线连接电脑网口与 PVE 管理网口(此时应为编号最小的第一个网口)。
|
||||||
|
|
||||||
访问 PVE 的 WEB 管理界面,对 PVE 的网络进行一些调整。
|
访问 PVE 的 Web 管理界面,根据 **网络设备** 规划调整其网络配置。
|
||||||
|
|
||||||
根据 **网络设备** 规划, PVE 中虚拟机规划如下。
|
|
||||||
|
|
||||||
|系统|作用|说明|
|
|系统|作用|说明|
|
||||||
|--|--|--|
|
|--|--|--|
|
||||||
|RouterOS|主路由|PPPoE 拨号上网|
|
|RouterOS|主路由|PPPoE 拨号上网|
|
||||||
|Debian12|Linux 服务器|内网 DNS 服务器|
|
|Debian|DNS 服务器|内网 DNS 服务器|
|
||||||
|OpenWrt|旁路由|内网插件服务|
|
|Debian|TS 服务器|内网 TS 组网服务器|
|
||||||
|
|OpenWrt|旁路网关|内网插件服务|
|
||||||
|
|
||||||
根据 **内部网络地址** 规划,PVE IP 地址规划如下。
|
根据 **内部网络地址** 规划,PVE IP 地址规划如下。
|
||||||
|
|
||||||
@@ -203,22 +204,18 @@ $ update-pciids
|
|||||||
||网关地址|`172.16.1.1`|PVE IPv4 网关|
|
||网关地址|`172.16.1.1`|PVE IPv4 网关|
|
||||||
||DNS 地址|`172.16.1.1`|PVE IPv4 DNS 服务器|
|
||DNS 地址|`172.16.1.1`|PVE IPv4 DNS 服务器|
|
||||||
|IPv6|管理地址|`fdac::fe`|PVE IPv6 地址(可选)|
|
|IPv6|管理地址|`fdac::fe`|PVE IPv6 地址(可选)|
|
||||||
||网关地址|`-`|IPv6 网关将使用 `SLAAC` 自动配置|
|
||网关地址|`-`|PVE IPv6 网关将使用 `SLAAC` 自动配置|
|
||||||
||DNS 地址|`fdac::1`|PVE IPv6 DNS 服务器(可选)|
|
||DNS 地址|`fdac::1`|PVE IPv6 DNS 服务器(可选)|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
初次登录 PVE 的 WEB 管理后台,打开网络管理页面,此时只有一个 `vmbr0` 。
|
初次登录 PVE 的 WEB 管理后台,打开网络管理页面,此时只有一个 `vmbr0` 。
|
||||||
|
|
||||||
该 `vmbr0` 与列表中的第一个物理网口绑定,且在 `CIDR` 和 `网关` 处有 IP 地址参数,说明 `vmbr0` 为当前管理网口。
|
该 `vmbr0` 与列表中的第一个物理网口绑定,且在 `CIDR` 和 `网关` 处有 IP 地址参数,说明 `vmbr0` 为当前管理网口。
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
接下来将修改 PVE 网络配置,在修改完成前, **请不要点击 “应用配置”** ,否则会导致 PVE 无法访问。
|
接下来将修改 PVE 网络配置,在修改完成前, **请不要点击 “应用配置”** ,否则会导致 PVE 无法访问。
|
||||||
|
|
||||||
在 PVE 内部网络设置完成后,将如图所示。
|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 3.1.修改 vmbr0
|
### 3.1.修改 vmbr0
|
||||||
|
|
||||||
@@ -226,21 +223,17 @@ $ update-pciids
|
|||||||
|
|
||||||
删除 `IPv4/CIDR` 和 `网关` 信息,确保 `自动启动` 为勾选状态。
|
删除 `IPv4/CIDR` 和 `网关` 信息,确保 `自动启动` 为勾选状态。
|
||||||
|
|
||||||
在备注处填写 `wan` ,然后点击 `OK` 按钮。
|
在备注处填写 `wan` ,然后点击 `OK` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 3.2.创建网桥
|
### 3.2.创建网桥
|
||||||
|
|
||||||
点击左上角的 `创建` 按钮,选择 `Linux Bridge` :
|
点击左上角的 `创建` 选项,选择 `Linux Bridge` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
因为 `vmbr0` 名称已被使用,因此名称填写 `vmbr1` 。
|
桥接端口填写顺序的第二个网卡名称,演示中为 `nic1` ,在备注处填写 `lan1` ,并点击 `创建` 。
|
||||||
|
|
||||||
桥接端口填写顺序的第二个网卡名称,演示中为 `enp3s0` 。
|
|
||||||
|
|
||||||
确保 `自动启动` 为勾选状态,在备注处填写 `lan1` ,点击 `创建` 按钮。
|
|
||||||
|
|
||||||
然后,依次创建所有物理接口的内部网桥,直到最后一个网桥,即 PVE 的管理网口。
|
然后,依次创建所有物理接口的内部网桥,直到最后一个网桥,即 PVE 的管理网口。
|
||||||
|
|
||||||
@@ -248,49 +241,36 @@ $ update-pciids
|
|||||||
|
|
||||||
### 3.3.创建管理网口
|
### 3.3.创建管理网口
|
||||||
|
|
||||||
在创建最后一个物理网口的网桥时,需要额外配置 `IPv4` 地址和对应的 `网关` 参数。
|
在创建最后一个物理网口的网桥时,需配置 `IPv4` 地址和对应的 `网关` 参数。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
额外说明:
|
**额外说明:**
|
||||||
|
- 如非特殊需求,通常情况下 PVE 系统无需使用 IPv6 网络
|
||||||
1. 如非特殊需求,通常情况下 PVE 系统无需使用 IPv6 网络。
|
- 当主路由未配置 IPv6 ULA 网段时,无需填写 `IPv6/CIDR` 参数(如本文演示地址 `fdac::fe/64` )
|
||||||
|
- 多数情况下无需填写 IPv6 `网关` 参数,其网关将通过 IPv6 LLA (链路本地地址)自动配置
|
||||||
2. 主路由未配置 IPv6 ULA 网段时,例如本文演示地址 `fdac::/64` ,无需填写 `IPv6/CIDR` 参数。
|
|
||||||
|
|
||||||
3. 通常情况下 IPv6 无需填写 `网关` 参数,IPv6 网关将通过 LLA IPv6 地址自动配置。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
在所有物理网口的 PVE 网桥创建完成后,可以点击 `应用配置` 按钮,此时页面会失去连接。
|
所有物理网口的 PVE 网桥创建完成后,点击 `应用配置` ,页面会断开连接。
|
||||||
|
|
||||||
无需担心,只需要将电脑的网线从 PVE 物理机的第一个网口拔出,并插入到最后一个网口即可。
|
此时,只需将电脑网线从 PVE 物理机的第一个网口拔出,并插入最后一个网口即可恢复。
|
||||||
|
|
||||||
如果万一还是无法访问到 PVE,可以尝试使用网线 “拔插” 方法,挨个测试 PVE 网口的访问情况。
|
若仍无法访问 PVE,可尝试通过网线拔插的方式,逐一测试各 PVE 网口的访问连通性。
|
||||||
|
|
||||||
### 3.4.创建内部网桥
|
### 3.4.创建内部网桥
|
||||||
|
|
||||||
纯内部网桥,在没有内部路由系统提供额外桥接的情况下,无法直接通过物理网口进行访问。
|
纯内部网桥在无其他系统提供额外桥接时,无法直接通过物理网口访问。
|
||||||
|
|
||||||
只有在主路由(例如 RouterOS )安装完成并建立了内部网桥后,才可正常使用。
|
其主要作用是借助其他系统创建的虚拟网桥,为内部虚拟机提供统一的网络访问接口。
|
||||||
|
|
||||||
该纯内部网桥,其主要作用是通过 **主路由** 给内部其他虚拟机提供 **统一** 的网络访问接口。
|
|
||||||
|
|
||||||
创建纯内部网桥的方法,与创建物理网口网桥的方法基本一致,唯一区别是 `桥接端口` 参数为 **空** 即可。
|
创建纯内部网桥的方法,与创建物理网口网桥的方法基本一致,唯一区别是 `桥接端口` 参数为 **空** 即可。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
当然,内部网桥的作用不仅如此,比如还可以作为内部级联路由的连接器。
|
在 PVE 内部网络设置完成后,将如图所示。
|
||||||
|
|
||||||
例如,安装了 OPNsense 和 RouterOS 两个虚拟机,OPNsense 作为网关防火墙使用。
|

|
||||||
|
|
||||||
此时 RouterOS 作为二级路由系统,OPNsense 的 LAN 口需要与 RouterOS 的 WAN 口相连。
|
|
||||||
|
|
||||||
如果 OPNsense 和 RouterOS 均使用了绑定物理网口的 PVE 网桥,则需用网线在 PVE 服务器上连接两个物理网口。
|
|
||||||
|
|
||||||
浪费了宝贵的网线不说,还占用了网口,得不偿失。
|
|
||||||
|
|
||||||
而纯内部网桥则能很好的解决该问题,有了纯内部网桥,不论多少个虚拟机使用该网桥,只要 IP 地址段相同,即可相互访问。
|
|
||||||
|
|
||||||
## 4.配置 PVE DNS
|
## 4.配置 PVE DNS
|
||||||
|
|
||||||
|
|||||||
@@ -4,33 +4,40 @@
|
|||||||
|
|
||||||
在 PVE 系统调整之前,请确认必要的软件包已经安装完成,本文后续命令均在 SSH 终端下执行。
|
在 PVE 系统调整之前,请确认必要的软件包已经安装完成,本文后续命令均在 SSH 终端下执行。
|
||||||
|
|
||||||
关于 [Neovim](https://neovim.io/) 的基础使用方法,请参阅:[Neovim 基本操作](https://www.bing.com/search?q=neovim+%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C) 。
|
Debian 系统默认编辑器为 `nano` ,推荐将其更换为 `neovim` ,关于 [Neovim](https://neovim.io/) 的基础使用方法,请参阅:[Neovim 基础教程](https://cn.bing.com/search?q=Neovim+%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B) 。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 同步镜像仓库
|
## 修改系统默认编辑器(选择 nvim 所在条目,即可将 neovim 设为默认编辑器)
|
||||||
$ apt update
|
$ update-alternatives --config editor
|
||||||
|
|
||||||
## 安装系统软件
|
#### 系统默认编辑器示例输出
|
||||||
$ apt install btop lm-sensors unzip neovim tmux unattended-upgrades powermgmt-base
|
There are 3 choices for the alternative editor (providing /usr/bin/editor).
|
||||||
|
|
||||||
## 安装网络工具
|
Selection Path Priority Status
|
||||||
$ apt install iperf iperf3 iftop sshguard openvswitch-switch
|
------------------------------------------------------------
|
||||||
|
* 0 /bin/nano 40 auto mode
|
||||||
|
1 /bin/nano 40 manual mode
|
||||||
|
2 /usr/bin/nvim 30 manual mode
|
||||||
|
3 /usr/bin/vim.tiny 15 manual mode
|
||||||
|
|
||||||
## 安装 CPU 调度调整工具
|
Press <enter> to keep the current choice[*], or type selection number: 2
|
||||||
$ apt install linux-cpupower
|
update-alternatives: using /usr/bin/nvim to provide /usr/bin/editor (editor) in manual mode
|
||||||
|
```
|
||||||
|
|
||||||
## 根据 CPU 厂商安装 CPU 微码工具
|
若需完全禁用 `neovim` 鼠标功能;即关闭所有鼠标交互,右键行为完全交给终端 / 控制台处理,需执行以下命令。
|
||||||
$ apt install intel-microcode (amd64-microcode)
|
|
||||||
|
|
||||||
## 更新 PCI 数据库
|
```bash
|
||||||
$ update-pciids
|
## 配置 nvim 鼠标交互行为脚本
|
||||||
|
$ install -D -m 0644 /dev/stdin /etc/xdg/nvim/sysinit.vim <<'EOF'
|
||||||
|
set mouse=
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
## 1.系统时区
|
## 1.系统时区
|
||||||
|
|
||||||
如果在安装 PVE 系统时选错了时区,导致系统时间和北京时间不一致,可以执行以下命令修正。
|
如果在安装 PVE 系统时选错了时区,导致系统时间和北京时间不一致,可以执行以下命令修正。
|
||||||
|
|
||||||
输出结果如果和北京时间一致,则代表修改正确。
|
若输出结果和北京时间一致,则代表修改正确。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 修改系统时区
|
## 修改系统时区
|
||||||
@@ -40,7 +47,7 @@ $ timedatectl set-timezone Asia/Shanghai
|
|||||||
$ date -R
|
$ date -R
|
||||||
|
|
||||||
#### 系统时间示例输出
|
#### 系统时间示例输出
|
||||||
Mon, 20 Jan 2025 18:24:41 +0800
|
Wed, 27 Aug 2025 15:12:21 +0800
|
||||||
```
|
```
|
||||||
|
|
||||||
Debian 系统常用 `systemd-timesyncd.service` 来同步时间,而 PVE 系统使用 `chrony.service` 来同步时间。
|
Debian 系统常用 `systemd-timesyncd.service` 来同步时间,而 PVE 系统使用 `chrony.service` 来同步时间。
|
||||||
@@ -49,7 +56,7 @@ Debian 系统常用 `systemd-timesyncd.service` 来同步时间,而 PVE 系统
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 chrony 配置文件
|
## 编辑 chrony 配置文件
|
||||||
$ nvim /etc/chrony/chrony.conf
|
$ editor /etc/chrony/chrony.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中,将 `pool 2.debian.pool.ntp.org iburst` “注释” 掉,并添加国内的 NTP 服务器。
|
在编辑器对话框中,将 `pool 2.debian.pool.ntp.org iburst` “注释” 掉,并添加国内的 NTP 服务器。
|
||||||
@@ -67,7 +74,7 @@ pool cn.pool.ntp.org iburst
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
保存该配置文件后,需重启 `chrony.service` ,并再次检查系统 NTP 服务器地址。
|
配置文件编辑完成后,需重启 `chrony.service` ,并再次检查系统 NTP 服务器地址。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 重启 chrony.service
|
## 重启 chrony.service
|
||||||
@@ -112,7 +119,7 @@ analyzing CPU 0:
|
|||||||
Supported: yes
|
Supported: yes
|
||||||
Active: yes
|
Active: yes
|
||||||
|
|
||||||
#### 设备 CPU - N6005 示例输出
|
#### 设备 CPU - N100 示例输出
|
||||||
analyzing CPU 0:
|
analyzing CPU 0:
|
||||||
driver: intel_pstate
|
driver: intel_pstate
|
||||||
CPUs which run at the same hardware frequency: 0
|
CPUs which run at the same hardware frequency: 0
|
||||||
@@ -130,24 +137,11 @@ analyzing CPU 0:
|
|||||||
Active: yes
|
Active: yes
|
||||||
```
|
```
|
||||||
|
|
||||||
这里面主要关注两个点:
|
这里面主要关注如下几点:
|
||||||
|
- `driver` :CPU 调频驱动方案,例如 `intel_cpufreq` 或 `intel_pstate`
|
||||||
- driver: `intel_cpufreq` 或 `intel_pstate`
|
- `governor` :调频策略中使用的调度器,例如 `performance`
|
||||||
|
- CPU 驱动为 `intel_cpufreq` 时,推荐使用 `schedutil` 调度器
|
||||||
- current policy: `governor "ondemand"` 或 `governor "performance"`
|
- CPU 驱动为 `intel_pstate` 时,推荐使用 `powersave` 调度器
|
||||||
|
|
||||||
还有另外一个命令可用来显示 CPU 当前调度器。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 检查 CPU 当前调度器
|
|
||||||
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
|
||||||
|
|
||||||
#### 设备 CPU - J4125 示例输出
|
|
||||||
performance
|
|
||||||
|
|
||||||
#### 设备 CPU - N6005 示例输出
|
|
||||||
performance
|
|
||||||
```
|
|
||||||
|
|
||||||
CPU 驱动一般不建议手动调整,而 `governor` 后面的参数表示 CPU 当前调度器设置。
|
CPU 驱动一般不建议手动调整,而 `governor` 后面的参数表示 CPU 当前调度器设置。
|
||||||
|
|
||||||
@@ -160,57 +154,28 @@ $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
|
|||||||
#### 设备 CPU - J4125 示例输出
|
#### 设备 CPU - J4125 示例输出
|
||||||
conservative ondemand userspace powersave performance schedutil
|
conservative ondemand userspace powersave performance schedutil
|
||||||
|
|
||||||
#### 设备 CPU - N6005 示例输出
|
#### 设备 CPU - N100 示例输出
|
||||||
performance powersave
|
performance powersave
|
||||||
```
|
```
|
||||||
|
|
||||||
根据 CPU 所使用的驱动不同,可选调度器也不同,至于每种调度器有什么优劣,欢迎大家深度挖掘。
|
本文通过 systemd 服务自动管理 `cpupower` ,服务启动时将 CPU 调度器设置为 `powersave` ,停止时恢复为 `performance` 。
|
||||||
|
|
||||||
- CPU 驱动为 `intel_cpufreq` 时,推荐使用 `schedutil` 调度器。
|
|
||||||
|
|
||||||
- CPU 驱动为 `intel_pstate` 时,推荐使用 `powersave` 调度器。
|
|
||||||
|
|
||||||
本文使用 `powersave` 调度器为演示,使用 `neovim` 编辑器创建 `cpupower` 的配置文件。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 创建 cpupower 默认配置文件
|
|
||||||
$ nvim /etc/default/cpupower
|
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件中修改以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
|
||||||
# Optimize system CPU governors.
|
|
||||||
|
|
||||||
CPUPOWER_START_OPTS="frequency-set -g powersave"
|
|
||||||
CPUPOWER_STOP_OPTS="frequency-set -g performance"
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
进一步创建 `cpupower` 服务配置文件,以满足系统自动化设置需求。
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 cpupower.service 配置文件
|
## 创建 cpupower.service 配置文件
|
||||||
$ nvim /etc/systemd/system/cpupower.service
|
$ systemctl edit --force --full cpupower.service
|
||||||
```
|
```
|
||||||
|
|
||||||
在服务配置文件中修改以下配置项,并保存。
|
在服务配置文件中输入以下内容,并保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# This configuration file is customized by fox,
|
|
||||||
# Optimize for cpupower systemd service.
|
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Apply cpupower configuration
|
Description=CPU Power Governor Management
|
||||||
ConditionVirtualization=!container
|
ConditionVirtualization=!container
|
||||||
After=syslog.target
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
EnvironmentFile=/etc/default/cpupower
|
ExecStart=/usr/bin/cpupower frequency-set --governor powersave
|
||||||
ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS
|
ExecStop=/usr/bin/cpupower frequency-set --governor performance
|
||||||
ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS
|
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
@@ -218,22 +183,13 @@ WantedBy=multi-user.target
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
由于修改了服务项,需要执行以下命令进行重载。
|
执行以下命令让 `cpupower` 服务立即启动并置为开机自启状态。
|
||||||
|
|
||||||
```bash
|
|
||||||
## 服务重载
|
|
||||||
$ systemctl daemon-reload
|
|
||||||
```
|
|
||||||
|
|
||||||
执行以下命令让 `cpupower` 服务开机自启动。
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 设置 cpupower 服务开机自启
|
## 设置 cpupower 服务开机自启
|
||||||
$ systemctl enable cpupower.service
|
$ systemctl enable --now cpupower.service
|
||||||
```
|
```
|
||||||
|
|
||||||
修改完成后,需重启 PVE 服务器,并再次查看 CPU 调度器,检验配置文件是否生效。
|
|
||||||
|
|
||||||
这里提供两个额外命令,方便实时查看 CPU 当前频率和温度状况。
|
这里提供两个额外命令,方便实时查看 CPU 当前频率和温度状况。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -244,36 +200,13 @@ $ watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
|
|||||||
$ watch -d sensors
|
$ watch -d sensors
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3. PVE 定时重启
|
## 3. PVE 自动更新
|
||||||
|
|
||||||
有时需要让 PVE 服务器周期性的定时重启,则可执行以下命令。
|
### 3.1.系统定时器
|
||||||
|
|
||||||
参数表示每月 `1` 、 `16` 号的 `02:30` 执行系统重启命令。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 查看系统定时任务
|
|
||||||
$ crontab -l
|
|
||||||
|
|
||||||
## 编辑系统定时任务,编辑器选择 nano
|
|
||||||
$ crontab -e
|
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件末尾,增加以下配置项。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 定时任务配置项
|
|
||||||
|
|
||||||
30 2 1,16 * * /usr/sbin/reboot
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4. PVE 自动更新
|
|
||||||
|
|
||||||
### 4.1.系统定时器
|
|
||||||
|
|
||||||
配置系统自动更新之前,需检查系统当前定时器状态。
|
配置系统自动更新之前,需检查系统当前定时器状态。
|
||||||
|
|
||||||
后续将手动调整该定时器的时间,使其每 `5` 天的 `01:30` 进行触发。
|
后续将手动调整该定时器的时间,使其每 `10` 天的 `01:30` 进行触发。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 检查系统定时器
|
## 检查系统定时器
|
||||||
@@ -281,15 +214,16 @@ $ systemctl status apt-daily-upgrade.timer
|
|||||||
|
|
||||||
#### 系统定时器示例输出
|
#### 系统定时器示例输出
|
||||||
● apt-daily-upgrade.timer - Daily apt upgrade and clean activities
|
● apt-daily-upgrade.timer - Daily apt upgrade and clean activities
|
||||||
Loaded: loaded (/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled)
|
Loaded: loaded (/usr/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled)
|
||||||
Active: active (waiting) since Mon 2025-01-20 18:12:44 CST; 19min ago
|
Active: active (waiting) since Mon 2026-08-10 09:51:05 CST; 27min ago
|
||||||
Trigger: Tue 2025-01-21 06:52:19 CST; 12h left
|
Invocation: edb5962fda4c4a8395cb2c04c736db45
|
||||||
|
Trigger: Tue 2026-08-11 06:21:38 CST; 20h left
|
||||||
Triggers: ● apt-daily-upgrade.service
|
Triggers: ● apt-daily-upgrade.service
|
||||||
|
|
||||||
Jan 20 18:12:44 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.配置更新策略
|
### 3.2.配置更新策略
|
||||||
|
|
||||||
执行以下命令,启用系统自动更新。
|
执行以下命令,启用系统自动更新。
|
||||||
|
|
||||||
@@ -303,56 +237,37 @@ $ dpkg-reconfigure -plow unattended-upgrades
|
|||||||
<Yes>
|
<Yes>
|
||||||
```
|
```
|
||||||
|
|
||||||
进一步调整 `20auto-upgrades` 配置文件。
|
开始调整 `20auto-upgrades` 配置文件。
|
||||||
|
|
||||||
|
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`10` 表示更新周期为 `10` 天。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 进入 apt 的配置目录
|
|
||||||
$ cd /etc/apt/apt.conf.d
|
|
||||||
|
|
||||||
## 编辑 20auto-upgrades 配置文件
|
## 编辑 20auto-upgrades 配置文件
|
||||||
$ nvim /etc/apt/apt.conf.d/20auto-upgrades
|
$ tee /etc/apt/apt.conf.d/20auto-upgrades >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
|
||||||
|
|
||||||
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`5` 表示更新周期为 `5` 天。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 系统更新周期配置项
|
|
||||||
|
|
||||||
APT::Periodic::Update-Package-Lists "1";
|
APT::Periodic::Update-Package-Lists "1";
|
||||||
APT::Periodic::Unattended-Upgrade "5";
|
APT::Periodic::Unattended-Upgrade "10";
|
||||||
APT::Periodic::AutocleanInterval "1";
|
APT::Periodic::AutocleanInterval "1";
|
||||||
APT::Periodic::CleanInterval "1";
|
APT::Periodic::CleanInterval "1";
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
进一步调整 `50unattended-upgrades` 配置文件。
|
进一步调整 `50unattended-upgrades` 配置文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 50unattended-upgrades 配置文件
|
## 编辑 50unattended-upgrades 配置文件
|
||||||
$ nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
$ editor /etc/apt/apt.conf.d/50unattended-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
配置文件中,被修改的参数解释如下:
|
配置文件中,被修改的参数解释如下:
|
||||||
|
- 启用了 Debian `trixie-updates` 相关更新
|
||||||
- 启用了 Debian `bookworm-updates` 相关更新。
|
- 增加并启用 PVE 自有仓库的更新
|
||||||
|
- 增加并启用 PVE Ceph 仓库的更新,请按需启用
|
||||||
- 增加并启用 PVE 自有仓库的更新。
|
- 自动修复被打断的 Dpkg 安装
|
||||||
|
- 自动移除无用的的内核包
|
||||||
- 增加并启用 PVE Ceph 仓库的更新,请按需启用。
|
- 自动移除因更新而出现的无用依赖包
|
||||||
|
- 自动移除以前的无用依赖包
|
||||||
- 自动修复被打断的 Dpkg 安装。
|
- 自动重启:开启
|
||||||
|
- 自动重启时间:`02:30`
|
||||||
- 自动移除无用的的内核包。
|
|
||||||
|
|
||||||
- 自动移除因更新而出现的无用依赖包。
|
|
||||||
|
|
||||||
- 自动移除以前的无用依赖包。
|
|
||||||
|
|
||||||
- 自动重启:开启。
|
|
||||||
|
|
||||||
- 自动重启时间:`02:30` 。
|
|
||||||
|
|
||||||
因为该配置文件很长,完整的配置文件可查看 [pve_50unattended_upgrades.conf](./src/pve/pve_50unattended_upgrades.conf) 以便对比。
|
因为该配置文件很长,完整的配置文件可查看 [pve_50unattended_upgrades.conf](./src/pve/pve_50unattended_upgrades.conf) 以便对比。
|
||||||
|
|
||||||
@@ -367,9 +282,9 @@ $ nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
|||||||
|
|
||||||
## 按需添加 PVE Ceph 更新项目
|
## 按需添加 PVE Ceph 更新项目
|
||||||
|
|
||||||
"origin=Proxmox,codename=${distro_codename},label=Proxmox Ceph Debian Repository";
|
"origin=Proxmox,codename=${distro_codename},label=Proxmox Ceph 19 Squid Debian Repository";
|
||||||
|
|
||||||
## 在配置文件末尾增加以下配置项,代表启用,并调整参数
|
## 在配置文件末尾增加以下内容,代表启用,并调整参数
|
||||||
|
|
||||||
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||||
|
|
||||||
@@ -385,7 +300,7 @@ Unattended-Upgrade::Automatic-Reboot-Time "02:30";
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4.3.重设触发器
|
### 3.3.重设触发器
|
||||||
|
|
||||||
系统自动更新配置文件修改完成后,需要重设自动更新定时器,执行以下命令。
|
系统自动更新配置文件修改完成后,需要重设自动更新定时器,执行以下命令。
|
||||||
|
|
||||||
@@ -396,7 +311,7 @@ Unattended-Upgrade::Automatic-Reboot-Time "02:30";
|
|||||||
$ systemctl edit apt-daily-upgrade.timer
|
$ systemctl edit apt-daily-upgrade.timer
|
||||||
```
|
```
|
||||||
|
|
||||||
根据配置文件中的提示,在中间空白处填入以下配置项。
|
根据配置文件中的提示,在中间空白处填入以下内容。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 定时器配置项
|
## 定时器配置项
|
||||||
@@ -419,21 +334,22 @@ $ systemctl status apt-daily-upgrade.timer
|
|||||||
|
|
||||||
#### 系统自动更新触发器示例输出
|
#### 系统自动更新触发器示例输出
|
||||||
● apt-daily-upgrade.timer - Daily apt upgrade and clean activities
|
● apt-daily-upgrade.timer - Daily apt upgrade and clean activities
|
||||||
Loaded: loaded (/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled)
|
Loaded: loaded (/usr/lib/systemd/system/apt-daily-upgrade.timer; enabled; preset: enabled)
|
||||||
Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d
|
Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d
|
||||||
└─override.conf
|
└─override.conf
|
||||||
Active: active (waiting) since Mon 2025-01-20 18:43:03 CST; 7s ago
|
Active: active (waiting) since Mon 2026-08-10 10:35:09 CST; 5s ago
|
||||||
Trigger: Tue 2025-01-21 01:30:00 CST; 6h left
|
Invocation: e73c9dd167cc4814836a1da4dab015db
|
||||||
|
Trigger: Tue 2026-08-11 01:30:00 CST; 14h left
|
||||||
Triggers: ● apt-daily-upgrade.service
|
Triggers: ● apt-daily-upgrade.service
|
||||||
|
|
||||||
Jan 20 18:43:03 node01 systemd[1]: Stopped 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...
|
||||||
Jan 20 18:43:03 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.
|
||||||
Jan 20 18:43:03 node01 systemd[1]: Started 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.硬件直通
|
## 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 硬件直通功能。
|
参考官方文档 [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 +357,7 @@ Jan 20 18:43:03 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt u
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 Grub 配置文件
|
## 编辑 Grub 配置文件
|
||||||
$ nvim /etc/default/grub
|
$ editor /etc/default/grub
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中修改 `GRUB_CMDLINE_LINUX_DEFAULT` 参数,注意命令中间的空格。
|
在编辑器对话框中修改 `GRUB_CMDLINE_LINUX_DEFAULT` 参数,注意命令中间的空格。
|
||||||
@@ -469,24 +385,20 @@ GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on iommu=pt"
|
|||||||
$ update-grub
|
$ update-grub
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5.2.添加内核模块
|
### 4.2.添加内核模块
|
||||||
|
|
||||||
修改系统 `/etc/modules` 配置文件,增加必要的系统模块。
|
编辑 **内核模块** 配置文件,增加必要的系统模块,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑系统配置文件
|
## 编辑系统配置文件
|
||||||
$ nvim /etc/modules
|
$ tee /etc/modules-load.d/10-server-modules.conf >/dev/null <<'EOF'
|
||||||
```
|
# This configuration file is customized by fox,
|
||||||
|
# Optimize vfio related modules at system boot.
|
||||||
在配置文件中添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 硬件直通配置项
|
|
||||||
|
|
||||||
vfio
|
vfio
|
||||||
vfio_iommu_type1
|
vfio_iommu_type1
|
||||||
vfio_pci
|
vfio_pci
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
执行以下命令更新 `initramfs` ,更新完成后,建议重启 PVE 服务器。
|
执行以下命令更新 `initramfs` ,更新完成后,建议重启 PVE 服务器。
|
||||||
@@ -496,7 +408,7 @@ vfio_pci
|
|||||||
$ update-initramfs -u -k all
|
$ update-initramfs -u -k all
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5.3.检查硬件直通
|
### 4.3.检查硬件直通
|
||||||
|
|
||||||
PVE 服务器重启完成后,再次使用终端工具登录,并执行以下命令检查硬件直通状态。
|
PVE 服务器重启完成后,再次使用终端工具登录,并执行以下命令检查硬件直通状态。
|
||||||
|
|
||||||
@@ -506,36 +418,26 @@ PVE 服务器重启完成后,再次使用终端工具登录,并执行以下
|
|||||||
## 检查系统硬件直通状态
|
## 检查系统硬件直通状态
|
||||||
$ dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
|
$ dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
|
||||||
|
|
||||||
#### 设备 CPU - N6005 示例输出
|
#### 设备 CPU - J4125 示例输出
|
||||||
[ 0.017937] ACPI: DMAR 0x00000000746C2000 000088 (v02 INTEL EDK2 00000002 01000013)
|
[ 0.008356] ACPI: DMAR 0x000000007953E000 0000A8 (v01 INTEL GLK-SOC 00000003 BRXT 0100000D)
|
||||||
[ 0.017965] ACPI: Reserving DMAR table memory at [mem 0x746c2000-0x746c2087]
|
[ 0.008406] ACPI: Reserving DMAR table memory at [mem 0x7953e000-0x7953e0a7]
|
||||||
[ 0.047812] DMAR: IOMMU enabled
|
[ 0.055618] AMD-Vi: Unknown option - 'on'
|
||||||
[ 0.116031] DMAR: Host address width 39
|
[ 0.220916] DMAR: Host address width 39
|
||||||
[ 0.116032] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
|
[ 0.220919] DMAR: DRHD base: 0x000000fed64000 flags: 0x0
|
||||||
[ 0.116038] DMAR: dmar0: reg_base_addr fed90000 ver 4:0 cap 1c0000c40660462 ecap 49e2ff0505e
|
[ 0.220939] DMAR: dmar0: reg_base_addr fed64000 ver 1:0 cap 1c0000c40660462 ecap 9e2ff0505e
|
||||||
[ 0.116041] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
|
[ 0.220944] DMAR: DRHD base: 0x000000fed65000 flags: 0x1
|
||||||
[ 0.116046] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
|
[ 0.220954] DMAR: dmar1: reg_base_addr fed65000 ver 1:0 cap d2008c40660462 ecap f050da
|
||||||
[ 0.116048] DMAR: RMRR base: 0x0000007b800000 end: 0x0000007fbfffff
|
[ 0.220960] DMAR: RMRR base: 0x000000794a9000 end: 0x000000794c8fff
|
||||||
[ 0.116051] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
|
[ 0.220963] DMAR: RMRR base: 0x0000007b800000 end: 0x0000007fffffff
|
||||||
[ 0.116052] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
|
[ 0.220967] DMAR-IR: IOAPIC id 1 under DRHD base 0xfed65000 IOMMU 1
|
||||||
[ 0.116053] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
|
[ 0.220970] DMAR-IR: HPET id 0 under DRHD base 0xfed65000
|
||||||
[ 0.117774] DMAR-IR: Enabled IRQ remapping in x2apic mode
|
[ 0.220973] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
|
||||||
[ 1.746431] pci 0000:00:02.0: DMAR: Skip IOMMU disabling for graphics
|
[ 0.223069] DMAR-IR: Enabled IRQ remapping in x2apic mode
|
||||||
[ 2.290116] DMAR: No ATSR found
|
[ 0.493005] DMAR: No ATSR found
|
||||||
[ 2.290117] DMAR: No SATC found
|
[ 0.493008] DMAR: No SATC found
|
||||||
[ 2.290118] DMAR: IOMMU feature fl1gp_support inconsistent
|
[ 0.493010] DMAR: dmar0: Using Queued invalidation
|
||||||
[ 2.290119] DMAR: IOMMU feature pgsel_inv inconsistent
|
[ 0.493018] DMAR: dmar1: Using Queued invalidation
|
||||||
[ 2.290120] DMAR: IOMMU feature nwfs inconsistent
|
[ 0.494092] DMAR: Intel(R) Virtualization Technology for Directed I/O
|
||||||
[ 2.290121] DMAR: IOMMU feature pds inconsistent
|
|
||||||
[ 2.290122] DMAR: IOMMU feature eafs inconsistent
|
|
||||||
[ 2.290123] DMAR: IOMMU feature prs inconsistent
|
|
||||||
[ 2.290123] DMAR: IOMMU feature nest inconsistent
|
|
||||||
[ 2.290124] DMAR: IOMMU feature mts inconsistent
|
|
||||||
[ 2.290124] DMAR: IOMMU feature sc_support inconsistent
|
|
||||||
[ 2.290125] DMAR: IOMMU feature dev_iotlb_support inconsistent
|
|
||||||
[ 2.290126] DMAR: dmar0: Using Queued invalidation
|
|
||||||
[ 2.290129] DMAR: dmar1: Using Queued invalidation
|
|
||||||
[ 2.290568] DMAR: Intel(R) Virtualization Technology for Directed I/O
|
|
||||||
```
|
```
|
||||||
|
|
||||||
检查系统 `IOMMU` 分组,执行以下命令。
|
检查系统 `IOMMU` 分组,执行以下命令。
|
||||||
@@ -544,41 +446,38 @@ $ dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
|
|||||||
## 检查 IOMMU group
|
## 检查 IOMMU group
|
||||||
$ find /sys/kernel/iommu_groups/ -type l
|
$ find /sys/kernel/iommu_groups/ -type l
|
||||||
|
|
||||||
#### 设备 CPU - N6005 示例输出
|
#### 设备 CPU - J4125 示例输出
|
||||||
/sys/kernel/iommu_groups/7/devices/0000:00:1c.4
|
/sys/kernel/iommu_groups/17/devices/0000:04:00.0
|
||||||
/sys/kernel/iommu_groups/15/devices/0000:04:00.0
|
/sys/kernel/iommu_groups/7/devices/0000:00:13.3
|
||||||
/sys/kernel/iommu_groups/5/devices/0000:00:17.0
|
/sys/kernel/iommu_groups/15/devices/0000:02:00.0
|
||||||
/sys/kernel/iommu_groups/13/devices/0000:02:00.0
|
/sys/kernel/iommu_groups/5/devices/0000:00:13.0
|
||||||
/sys/kernel/iommu_groups/3/devices/0000:00:15.2
|
/sys/kernel/iommu_groups/13/devices/0000:00:1f.0
|
||||||
/sys/kernel/iommu_groups/3/devices/0000:00:15.0
|
/sys/kernel/iommu_groups/13/devices/0000:00:1f.1
|
||||||
/sys/kernel/iommu_groups/11/devices/0000:00:1f.0
|
/sys/kernel/iommu_groups/3/devices/0000:00:0f.0
|
||||||
/sys/kernel/iommu_groups/11/devices/0000:00:1f.5
|
/sys/kernel/iommu_groups/11/devices/0000:00:17.0
|
||||||
/sys/kernel/iommu_groups/11/devices/0000:00:1f.3
|
/sys/kernel/iommu_groups/11/devices/0000:00:17.3
|
||||||
/sys/kernel/iommu_groups/11/devices/0000:00:1f.4
|
/sys/kernel/iommu_groups/11/devices/0000:00:17.1
|
||||||
|
/sys/kernel/iommu_groups/11/devices/0000:00:17.2
|
||||||
/sys/kernel/iommu_groups/1/devices/0000:00:00.0
|
/sys/kernel/iommu_groups/1/devices/0000:00:00.0
|
||||||
/sys/kernel/iommu_groups/8/devices/0000:00:1c.5
|
/sys/kernel/iommu_groups/18/devices/0000:05:00.0
|
||||||
/sys/kernel/iommu_groups/16/devices/0000:05:00.0
|
/sys/kernel/iommu_groups/8/devices/0000:00:14.0
|
||||||
/sys/kernel/iommu_groups/6/devices/0000:00:1c.0
|
/sys/kernel/iommu_groups/16/devices/0000:03:00.0
|
||||||
/sys/kernel/iommu_groups/14/devices/0000:03:00.0
|
/sys/kernel/iommu_groups/6/devices/0000:00:13.2
|
||||||
/sys/kernel/iommu_groups/4/devices/0000:00:16.0
|
/sys/kernel/iommu_groups/14/devices/0000:01:00.0
|
||||||
/sys/kernel/iommu_groups/12/devices/0000:01:00.0
|
/sys/kernel/iommu_groups/4/devices/0000:00:12.0
|
||||||
/sys/kernel/iommu_groups/2/devices/0000:00:14.5
|
/sys/kernel/iommu_groups/12/devices/0000:00:1c.0
|
||||||
/sys/kernel/iommu_groups/2/devices/0000:00:14.2
|
/sys/kernel/iommu_groups/2/devices/0000:00:0e.0
|
||||||
/sys/kernel/iommu_groups/2/devices/0000:00:14.0
|
/sys/kernel/iommu_groups/10/devices/0000:00:15.0
|
||||||
/sys/kernel/iommu_groups/10/devices/0000:00:1c.7
|
|
||||||
/sys/kernel/iommu_groups/0/devices/0000:00:02.0
|
/sys/kernel/iommu_groups/0/devices/0000:00:02.0
|
||||||
/sys/kernel/iommu_groups/9/devices/0000:00:1c.6
|
/sys/kernel/iommu_groups/9/devices/0000:00:14.1
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6. BTRFS 调整
|
## 5. BTRFS 调整
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
- 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节
|
||||||
1. 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节。
|
- `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作
|
||||||
|
- 有关在 PVE 中使用 `BTRFS` 的详情,请参阅 [Proxmox VE - BTRFS](https://pve.proxmox.com/wiki/BTRFS)
|
||||||
2. `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作。
|
|
||||||
|
|
||||||
3. 有关在 PVE 中使用 `BTRFS` 的详情,请参阅 [Proxmox VE - BTRFS](https://pve.proxmox.com/wiki/BTRFS) 。
|
|
||||||
|
|
||||||
安装 PVE 时,若使用了 `BTRFS` 单盘 `RAID0` 的安装模式,系统默认未启用 swap 和 zstd 压缩,需要手动开启。
|
安装 PVE 时,若使用了 `BTRFS` 单盘 `RAID0` 的安装模式,系统默认未启用 swap 和 zstd 压缩,需要手动开启。
|
||||||
|
|
||||||
@@ -601,7 +500,7 @@ $ swapon /swap/swapfile
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 fstab 配置文件
|
## 编辑 fstab 配置文件
|
||||||
$ nvim /etc/fstab
|
$ editor /etc/fstab
|
||||||
```
|
```
|
||||||
|
|
||||||
`fstab` 为系统关键配置文件,直接影响系统启动,修改此文件时,请注意以下几点:
|
`fstab` 为系统关键配置文件,直接影响系统启动,修改此文件时,请注意以下几点:
|
||||||
@@ -627,7 +526,7 @@ proc /proc proc defaults 0 0
|
|||||||
/swap/swapfile none swap defaults 0 0
|
/swap/swapfile none swap defaults 0 0
|
||||||
```
|
```
|
||||||
|
|
||||||
## 7.系统清理
|
## 6.系统清理
|
||||||
|
|
||||||
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
该虚拟机模板主要用作内网 DNS 服务器,由 `Adguard Home` 或 `SmartDNS` 提供 DNS 解析服务。
|
该虚拟机模板主要用作内网 DNS 服务器,由 `Adguard Home` 或 `SmartDNS` 提供 DNS 解析服务。
|
||||||
|
|
||||||
本文将使用 Debian 的云镜像 `debian-12-generic-amd64.qcow2` 作为模板虚拟机的镜像。
|
本文将使用 Debian 的云镜像 `debian-13-generic-amd64.qcow2` 作为模板虚拟机的镜像。
|
||||||
|
|
||||||
访问 [Debian Official Cloud Images](https://cloud.debian.org/images/cloud/) 官方网站,下载最新版 `Bookworm` 云镜像以及对应的校验文件。
|
访问 [Debian Official Cloud Images](https://cloud.debian.org/images/cloud/) 官方网站,下载最新版 `Trixie` 云镜像以及对应的校验文件。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -18,156 +18,190 @@
|
|||||||
|
|
||||||
勾选底部 `高级` 选项,显示完整的配置参数,节点即 “本机” ,`VM ID` 和 `名称` 可自定义。
|
勾选底部 `高级` 选项,显示完整的配置参数,节点即 “本机” ,`VM ID` 和 `名称` 可自定义。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.2.操作系统
|
### 1.2.操作系统
|
||||||
|
|
||||||
无需使用任何安装介质,客户机操作系统类别选择 `Linux` , 版本选择 `6.x - 2.6 Kernel` 即可。
|
无需使用任何安装介质,客户机操作系统类别选择 `Linux` , 版本选择 `7.x - 2.6 Kernel` 即可。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.3.系统
|
### 1.3.系统
|
||||||
|
|
||||||
SCSI 控制器保持默认 `VirtIO SCSI single` ,机型可选 `q35` ,并勾选 `Qemu代理` 选项。
|
SCSI 控制器保持默认 `VirtIO SCSI single` ,机型可选 `q35` ,并勾选 `Qemu 代理` 选项。
|
||||||
|
|
||||||

|
固件可选 `OVMF (UEFI)` ,并勾选 `添加 TPM` 选项,存储路径需根据实际情况进行调整,演示为 `local-lvm` 。
|
||||||
|
|
||||||
|
`预注册密钥` 可启用,启用后将预装特定于发行版和 Microsoft 标准的安全启动密钥。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### 1.4.磁盘
|
### 1.4.磁盘
|
||||||
|
|
||||||
一般情况下,如果该虚拟机仅为 Adguard Home 服务器,`20G` 磁盘空间足够使用。
|
因使用 Debian 云镜像制作虚拟机模板,此处需删除所有 `磁盘` 。
|
||||||
|
|
||||||
由于使用 Debian 云镜像制作虚拟机模板,此处删除所有 `磁盘` 。
|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 1.5.CPU
|
### 1.5.CPU
|
||||||
|
|
||||||
CPU `类别` 选择 `host` ,`插槽` 与 `核心` 数根据物理 CPU 核心数进行酌情设置。
|
CPU `类型` 选择 `host` ,`插槽` 与 `核心` 数根据物理 CPU 核心数进行酌情设置。
|
||||||
|
|
||||||
若 PVE 服务器内有多颗物理 CPU ,则推荐勾选 `启用NUMA` 选项。
|
若 PVE 服务器内有多颗物理 CPU ,则推荐勾选 `启用 NUMA` 选项。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.6.内存
|
### 1.6.内存
|
||||||
|
|
||||||
内存一般 `2G` 足够使用,取消勾选 `Ballooning设备` 。
|
建议将 `内存` 设置为业务峰值需求,`最小内存` 原则上不低于 `内存` 的 `75%` 。
|
||||||
|
|
||||||

|
默认启用 `Ballooning 设备` ,使 PVE 能够获取虚拟机内部的内存统计,并在宿主机出现内存压力时动态回收和调配内存。
|
||||||
|
|
||||||
|
将 `最小内存` 设置为与 `内存` 相同,可保留统计能力,同时为虚拟机提供固定的内存保障。
|
||||||
|
|
||||||
|
对于 `允许 KSM` 内核同页合并功能,建议保留勾选状态。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### 1.7.网络
|
### 1.7.网络
|
||||||
|
|
||||||
在 [02.PVE初始化配置](./02.PVE初始化配置.md) 中,曾创建了一个没有桥接任何物理网口的内部网桥。
|
通常情况下,模板虚拟机的 `桥接` 参数设为 PVE 管理口所在虚拟网桥即可。
|
||||||
|
|
||||||
该内部网桥接口同属于主路由内部网桥成员接口。
|
因在 [02.PVE初始化配置](./02.PVE初始化配置.md) 中曾创建未桥接物理网口的内部网桥,故可根据实际需求选择是否使用纯内部网桥作为该参数值。
|
||||||
|
|
||||||
因此,模板虚拟机的 `桥接` 参数可设置为该纯内部网桥。
|

|
||||||
|
|
||||||

|
多数情况下,无需使用 PVE 内建防火墙,因此 **取消勾选** 网络设备的 `防火墙` 选项。
|
||||||
|
|
||||||
由于演示环境中暂未安装主路由系统,因此选择其他网桥接口替代。
|
|
||||||
|
|
||||||
通常情况下无需使用 PVE 内建防火墙,因此 **取消勾选** 网络设备的 `防火墙` 选项。
|
|
||||||
|
|
||||||
推荐在 `Multiqueue` 处根据前面设置的 CPU 核心数进行网卡多队列设置,设置比例为 1:1 。
|
推荐在 `Multiqueue` 处根据前面设置的 CPU 核心数进行网卡多队列设置,设置比例为 1:1 。
|
||||||
|
|
||||||
即有 n 个 CPU 核心,此处多队列也设置为 n 。
|
即有 n 个 CPU 核心,此处多队列也设置为 n 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.8.确认
|
### 1.8.确认
|
||||||
|
|
||||||
接下来查看设置总览,确认无误后即可点击 `完成` 。
|
接下来查看设置总览,确认无误后即可点击 `完成` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 2.调整硬件参数
|
## 2.调整硬件参数
|
||||||
|
|
||||||
### 2.1.删除光驱
|
### 2.1.删除光驱
|
||||||
|
|
||||||
查看虚拟机详情页,在虚拟机 `硬件` 配置页面,移除其 `CD/DVD驱动器` 。
|
查看虚拟机详情页,在虚拟机 `硬件` 配置页面,移除其 `CD/DVD 驱动器` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 2.2.导入镜像文件
|
### 2.2.添加 VirtIO RNG
|
||||||
|
|
||||||
使用终端工具登录 PVE 服务器,并进入 `/tmp` 目录,执行以下命令创建一个目录。
|
为确保系统拥有充足的可用熵,需为模板虚拟机添加 `VirtIO RNG` 熵源。
|
||||||
|
|
||||||
|
点击顶部 `新增` 菜单,选择 `VirtIO RNG` 。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
`熵源` 选择 `/dev/urandom` ,其余参数保持默认即可。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 2.3.添加串行端口
|
||||||
|
|
||||||
|
在基于 Debian Cloud Image 创建 VM 时,须在虚拟机硬件列表中添加 `串行端口` 设备 `serial0` 。
|
||||||
|
|
||||||
|
补全串口硬件可避免系统因缺失 `/dev/ttyS0` 而无限循环报 `agetty` 输入/输出错误,同时可启用 PVE 的 `xterm.js` 控制台(支持原生复制粘贴)。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
`串行端口` 设置为 `0` 即可。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 2.4.导入镜像文件
|
||||||
|
|
||||||
|
使用终端工具登录到 PVE 服务器,在 `/tmp` 目录中创建一个目录用于下载 Debian 云镜像文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建存放 Debian 云镜像的临时目录
|
## 创建并进入目录
|
||||||
$ mkdir -p /tmp/Debian
|
$ mkdir -p /tmp/Debian && cd /tmp/Debian
|
||||||
|
|
||||||
## 进入目录
|
|
||||||
$ cd /tmp/Debian
|
|
||||||
```
|
|
||||||
|
|
||||||
将 Debian 云镜像传输到该目录,并检查 `hash` 。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 下载云镜像校验文件
|
## 下载云镜像校验文件
|
||||||
$ wget https://cloud.debian.org/images/cloud/bookworm/latest/SHA512SUMS
|
$ curl -LR -O https://cloud.debian.org/images/cloud/trixie/latest/SHA512SUMS
|
||||||
|
|
||||||
## 下载云镜像
|
## 下载云镜像
|
||||||
$ wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
|
$ curl -LR -O https://cloud.debian.org/images/cloud/trixie/latest/debian-13-generic-amd64.qcow2
|
||||||
|
```
|
||||||
|
|
||||||
|
镜像文件下载完成后,使用官方提供的校验文件验证镜像完整性。
|
||||||
|
|
||||||
|
```bash
|
||||||
## 检查文件是否存在
|
## 检查文件是否存在
|
||||||
$ ls -lah
|
$ ls -lah
|
||||||
|
|
||||||
## 显示校验文件内容
|
## 执行镜像文件校验
|
||||||
$ cat SHA512SUMS
|
$ sha512sum --check --ignore-missing SHA512SUMS
|
||||||
|
|
||||||
## 计算文件 hash
|
#### 镜像校验成功示例输出
|
||||||
$ sha512sum debian-12-generic-amd64.qcow2
|
debian-13-generic-amd64.qcow2: OK
|
||||||
```
|
```
|
||||||
|
|
||||||
确认无误后,将镜像文件导入刚才创建的虚拟机,命令中的 `VM ID` 需要根据实际情况替换,演示为 `1001` 。
|
确认无误后,将镜像文件导入刚才创建的虚拟机,命令中的 `VM ID` 需要根据实际情况替换,演示为 `1001` 。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 将 qcow2 镜像导入虚拟机中
|
## 将 qcow2 镜像导入虚拟机中
|
||||||
$ qm importdisk 1001 debian-12-generic-amd64.qcow2 local-lvm
|
$ qm importdisk 1001 debian-13-generic-amd64.qcow2 local-lvm
|
||||||
|
|
||||||
#### 镜像导入示例输出
|
#### 镜像导入示例输出
|
||||||
unused0: successfully imported disk 'local-lvm:vm-1001-disk-0'
|
unused0: successfully imported disk 'local-lvm:vm-1001-disk-2'
|
||||||
```
|
```
|
||||||
|
|
||||||
磁盘导入成功后,虚拟机硬件列表中将显示一块未使用的磁盘设备,可鼠标 **双击** 该设备进行配置调整。
|
磁盘导入成功后,虚拟机硬件列表中将显示一块未使用的磁盘设备,可鼠标 **双击** 该设备进行配置调整。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
当宿主机使用 `SSD` 作为物理存储设备,并且虚拟磁盘采用 `精简置备` (Thin Provisioning) 模式时,可考虑开启以下选项:
|
当宿主机使用 SSD 作为物理存储设备,并且虚拟磁盘采用 Thin Provisioning (精简置备)模式时,可考虑开启以下选项:
|
||||||
|
|
||||||
- `丢弃` (Discard) 选项,有助于存储空间回收。
|
- `丢弃` ( `Discard` ) 选项,有助于存储空间回收。
|
||||||
|
|
||||||
- `SSD仿真` (SSD Emulation) 选项,让虚拟机将虚拟磁盘视为 `SSD` 存储设备。
|
- `SSD 仿真` ( `SSD Emulation` ) 选项,让虚拟机将虚拟磁盘视为 SSD 存储设备。
|
||||||
|
|
||||||
在弹出的对话框中,确认 `IO thread` 选项为 **勾选** 状态,并点击 `添加` 。
|
在弹出的对话框中,确认 `IO thread` 选项为 **勾选** 状态,并点击 `新增` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
导入的镜像只有 `3G` 磁盘空间,为了后续方便使用,需要对磁盘进行扩容。
|
导入的镜像仅具备 `3GiB` 磁盘空间,为方便后续使用,可通过 `qm` 命令直接将该磁盘调整至目标容量。
|
||||||
|
|
||||||
鼠标 **单击** 选中该磁盘,选择页面顶部 `磁盘操作` 菜单的子菜单 `调整大小` 。
|
```bash
|
||||||
|
## 将镜像容量设置为 24G
|
||||||
|
$ qm disk resize 1001 scsi0 24G
|
||||||
|
|
||||||

|
#### 镜像扩容示例输出
|
||||||
|
Size of logical volume pve/vm-1001-disk-2 changed from 3.00 GiB (768 extents) to 24.00 GiB (6144 extents).
|
||||||
|
Logical volume pve/vm-1001-disk-2 successfully resized.
|
||||||
|
```
|
||||||
|
|
||||||
在弹出的对话框中,给该磁盘增加 `21G` 磁盘空间。
|
或 **单击** 选中该磁盘,然后使用 `磁盘操作` 菜单中的 `调整大小` 选项对磁盘镜像进行扩容。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 2.3.添加 CloudInit
|
在弹出的对话框中,给该磁盘增加 `21GiB` 磁盘空间。
|
||||||
|
|
||||||
为了能够正常使用 Cloud-Init 初始化系统,需要给模板虚拟机添加 `CloudInit设备` 。
|

|
||||||
|
|
||||||
点击顶部 `添加` 菜单,选择 `CloudInit设备` 。
|
### 2.5.添加 CloudInit
|
||||||
|
|
||||||

|
为确保 Cloud-Init 能正常初始化系统,需为模板虚拟机添加 `CloudInit 设备` 。
|
||||||
|
|
||||||
`总线/设备` 选择 `SCSI` ,编号为 `1` ,`存储` 选择 `local-lvm` 。
|
同样通过 `新增` 菜单,选择 `CloudInit 设备` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
`总线/设备` 选择 `SCSI` ,编号为 `1` ,存储路径需根据实际情况进行调整,演示为 `local-lvm` 。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
虚拟机硬件设备修改完成后,如下图所示。
|
虚拟机硬件设备修改完成后,如下图所示。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 3.调整配置参数
|
## 3.调整配置参数
|
||||||
|
|
||||||
@@ -187,17 +221,15 @@ unused0: successfully imported disk 'local-lvm:vm-1001-disk-0'
|
|||||||
|
|
||||||
鼠标 **双击** `引导顺序` 选项,进入编辑界面。
|
鼠标 **双击** `引导顺序` 选项,进入编辑界面。
|
||||||
|
|
||||||
在 `scsi0` 设备处,勾选前面的 “已启用” 复选框,并使用行首的排序功能,将该设备拖拽到第一个。
|
在 `scsi0` 设备处勾选 “已启用” 复选框,并通过排序功能将其拖拽至首位,点击 `确定` 即可。
|
||||||
|
|
||||||
然后点击 `OK` 按钮。
|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 3.2.设置平板指针
|
### 3.2.设置平板指针
|
||||||
|
|
||||||
关闭 `使用平板指针` 选项,可以一定程度上降低虚拟机的 CPU 使用率。
|
关闭 `使用平板指针` 选项,可以一定程度上降低虚拟机的 CPU 使用率。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 4.设置 Cloud-Init
|
## 4.设置 Cloud-Init
|
||||||
|
|
||||||
@@ -211,23 +243,20 @@ unused0: successfully imported disk 'local-lvm:vm-1001-disk-0'
|
|||||||
|--|--|--|
|
|--|--|--|
|
||||||
|用户|`fox`|新系统的管理员账户|
|
|用户|`fox`|新系统的管理员账户|
|
||||||
|密码|`********`|使用强密码|
|
|密码|`********`|使用强密码|
|
||||||
|DNS域|`fox.internal`|内网域名(可选)|
|
|DNS 域|`fox.internal`|内网域名(可选)|
|
||||||
|DNS服务器|`172.16.1.1`|本机 DNS 服务器|
|
|DNS 服务器|`172.16.1.1`|本机 DNS 服务器|
|
||||||
|SSH公钥|`无`|使用秘钥登录服务器,暂不使用|
|
|SSH 公钥|`无`|使用秘钥登录服务器,暂不使用|
|
||||||
|Upgrade packages|`是`|启动时更新软件包,保持默认即可|
|
|升级程序包|`是`|启动时更新软件包,保持默认即可|
|
||||||
|IP配置(net0)|`ip=172.16.1.250/24,gw=172.16.1.1,ip6=auto`|模板的 IP 设置|
|
|IP 配置 (net0)|`ip=172.16.1.250/24,gw=172.16.1.1,ip6=auto`|模板的 IP 设置|
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
- 修改 `Cloud-Init` 参数时,需要在虚拟机关机情况下修改才会生效
|
||||||
1. 修改 `Cloud-Init` 参数时,需要在虚拟机关机情况下修改才会生效。
|
- `DNS服务器` 参数支持输入多个 IPv4 / IPv6 地址,使用空格隔开
|
||||||
|
- 当前 `DNS服务器` 参数为主路由 LAN 口 IPv4 地址,确保虚拟机能正常联网
|
||||||
2. `DNS服务器` 参数支持输入多个 IPv4 / IPv6 地址,使用空格隔开。
|
|
||||||
|
|
||||||
3. 当前 `DNS服务器` 参数为主路由 LAN 口 IPv4 地址,确保虚拟机能正常联网。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
`Cloud-Init` 的 `IP配置` ,IPv4 使用静态地址,IPv6 使用 `SLAAC` 自动配置,如下图所示。
|
`Cloud-Init` 的 `IP 配置` ,IPv4 使用 `静态` 地址,IPv6 使用 `SLAAC` 自动配置,如下图所示。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -235,7 +264,7 @@ unused0: successfully imported disk 'local-lvm:vm-1001-disk-0'
|
|||||||
|
|
||||||
当主路由配置了 IPv6 ULA 网段,且希望指定内网 DNS 服务器的 IPv6 ULA 地址时,需要调整 `Cloud-Init` 参数。
|
当主路由配置了 IPv6 ULA 网段,且希望指定内网 DNS 服务器的 IPv6 ULA 地址时,需要调整 `Cloud-Init` 参数。
|
||||||
|
|
||||||
本文 IPv6 ULA 演示地址为 `fdac::/64` ,`DNS服务器` 和 `IP配置` 参数调整如下。
|
本文 IPv6 ULA 演示地址段为 `fdac::/64` ,`DNS 服务器` 和 `IP 配置` 参数调整如下。
|
||||||
|
|
||||||
|参数|值|说明|
|
|参数|值|说明|
|
||||||
|--|--|--|
|
|--|--|--|
|
||||||
@@ -243,13 +272,13 @@ unused0: successfully imported disk 'local-lvm:vm-1001-disk-0'
|
|||||||
|DNS服务器|`172.16.1.1 fdac::1`|本机 DNS 服务器|
|
|DNS服务器|`172.16.1.1 fdac::1`|本机 DNS 服务器|
|
||||||
|IP配置(net0)|`ip=172.16.1.250/24,gw=172.16.1.1,ip6=fdac::fa/64`|模板的 IP 设置|
|
|IP配置(net0)|`ip=172.16.1.250/24,gw=172.16.1.1,ip6=fdac::fa/64`|模板的 IP 设置|
|
||||||
|
|
||||||
`DNS服务器` 参数中需要加入主路由 LAN 口 IPv6 ULA 地址。
|
`DNS 服务器` 参数中需要加入主路由 LAN 口 IPv6 ULA 地址。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
`IP配置` 参数,IPv4 使用静态地址,IPv6 同样使用静态地址,如下图所示。
|
`IP 配置` 参数,IPv4 使用 `静态` 地址,IPv6 同样使用 `静态` 地址,如下图所示。
|
||||||
|
|
||||||
IPv6 使用静态地址后,并不影响虚拟机通过主路由获取公网 GUA IPv6 地址。
|
IPv6 使用 `静态` 地址后,并不影响虚拟机通过主路由获取 IPv6 GUA 公网地址。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -260,9 +289,9 @@ IPv6 使用静态地址后,并不影响虚拟机通过主路由获取公网 GU
|
|||||||
```bash
|
```bash
|
||||||
### 服务器信息
|
### 服务器信息
|
||||||
|
|
||||||
- 系统: Debian12
|
- 系统: Debian 13
|
||||||
|
|
||||||
- 用途: 内网 DNS 服务器 ( 模板 )
|
- 用途: 内网服务器 ( 模板 )
|
||||||
|
|
||||||
- 自启: 否
|
- 自启: 否
|
||||||
|
|
||||||
@@ -274,7 +303,7 @@ IPv6 使用静态地址后,并不影响虚拟机通过主路由获取公网 GU
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
至此,模板虚拟机创建完成,可将该虚拟机开机。
|
至此,模板虚拟机创建完成,可将该虚拟机开机。
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,29 @@
|
|||||||
## 1.配置系统
|
## 1.配置系统
|
||||||
|
|
||||||
在上一篇文章 [04.PVE创建模板虚拟机](./04.PVE创建模板虚拟机.md) 中,已经创建好了用于制作虚拟机模板的模板虚拟机。
|
在上一篇文章 [04.PVE创建模板虚拟机](./04.PVE创建模板虚拟机.md) 中,已经创建好了用于制作 `虚拟机模板` 的虚拟机。
|
||||||
|
|
||||||
并调整了模板虚拟机的硬件参数、配置参数,但还需对 Debian 系统进行调整。
|
此时将该虚拟机开机后,使用 `Cloud-Init` 中设置的账号密码进行登录。
|
||||||
|
|
||||||
此时将模板虚拟机开机后,使用 `Cloud-Init` 中设置的账号密码进行登录。
|
|
||||||
|
|
||||||
### 1.1.配置 SSH
|
### 1.1.配置 SSH
|
||||||
|
|
||||||
因为 Debian 的云镜像默认使用 SSH 秘钥登录,因此切换到左侧菜单的 `控制台` 进行登录。
|
因为 Debian 的云镜像默认使用 SSH 秘钥登录,因此切换到左侧菜单的 `控制台` 进行登录。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
在虚拟机的命令行界面,使用 `vim` 编辑器编辑 `sshd` 服务的配置文件,执行以下命令。
|
在虚拟机的命令行界面,使用 `vim` 编辑器编辑 `sshd` 服务的配置文件,执行以下命令。
|
||||||
|
|
||||||
`vim` 编辑器常用操作如下:
|
`vim` 编辑器常用操作如下:
|
||||||
|
|
||||||
- 编辑文件,按下键盘 `i` 键,进入编辑模式。
|
- 编辑文件:按下键盘 `i` 键,进入编辑模式。
|
||||||
|
|
||||||
- 保存文件,按下键盘 `Esc` 键,退出编辑模式,再输入组合键 `:wq` 即可保存。
|
- 保存文件:按下键盘 `Esc` 键,退出编辑模式,再输入组合键 `:wq` 即可保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 SSH 配置文件
|
## 编辑 SSH 配置文件
|
||||||
$ sudo vim /etc/ssh/sshd_config.d/10-server-sshd.conf
|
$ sudo vim /etc/ssh/sshd_config.d/10-server-sshd.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中输入以下内容,并保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## SSH 配置项
|
## SSH 配置项
|
||||||
@@ -51,76 +49,23 @@ $ sudo systemctl restart ssh.service
|
|||||||
|
|
||||||
当系统版本发生变化时,请参考 USTC 镜像站的官方说明 [USTC Mirror Help - Debian](https://mirrors.ustc.edu.cn/help/debian.html) 。
|
当系统版本发生变化时,请参考 USTC 镜像站的官方说明 [USTC Mirror Help - Debian](https://mirrors.ustc.edu.cn/help/debian.html) 。
|
||||||
|
|
||||||
Debian12 云镜像的软件源配置采用了 `DEB822` 格式,新版 `sources.list` 配置文件内容如下。
|
使用如下命令对 `debian.sources` 配置文件进行修改。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 查看镜像配置文件
|
## 配置 Debian 系统默认软件源脚本
|
||||||
$ cat /etc/apt/sources.list
|
$ sudo tee /etc/apt/sources.list.d/debian.sources >/dev/null <<'EOF'
|
||||||
|
|
||||||
#### 配置文件示例输出
|
|
||||||
# See /etc/apt/sources.list.d/debian.sources
|
|
||||||
```
|
|
||||||
|
|
||||||
进一步查看新配置文件 `debian.sources` 的内容,其配置包含 `3` 个部分。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 查看新版镜像配置文件
|
|
||||||
$ cat /etc/apt/sources.list.d/debian.sources
|
|
||||||
|
|
||||||
#### 新版配置文件示例输出 (主体部分)
|
|
||||||
Types: deb deb-src
|
|
||||||
URIs: mirror+file:///etc/apt/mirrors/debian.list
|
|
||||||
Suites: bookworm bookworm-updates bookworm-backports
|
|
||||||
Components: main
|
|
||||||
|
|
||||||
Types: deb deb-src
|
|
||||||
URIs: mirror+file:///etc/apt/mirrors/debian-security.list
|
|
||||||
Suites: bookworm-security
|
|
||||||
Components: main
|
|
||||||
|
|
||||||
## 查看关联的配置文件
|
|
||||||
$ cat /etc/apt/mirrors/debian.list
|
|
||||||
|
|
||||||
#### 关联配置文件示例输出 (关联部分 1 )
|
|
||||||
https://deb.debian.org/debian
|
|
||||||
|
|
||||||
## 查看关联的配置文件
|
|
||||||
$ cat /etc/apt/mirrors/debian-security.list
|
|
||||||
|
|
||||||
#### 关联配置文件示例输出 (关联部分 2 )
|
|
||||||
https://deb.debian.org/debian-security
|
|
||||||
```
|
|
||||||
|
|
||||||
因此,修改 Debian12 软件源的方式也有两种,本文将尝试使用第 `2` 种修改方案。
|
|
||||||
|
|
||||||
1. 删除当前软件源配置文件,重新启用常规 `sources.list` 配置文件的配置方案。
|
|
||||||
|
|
||||||
2. 根据当前软件源配置文件的语法规则,仅修改配置文件。
|
|
||||||
|
|
||||||
使用 `vim` 编辑器编辑 `debian.sources` 配置文件,执行以下命令。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 编辑 debian.sources 配置文件
|
|
||||||
$ sudo vim /etc/apt/sources.list.d/debian.sources
|
|
||||||
```
|
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 系统软件源配置项
|
|
||||||
|
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: https://mirrors.ustc.edu.cn/debian
|
URIs: https://mirrors.ustc.edu.cn/debian
|
||||||
Suites: bookworm bookworm-updates
|
Suites: trixie trixie-updates
|
||||||
Components: main contrib non-free non-free-firmware
|
Components: main contrib non-free non-free-firmware
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: https://mirrors.ustc.edu.cn/debian-security
|
URIs: https://mirrors.ustc.edu.cn/debian-security
|
||||||
Suites: bookworm-security
|
Suites: trixie-security
|
||||||
Components: main contrib non-free non-free-firmware
|
Components: main contrib non-free non-free-firmware
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
为了防止 `Cloud-Init` 服务意外修改软件源配置,需要添加文件保护,执行以下命令。
|
为了防止 `Cloud-Init` 服务意外修改软件源配置,需要添加文件保护,执行以下命令。
|
||||||
@@ -155,13 +100,19 @@ $ sudo apt full-upgrade
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ sudo apt install qemu-guest-agent zsh git btop tmux logrotate cron nftables sshguard neovim
|
$ sudo apt install btop cronie curl git logrotate neovim qemu-guest-agent tmux zsh
|
||||||
|
|
||||||
## 安装系统自动更新工具
|
## 安装系统自动更新工具
|
||||||
$ sudo apt install unattended-upgrades powermgmt-base python3-gi
|
$ sudo apt install powermgmt-base unattended-upgrades
|
||||||
|
|
||||||
## 安装网络工具
|
## 安装网络工具
|
||||||
$ sudo apt install iperf iperf3 iftop lsof knot-dnsutils
|
$ sudo apt install knot-dnsutils lsof nftables sshguard
|
||||||
|
|
||||||
|
## 安装网络检测工具(可选)
|
||||||
|
$ sudo apt install iftop iperf iperf3
|
||||||
|
|
||||||
|
## 刷新 systemd 日志分类索引
|
||||||
|
$ sudo journalctl --update-catalog
|
||||||
|
|
||||||
## 写入磁盘
|
## 写入磁盘
|
||||||
$ sudo sync
|
$ sudo sync
|
||||||
@@ -172,10 +123,8 @@ $ sudo sync
|
|||||||
`Zsh` 是比 `Bash` 好用的 `Shell` 程序,使用 `oh-my-zsh` 进行配置。
|
`Zsh` 是比 `Bash` 好用的 `Shell` 程序,使用 `oh-my-zsh` 进行配置。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 使用清华大学镜像站安装 oh-my-zsh
|
## 安装 oh-my-zsh
|
||||||
$ cd && git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git
|
$ sh -c "$(curl -fsSL https://install.ohmyz.sh)"
|
||||||
|
|
||||||
$ cd ohmyzsh/tools && REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh install.sh
|
|
||||||
|
|
||||||
## 询问是否切换默认 shell,输入 Y
|
## 询问是否切换默认 shell,输入 Y
|
||||||
|
|
||||||
@@ -184,64 +133,89 @@ Time to change your default shell to zsh:
|
|||||||
Do you want to change your default shell to zsh? [Y/n] y
|
Do you want to change your default shell to zsh? [Y/n] y
|
||||||
|
|
||||||
## oh-my-zsh 安装后清理
|
## oh-my-zsh 安装后清理
|
||||||
$ cd && rm -rvf ohmyzsh .bash_history .zsh_history .shell.pre-oh-my-zsh
|
$ cd && rm -rvf .bash_history .zsh_history .shell.pre-oh-my-zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.5.调整内核参数
|
### 1.5.配置默认编辑器
|
||||||
|
|
||||||
由于该 Debian 虚拟机模板将用于克隆内网 DNS 服务器,因此需要调整内核参数来简单优化性能。
|
Debian 系统默认编辑器为 `nano` ,推荐将默认编辑器更换为 `neovim` ,执行以下命令。
|
||||||
|
|
||||||
使用 `neovim` 编辑器编辑 **内核参数** 配置文件,执行以下命令。
|
```bash
|
||||||
|
## 修改系统默认编辑器(选择 nvim 所在条目,即可将 neovim 设为默认编辑器)
|
||||||
|
$ sudo update-alternatives --config editor
|
||||||
|
|
||||||
|
#### 系统默认编辑器示例输出
|
||||||
|
There are 4 choices for the alternative editor (providing /usr/bin/editor).
|
||||||
|
|
||||||
|
Selection Path Priority Status
|
||||||
|
------------------------------------------------------------
|
||||||
|
* 0 /bin/nano 40 auto mode
|
||||||
|
1 /bin/nano 40 manual mode
|
||||||
|
2 /usr/bin/nvim 30 manual mode
|
||||||
|
3 /usr/bin/vim.basic 30 manual mode
|
||||||
|
4 /usr/bin/vim.tiny 15 manual mode
|
||||||
|
|
||||||
|
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 install -D -m 0644 /dev/stdin /etc/xdg/nvim/sysinit.vim <<'EOF'
|
||||||
|
set mouse=
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.6.调整内核参数
|
||||||
|
|
||||||
|
由于该虚拟机将作为内网 DNS 服务器的克隆模板,需调整内核参数以优化性能。
|
||||||
|
|
||||||
|
编辑 **内核参数** 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 内核参数 配置文件
|
## 编辑 内核参数 配置文件
|
||||||
$ sudo nvim /etc/sysctl.d/99-sysctl.conf
|
$ sudo tee /etc/sysctl.d/99-sysctl.conf >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件末尾输入以下配置项,注意配置中间的空格。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
# 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 = 20
|
||||||
kernel.panic_on_oops = 1
|
kernel.panic_on_oops = 1
|
||||||
|
|
||||||
net.core.default_qdisc = fq_codel
|
net.core.default_qdisc = fq_codel
|
||||||
net.ipv4.tcp_congestion_control = cubic
|
|
||||||
|
|
||||||
# Other adjustable system parameters
|
# Other adjustable system parameters
|
||||||
|
|
||||||
net.core.netdev_budget = 600
|
net.core.netdev_budget = 600
|
||||||
net.core.netdev_budget_usecs = 20000
|
net.core.netdev_max_backlog = 4096
|
||||||
|
|
||||||
net.core.somaxconn = 8192
|
net.core.rmem_default = 262144
|
||||||
net.core.rmem_max = 26214400
|
net.core.wmem_default = 262144
|
||||||
net.core.wmem_max = 655360
|
net.core.rmem_max = 16777216
|
||||||
|
net.core.wmem_max = 16777216
|
||||||
|
|
||||||
net.ipv4.igmp_max_memberships = 256
|
|
||||||
|
|
||||||
net.ipv4.tcp_challenge_ack_limit = 1000
|
|
||||||
net.ipv4.tcp_fastopen = 3
|
net.ipv4.tcp_fastopen = 3
|
||||||
net.ipv4.tcp_fin_timeout = 30
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
net.ipv4.tcp_keepalive_time = 120
|
net.ipv4.tcp_keepalive_time = 600
|
||||||
|
net.ipv4.tcp_max_syn_backlog = 4096
|
||||||
net.ipv4.tcp_notsent_lowat = 131072
|
net.ipv4.tcp_notsent_lowat = 131072
|
||||||
net.ipv4.tcp_rmem = 4096 87380 26214400
|
net.ipv4.tcp_rmem = 4096 524288 16777216
|
||||||
net.ipv4.tcp_wmem = 4096 16384 655360
|
net.ipv4.tcp_wmem = 4096 524288 16777216
|
||||||
|
|
||||||
net.ipv6.conf.all.use_tempaddr = 0
|
net.ipv6.conf.all.use_tempaddr = 0
|
||||||
net.ipv6.conf.default.use_tempaddr = 0
|
net.ipv6.conf.default.use_tempaddr = 0
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
保存该配置文件后,重启系统或者执行以下命令让配置生效。
|
配置文件编辑完成后,重启系统或者执行以下命令让配置生效。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 让内核参数生效
|
## 让内核参数生效
|
||||||
$ sudo sysctl -f
|
$ sudo sysctl --system
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.6.调整系统时间
|
### 1.7.调整系统时间
|
||||||
|
|
||||||
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
||||||
|
|
||||||
@@ -253,7 +227,7 @@ $ sudo timedatectl set-timezone Asia/Shanghai
|
|||||||
$ date -R
|
$ date -R
|
||||||
|
|
||||||
#### 系统时间示例输出
|
#### 系统时间示例输出
|
||||||
Mon, 26 Jun 2023 16:16:16 +0800
|
Mon, 10 Aug 2026 11:23:56 +0800
|
||||||
```
|
```
|
||||||
|
|
||||||
Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需要调整为使用国内 NTP 服务器。
|
Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需要调整为使用国内 NTP 服务器。
|
||||||
@@ -265,21 +239,16 @@ Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需
|
|||||||
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
||||||
|
|
||||||
## 创建 NTP 配置文件
|
## 创建 NTP 配置文件
|
||||||
$ sudo nvim /etc/systemd/timesyncd.conf.d/10-server-ntp.conf
|
$ sudo tee /etc/systemd/timesyncd.conf.d/10-server-ntp.conf >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
# Optimize system NTP server.
|
# Optimize system NTP server.
|
||||||
|
|
||||||
[Time]
|
[Time]
|
||||||
NTP=ntp.aliyun.com ntp.tencent.com cn.pool.ntp.org
|
NTP=ntp.aliyun.com ntp.tencent.com cn.pool.ntp.org
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
保存该配置文件后,需重启 `systemd-timesyncd.service` 服务,并再次检查系统 NTP 服务器地址。
|
配置文件编辑完成后,需重启 `systemd-timesyncd.service` 服务,并再次检查系统 NTP 服务器地址。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 重启 systemd-timesyncd.service
|
## 重启 systemd-timesyncd.service
|
||||||
@@ -294,24 +263,25 @@ $ sudo systemctl status systemd-timesyncd.service
|
|||||||
```bash
|
```bash
|
||||||
#### NTP 服务示例输出
|
#### NTP 服务示例输出
|
||||||
● systemd-timesyncd.service - Network Time Synchronization
|
● systemd-timesyncd.service - Network Time Synchronization
|
||||||
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
|
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
|
||||||
Active: active (running) since Mon 2024-10-07 18:06:29 CST; 9s ago
|
Active: active (running) since Mon 2026-08-10 11:24:43 CST; 5s ago
|
||||||
|
Invocation: 95cd4555913e45d8a7235347cf3d571a
|
||||||
Docs: man:systemd-timesyncd.service(8)
|
Docs: man:systemd-timesyncd.service(8)
|
||||||
Main PID: 1706 (systemd-timesyn)
|
Main PID: 6516 (systemd-timesyn)
|
||||||
Status: "Contacted time server 203.107.6.88:123 (ntp.aliyun.com)."
|
Status: "Contacted time server 203.107.6.88:123 (ntp.aliyun.com)."
|
||||||
Tasks: 2 (limit: 2315)
|
Tasks: 2 (limit: 2189)
|
||||||
Memory: 1.4M
|
Memory: 1.6M (peak: 2.3M)
|
||||||
CPU: 113ms
|
CPU: 136ms
|
||||||
CGroup: /system.slice/systemd-timesyncd.service
|
CGroup: /system.slice/systemd-timesyncd.service
|
||||||
└─1706 /lib/systemd/systemd-timesyncd
|
└─6516 /usr/lib/systemd/systemd-timesyncd
|
||||||
|
|
||||||
Oct 07 18:06:29 DNS01 systemd[1]: Starting systemd-timesyncd.service - Network Time Synchronization...
|
Aug 10 11:24:43 TPL01 systemd[1]: Starting systemd-timesyncd.service - Network Time Synchronization...
|
||||||
Oct 07 18:06:29 DNS01 systemd[1]: Started systemd-timesyncd.service - Network Time Synchronization.
|
Aug 10 11:24:43 TPL01 systemd[1]: Started systemd-timesyncd.service - Network Time Synchronization.
|
||||||
Oct 07 18:06:29 DNS01 systemd-timesyncd[1706]: Contacted time server 203.107.6.88:123 (ntp.aliyun.com).
|
Aug 10 11:24:43 TPL01 systemd-timesyncd[6516]: Contacted time server 203.107.6.88:123 (ntp.aliyun.com).
|
||||||
Oct 07 18:06:29 DNS01 systemd-timesyncd[1706]: Initial clock synchronization to Mon 2024-10-07 18:06:29.499548 CST.
|
Aug 10 11:24:43 TPL01 systemd-timesyncd[6516]: Initial clock synchronization to Mon 2026-08-10 11:24:43.569158 CST.
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.7.配置自动更新
|
### 1.8.配置自动更新
|
||||||
|
|
||||||
配置 Debian 云镜像的系统自动更新,与配置 PVE 系统自动更新方法基本一致,参阅 [03.PVE系统调整](./03.PVE系统调整.md) 。
|
配置 Debian 云镜像的系统自动更新,与配置 PVE 系统自动更新方法基本一致,参阅 [03.PVE系统调整](./03.PVE系统调整.md) 。
|
||||||
|
|
||||||
@@ -332,44 +302,35 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
|||||||
<Yes>
|
<Yes>
|
||||||
```
|
```
|
||||||
|
|
||||||
进一步调整 `20auto-upgrades` 配置文件。
|
开始调整 `20auto-upgrades` 配置文件。
|
||||||
|
|
||||||
```bash
|
|
||||||
## 编辑 20auto-upgrades 配置文件
|
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/20auto-upgrades
|
|
||||||
```
|
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
|
||||||
|
|
||||||
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`3` 表示更新周期为 `3` 天。
|
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`3` 表示更新周期为 `3` 天。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 系统更新周期配置项
|
## 编辑 20auto-upgrades 配置文件
|
||||||
|
$ sudo tee /etc/apt/apt.conf.d/20auto-upgrades >/dev/null <<'EOF'
|
||||||
APT::Periodic::Update-Package-Lists "1";
|
APT::Periodic::Update-Package-Lists "1";
|
||||||
APT::Periodic::Unattended-Upgrade "3";
|
APT::Periodic::Unattended-Upgrade "3";
|
||||||
APT::Periodic::AutocleanInterval "1";
|
APT::Periodic::AutocleanInterval "1";
|
||||||
APT::Periodic::CleanInterval "1";
|
APT::Periodic::CleanInterval "1";
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
进一步调整 `50unattended-upgrades` 配置文件。
|
进一步调整 `50unattended-upgrades` 配置文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 50unattended-upgrades 配置文件
|
## 编辑 50unattended-upgrades 配置文件
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
$ sudo editor /etc/apt/apt.conf.d/50unattended-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
根据 “注释” 中相关说明,调整配置文件。
|
因为该配置文件很长,完整的配置文件可查看 [debian_tpl_50unattended_upgrades.conf](./src/debian/debian_tpl_50unattended_upgrades.conf) 以便对比。
|
||||||
|
|
||||||
因为该配置文件很长,完整的配置文件可查看 [debian_dns_50unattended_upgrades.conf](./src/debian/debian_dns_50unattended_upgrades.conf) 以便对比。
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 删除以下行前面的注释符 // ,代表启用
|
## 删除以下行前面的注释符 // ,代表启用
|
||||||
|
|
||||||
"origin=Debian,codename=${distro_codename}-updates";
|
"origin=Debian,codename=${distro_codename}-updates";
|
||||||
|
|
||||||
## 在配置文件末尾增加以下配置项,代表启用,并调整参数
|
## 在配置文件末尾增加以下内容,代表启用,并调整参数
|
||||||
|
|
||||||
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||||
|
|
||||||
@@ -385,14 +346,14 @@ Unattended-Upgrade::Automatic-Reboot-Time "03:00";
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
系统自动更新配置文件修改完成后,需要重设自动更新定时器,执行以下命令。
|
系统自动更新配置文件修改完成后,需调整自动更新定时器,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 配置系统定时器
|
## 配置系统定时器
|
||||||
$ sudo systemctl edit apt-daily-upgrade.timer
|
$ sudo systemctl edit apt-daily-upgrade.timer
|
||||||
```
|
```
|
||||||
|
|
||||||
根据配置文件中的提示,在中间空白处填入以下配置项。
|
根据配置文件中的提示,在中间空白处填入以下内容。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 定时器配置项
|
## 定时器配置项
|
||||||
@@ -416,28 +377,28 @@ $ sudo systemctl restart apt-daily-upgrade.timer
|
|||||||
$ sudo systemctl status apt-daily-upgrade.timer
|
$ sudo systemctl status apt-daily-upgrade.timer
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.8.配置定时任务
|
### 1.9.配置定时任务
|
||||||
|
|
||||||
本步骤为可选操作,主要设置系统定时重启。
|
本步骤为可选操作,主要设置系统定时重启。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 查看系统定时任务
|
## 创建本机定时重启任务
|
||||||
$ sudo crontab -l
|
$ sudo tee /etc/cron.d/guest-os-reboot >/dev/null <<'EOF'
|
||||||
|
30 4 8,24 * * root /usr/sbin/shutdown --reboot now
|
||||||
|
EOF
|
||||||
|
|
||||||
## 编辑系统定时任务,编辑器选择 nano
|
## 设置定时任务文件权限
|
||||||
$ sudo crontab -e
|
$ sudo chmod 0644 /etc/cron.d/guest-os-reboot
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件末尾,增加以下配置项。
|
系统全局定时任务排期状态可使用以下命令进行查看。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 定时任务配置项
|
## 查看系统定时任务
|
||||||
|
$ sudo cronnext -acl
|
||||||
30 4 8,24 * * /usr/sbin/reboot
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.9.清理系统
|
### 1.10.清理系统
|
||||||
|
|
||||||
Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对系统进行清理。
|
Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对系统进行清理。
|
||||||
|
|
||||||
@@ -446,29 +407,29 @@ Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对
|
|||||||
$ sudo bash -c 'apt clean && apt autoclean && apt autoremove --purge'
|
$ sudo bash -c 'apt clean && apt autoclean && apt autoremove --purge'
|
||||||
|
|
||||||
## 清理系统缓存
|
## 清理系统缓存
|
||||||
$ sudo bash -c 'find /var/cache/apt/ /var/cache/smartdns/ /var/lib/apt/lists/ /tmp/ -type f -print -delete'
|
$ sudo bash -c 'find /var/cache/apt/ /var/lib/apt/lists/ /tmp/ -type f -print -delete'
|
||||||
|
|
||||||
|
## 重置机器标识符
|
||||||
|
$ sudo truncate -s 0 /etc/machine-id /var/lib/dbus/machine-id
|
||||||
|
|
||||||
## 清理系统日志
|
## 清理系统日志
|
||||||
$ sudo bash -c 'find /var/log/ -type f -print -delete'
|
$ sudo bash -c 'find /var/log/ -type f -print -delete'
|
||||||
|
|
||||||
## 清理命令历史记录文件
|
## 清理命令历史记录文件并关闭系统
|
||||||
$ rm -rvf ~/.bash_history ~/.zsh_history ~/.zcompdump* && history -c
|
$ rm -rvf ~/.bash_history ~/.zsh_history ~/.zcompdump* && history -c && sudo shutdown now
|
||||||
|
|
||||||
## 关闭系统
|
|
||||||
$ sudo shutdown now
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2.虚拟机转为模板
|
## 2.虚拟机转为模板
|
||||||
|
|
||||||
在 Debian 模板虚拟机关机后,进入 PVE 的 WEB 管理界面。
|
在模板虚拟机关机后,进入 PVE 的 WEB 管理界面。
|
||||||
|
|
||||||
在左侧虚拟机列表中,鼠标 **右键单击** Debian 模板虚拟机,在弹出的菜单中选择 `转换成模板` 。
|
在左侧虚拟机列表中,鼠标 **右键单击** 模板虚拟机,在弹出的菜单中选择 `转换成模板` 。
|
||||||
|
|
||||||
需要说明的是,虚拟机 `转换成模板` 的操作是不可逆的。
|
需要说明的是,虚拟机 `转换成模板` 的操作具有不可逆性。
|
||||||
|
|
||||||
如果某些 Debian 系统的配置项有问题,只能在用该模板克隆出来的新虚拟机中进行修改,或者删除并重新制作模板。
|
若系统配置存在问题,仅能在该模板克隆的新虚拟机中修改,或删除现有模板并重新制作。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
至此 Debian 虚拟机模板制作完成。
|
至此 Debian 虚拟机模板制作完成。
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
在上一篇文章 [05.PVE制作虚拟机模板](./05.PVE制作虚拟机模板.md) 中,已经制作好了虚拟机模板。
|
在上一篇文章 [05.PVE制作虚拟机模板](./05.PVE制作虚拟机模板.md) 中,已经制作好了虚拟机模板。
|
||||||
|
|
||||||
接下来将使用该模板克隆出新的虚拟机,并安装 Adguard Home 作为内网的 DNS 服务器。
|
接下来将基于该模板克隆新虚拟机,并通过安装 DNS 服务器软件,完成内网 DNS 服务器的搭建。
|
||||||
|
|
||||||
鼠标 **右键单击** 虚拟机模板,在弹出的菜单中选择 `克隆` 。
|
鼠标 **右键单击** 虚拟机模板,在弹出的菜单中选择 `克隆` 。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
在弹出的虚拟机克隆对话框中,根据实际情况及下方表格内容,修改虚拟机参数。
|
在弹出的虚拟机克隆对话框中,根据实际情况及下方表格内容,修改虚拟机参数。
|
||||||
|
|
||||||
@@ -78,11 +78,11 @@
|
|||||||
$ sudo lsof -n -i :53
|
$ sudo lsof -n -i :53
|
||||||
|
|
||||||
#### 端口占用示例输出
|
#### 端口占用示例输出
|
||||||
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
|
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
|
||||||
systemd-r 1797 systemd-resolve 18u IPv4 23024 0t0 UDP 127.0.0.53:domain
|
systemd-r 357 systemd-resolve 18u IPv4 3293 0t0 UDP 127.0.0.53:domain
|
||||||
systemd-r 1797 systemd-resolve 19u IPv4 23025 0t0 TCP 127.0.0.53:domain (LISTEN)
|
systemd-r 357 systemd-resolve 19u IPv4 3294 0t0 TCP 127.0.0.53:domain (LISTEN)
|
||||||
systemd-r 1797 systemd-resolve 20u IPv4 23026 0t0 UDP 127.0.0.54:domain
|
systemd-r 357 systemd-resolve 20u IPv4 3295 0t0 UDP 127.0.0.54:domain
|
||||||
systemd-r 1797 systemd-resolve 21u IPv4 23027 0t0 TCP 127.0.0.54:domain (LISTEN)
|
systemd-r 357 systemd-resolve 21u IPv4 3296 0t0 TCP 127.0.0.54:domain (LISTEN)
|
||||||
```
|
```
|
||||||
|
|
||||||
当前系统 `53` 端口被 `systemd-resolved.service` 占用,会导致设置 DNS 服务时监听端口失败。
|
当前系统 `53` 端口被 `systemd-resolved.service` 占用,会导致设置 DNS 服务时监听端口失败。
|
||||||
@@ -94,12 +94,7 @@ systemd-r 1797 systemd-resolve 21u IPv4 23027 0t0 TCP 127.0.0.54:domai
|
|||||||
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
||||||
|
|
||||||
## 创建 systemd-resolved 配置文件
|
## 创建 systemd-resolved 配置文件
|
||||||
$ sudo nvim /etc/systemd/resolved.conf.d/10-server-dns.conf
|
$ sudo tee /etc/systemd/resolved.conf.d/10-server-dns.conf >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
# Optimize system resolve parameters for local DNS server.
|
# Optimize system resolve parameters for local DNS server.
|
||||||
|
|
||||||
@@ -107,14 +102,14 @@ $ sudo nvim /etc/systemd/resolved.conf.d/10-server-dns.conf
|
|||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
DNS=::1
|
DNS=::1
|
||||||
DNSStubListener=no
|
DNSStubListener=no
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
保存该配置文件后,还需调整系统 `resolv.conf` 配置文件,执行以下命令。
|
配置文件编辑完成后,还需调整系统 `resolv.conf` 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 resolv.conf 软链接
|
## 创建 resolv.conf 软链接
|
||||||
$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
配置完成后,需重启 `systemd-resolved.service` 服务,并再次检查系统 `53` 端口占用。
|
配置完成后,需重启 `systemd-resolved.service` 服务,并再次检查系统 `53` 端口占用。
|
||||||
@@ -164,20 +159,13 @@ $ sudo snap set system refresh.timer=mon,2:30,,fri,2:30
|
|||||||
本步骤为可选操作,主要用于设置 `Adguard Home` 定时重启。
|
本步骤为可选操作,主要用于设置 `Adguard Home` 定时重启。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 查看系统定时任务
|
## 创建 Adguard Home 定时重启任务
|
||||||
$ sudo crontab -l
|
$ sudo tee /etc/cron.d/adguard-home-restart >/dev/null <<'EOF'
|
||||||
|
30 4 * * * root /usr/bin/snap restart adguard-home
|
||||||
## 编辑系统定时任务,编辑器选择 nano
|
EOF
|
||||||
$ sudo crontab -e
|
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件末尾,增加以下配置项。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 定时任务配置项
|
|
||||||
|
|
||||||
30 4 * * * /usr/bin/snap restart adguard-home
|
|
||||||
|
|
||||||
|
## 设置定时任务文件权限
|
||||||
|
$ sudo chmod 0644 /etc/cron.d/adguard-home-restart
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6. SmartDNS
|
## 6. SmartDNS
|
||||||
@@ -206,29 +194,21 @@ $ sudo systemctl enable dnsmasq.service
|
|||||||
$ sudo systemctl stop dnsmasq.service
|
$ sudo systemctl stop dnsmasq.service
|
||||||
```
|
```
|
||||||
|
|
||||||
下载 `SmartDNS` 最新版本时,请根据系统架构选择合适的版本,执行以下命令。
|
下载 `SmartDNS` 当前最新版本时,请根据系统架构选择合适的版本,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建存放 SmartDNS 安装包的临时目录
|
|
||||||
$ mkdir -p /tmp/SmartDNS
|
|
||||||
|
|
||||||
## 进入目录
|
|
||||||
$ cd /tmp/SmartDNS
|
|
||||||
|
|
||||||
## 下载 SmartDNS 安装包
|
## 下载 SmartDNS 安装包
|
||||||
$ curl -LR -O https://github.com/pymumu/smartdns/releases/download/Release46/smartdns.1.2024.06.12-2222.x86_64-linux-all.tar.gz
|
$ curl -LR https://github.com/pymumu/smartdns/releases/download/Release48.4/smartdns.1.2026.08.05-0921.x86_64-linux-all.tar.gz | tar -xz -C /tmp
|
||||||
|
|
||||||
## 解压缩 SmartDNS 安装包
|
|
||||||
$ tar zxf smartdns.1.2024.06.12-2222.x86_64-linux-all.tar.gz
|
|
||||||
|
|
||||||
## 进入安装包目录
|
|
||||||
$ cd smartdns
|
|
||||||
|
|
||||||
## 设置脚本可执行权限
|
|
||||||
$ chmod +x ./install
|
|
||||||
|
|
||||||
## 安装 SmartDNS
|
## 安装 SmartDNS
|
||||||
$ sudo ./install -i
|
$ sudo /tmp/smartdns/install -i
|
||||||
|
```
|
||||||
|
|
||||||
|
后续 `SmartDNS` 推出新版本需原位升级时:先下载最新版本,再将以下命令替代原安装命令执行,升级后现有配置不会丢失。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 升级 SmartDNS
|
||||||
|
$ sudo /tmp/smartdns/install -U
|
||||||
```
|
```
|
||||||
|
|
||||||
修改 `SmartDNS` 配置之前,需检查 `smartdns.service` 服务状态,确保该服务开机自启。
|
修改 `SmartDNS` 配置之前,需检查 `smartdns.service` 服务状态,确保该服务开机自启。
|
||||||
@@ -252,7 +232,7 @@ $ sudo systemctl enable smartdns.service
|
|||||||
$ sudo mkdir -p /etc/smartdns.d
|
$ sudo mkdir -p /etc/smartdns.d
|
||||||
|
|
||||||
## 下载广告规则配置文件
|
## 下载广告规则配置文件
|
||||||
$ sudo curl -LR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
$ sudo curl -LR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
`SmartDNS` 的加速规则通过 `bash` 脚本安装,脚本生成的配置文件位于 `/etc/smartdns.d` 目录。
|
`SmartDNS` 的加速规则通过 `bash` 脚本安装,脚本生成的配置文件位于 `/etc/smartdns.d` 目录。
|
||||||
@@ -261,46 +241,46 @@ $ sudo curl -LR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 下载加速规则安装脚本
|
## 下载加速规则安装脚本
|
||||||
$ sudo curl -LR -o /opt/smartdns-plugin.sh https://gitee.com/callmer/smartdns_china_list_installer/raw/main/smartdns_plugin.sh
|
$ sudo curl -LR -o /usr/local/bin/smartdns-cnlist https://gitee.com/callmer/smartdns_china_list_installer/raw/main/smartdns-china-list-installer.sh
|
||||||
|
|
||||||
## 设置脚本可执行权限
|
## 设置脚本可执行权限
|
||||||
$ sudo chmod +x /opt/smartdns-plugin.sh
|
$ sudo chmod +x /usr/local/bin/smartdns-cnlist
|
||||||
|
|
||||||
## 设置脚本文件防篡改
|
## 设置脚本文件防篡改
|
||||||
$ sudo chattr +i /opt/smartdns-plugin.sh
|
$ sudo chattr +i /usr/local/bin/smartdns-cnlist
|
||||||
|
|
||||||
## 执行脚本
|
## 执行脚本
|
||||||
$ sudo bash /opt/smartdns-plugin.sh
|
$ sudo /usr/local/bin/smartdns-cnlist
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6.2.定时任务
|
### 6.2.定时任务
|
||||||
|
|
||||||
本步骤为可选操作,主要用于设置 `SmartDNS` 定时更新附加配置文件和定时重启。
|
本步骤为可选操作,主要用于设置 `SmartDNS` 定时更新附加配置文件和定时重启。
|
||||||
|
|
||||||
|
若使用了 `SmartDNS` 加速规则的安装脚本,由于脚本自带服务重启功能,因此定时任务可设置如下。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑系统定时任务,编辑器选择 nano
|
## 创建 SmartDNS 规则更新任务
|
||||||
$ sudo crontab -e
|
$ sudo tee /etc/cron.d/smartdns-rules-update >/dev/null <<'EOF'
|
||||||
|
20 9 * * * root /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
|
||||||
|
30 9 * * * root /usr/local/bin/smartdns-cnlist
|
||||||
|
EOF
|
||||||
|
|
||||||
|
## 设置定时任务文件权限
|
||||||
|
$ sudo chmod 0644 /etc/cron.d/smartdns-rules-update
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件末尾,增加以下配置项。
|
若仅需定时重启 `SmartDNS` 服务,可使用以下命令覆盖该定时任务文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 定时任务配置项
|
## 创建 SmartDNS 规则更新任务
|
||||||
|
$ sudo tee /etc/cron.d/smartdns-rules-update >/dev/null <<'EOF'
|
||||||
|
20 9 * * * root /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/anti-ad.smartdns.conf https://anti-ad.net/anti-ad-for-smartdns.conf
|
||||||
|
30 9 * * * root /usr/bin/systemctl restart smartdns.service
|
||||||
|
EOF
|
||||||
|
|
||||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
## 设置定时任务文件权限
|
||||||
|
$ sudo chmod 0644 /etc/cron.d/smartdns-rules-update
|
||||||
30 9 * * * /usr/bin/systemctl restart smartdns.service
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
若使用了 `SmartDNS` 加速规则的安装脚本,由于脚本自带服务重启功能,因此定时任务可修改如下。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 定时任务配置项
|
|
||||||
|
|
||||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
|
||||||
|
|
||||||
30 9 * * * /usr/bin/bash /opt/smartdns-plugin.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6.3. SmartDNS 主配置
|
### 6.3. SmartDNS 主配置
|
||||||
@@ -324,20 +304,18 @@ $ sudo rm -rvf /var/run/smartdns.pid /run/smartdns.pid
|
|||||||
$ sudo mv /etc/smartdns/smartdns.conf /etc/smartdns/smartdns.conf.bak
|
$ sudo mv /etc/smartdns/smartdns.conf /etc/smartdns/smartdns.conf.bak
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `neovim` 编辑器创建 `SmartDNS` 主配置文件,执行以下命令。
|
创建 `SmartDNS` 主配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 SmartDNS 主配置文件
|
## 创建 SmartDNS 主配置文件
|
||||||
$ sudo nvim /etc/smartdns/smartdns.conf
|
$ sudo editor /etc/smartdns/smartdns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中输入以下内容,并保存。
|
在编辑器对话框中输入以下内容,并保存。
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
- `SmartDNS` 端口监听参数为 `6053@lo` ,WebUI 端口监听参数为 `5380` ,请根据实际情况进行调整
|
||||||
- `SmartDNS` 端口监听参数为 `6053@lo` ,请根据实际情况进行调整
|
- WebUI 默认用户名密码为 `admin/password` ,若需公网访问建议将默认密码修改为强密码
|
||||||
|
|
||||||
- 检查配置文件中关于本地域名及其上游 DNS 服务器相关配置,请根据实际情况进行调整
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
@@ -358,13 +336,26 @@ $ sudo nvim /etc/smartdns/smartdns.conf
|
|||||||
conf-file /etc/smartdns.d/*.conf
|
conf-file /etc/smartdns.d/*.conf
|
||||||
|
|
||||||
log-level notice
|
log-level notice
|
||||||
|
log-console yes
|
||||||
|
log-size 16M
|
||||||
|
log-num 8
|
||||||
|
|
||||||
|
audit-enable yes
|
||||||
|
audit-SOA yes
|
||||||
|
audit-size 16M
|
||||||
|
audit-num 8
|
||||||
|
|
||||||
|
plugin smartdns_ui.so
|
||||||
|
smartdns-ui.ip https://[::]:5380
|
||||||
|
smartdns-ui.token-expire 1800
|
||||||
|
smartdns-ui.max-query-log-age 604800
|
||||||
|
|
||||||
bind [::]:6053@lo
|
bind [::]:6053@lo
|
||||||
bind-tcp [::]:6053@lo
|
bind-tcp [::]:6053@lo
|
||||||
|
|
||||||
cache-size 32768
|
cache-size 32768
|
||||||
max-query-limit 1024
|
max-query-limit 1024
|
||||||
max-reply-ip-num 24
|
max-reply-ip-num 16
|
||||||
|
|
||||||
prefetch-domain yes
|
prefetch-domain yes
|
||||||
|
|
||||||
@@ -377,20 +368,26 @@ rr-ttl-min 60
|
|||||||
rr-ttl-max 28800
|
rr-ttl-max 28800
|
||||||
rr-ttl-reply-max 14400
|
rr-ttl-reply-max 14400
|
||||||
|
|
||||||
server 172.16.1.1 -group intranet -exclude-default-group
|
|
||||||
nameserver /internal/intranet
|
|
||||||
domain-rules /internal/ -speed-check-mode none -no-cache
|
|
||||||
|
|
||||||
server-tcp 180.184.1.1 -bootstrap-dns
|
server-tcp 180.184.1.1 -bootstrap-dns
|
||||||
server-tcp 114.114.114.114 -bootstrap-dns
|
server-tcp 101.226.4.6 -bootstrap-dns
|
||||||
server-tcp 2400:3200::1 -bootstrap-dns
|
server-tcp 2400:3200::1 -bootstrap-dns
|
||||||
|
server-tcp 2400:3200:baba::1 -bootstrap-dns
|
||||||
|
|
||||||
server-tls dot.pub
|
server-tls dot.pub
|
||||||
server-tls dns.alidns.com
|
server-tls dns.alidns.com
|
||||||
|
|
||||||
server-https https://doh.pub/dns-query
|
server-https https://doh.pub/dns-query
|
||||||
server-https https://dns.alidns.com/dns-query
|
server-https https://dns.alidns.com/dns-query
|
||||||
|
|
||||||
|
server-h3 h3://dns.alidns.com/dns-query -fallback
|
||||||
|
server-https https://doh.360.cn/dns-query -fallback
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`SmartDNS` 主配置文件配置完成后,执行以下命令修正文件权限
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 修正 SmartDNS 主配置文件权限
|
||||||
|
$ sudo chmod 0640 /etc/smartdns/smartdns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6.4.配置 Dnsmasq
|
### 6.4.配置 Dnsmasq
|
||||||
@@ -402,21 +399,19 @@ server-https https://dns.alidns.com/dns-query
|
|||||||
$ sudo mkdir -p /etc/dnsmasq.d
|
$ sudo mkdir -p /etc/dnsmasq.d
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `neovim` 编辑器创建 `Dnsmasq` 主配置文件,执行以下命令。
|
创建 `Dnsmasq` 主配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 Dnsmasq 主配置文件
|
## 创建 Dnsmasq 主配置文件
|
||||||
$ sudo nvim /etc/dnsmasq.d/10-server-dnsmasq.conf
|
$ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中输入以下内容,并保存。
|
在编辑器对话框中输入以下内容,并保存。
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
|
||||||
- 请根据系统内存使用情况,调整缓存参数 `cache-size`
|
- 请根据系统内存使用情况,调整缓存参数 `cache-size`
|
||||||
|
- 配置文件中监听的网卡名为 `eth0` ,请根据实际情况进行调整
|
||||||
- 配置文件中内网域名为 `fox.internal` ,请根据实际情况进行调整
|
- 配置文件中内网域名为 `fox.internal` ,请根据实际情况进行调整
|
||||||
|
|
||||||
- `Dnsmasq` 有且仅有 `SmartDNS` 作为上游 DNS 服务器
|
- `Dnsmasq` 有且仅有 `SmartDNS` 作为上游 DNS 服务器
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -425,9 +420,6 @@ $ sudo nvim /etc/dnsmasq.d/10-server-dnsmasq.conf
|
|||||||
|
|
||||||
# Main Config
|
# Main Config
|
||||||
|
|
||||||
conf-dir=/etc/dnsmasq.d/,*.conf
|
|
||||||
conf-file=/etc/dnsmasq.conf
|
|
||||||
|
|
||||||
log-facility=/var/log/dnsmasq.log
|
log-facility=/var/log/dnsmasq.log
|
||||||
log-async=20
|
log-async=20
|
||||||
|
|
||||||
@@ -436,40 +428,57 @@ max-cache-ttl=7200
|
|||||||
fast-dns-retry=1800
|
fast-dns-retry=1800
|
||||||
|
|
||||||
interface=eth0
|
interface=eth0
|
||||||
rebind-domain-ok=/fox.internal/
|
|
||||||
|
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
bogus-priv
|
bogus-priv
|
||||||
domain-needed
|
domain-needed
|
||||||
no-hosts
|
no-hosts
|
||||||
no-negcache
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
rebind-localhost-ok
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
|
rebind-domain-ok=/fox.internal/
|
||||||
|
|
||||||
# DNS Filter
|
# DNS Filter
|
||||||
|
|
||||||
server=/alt/
|
local=/alt/
|
||||||
server=/bind/
|
local=/bind/
|
||||||
server=/example/
|
local=/example/
|
||||||
server=/home.arpa/
|
local=/home.arpa/
|
||||||
server=/internal/
|
local=/internal/
|
||||||
server=/invalid/
|
local=/invalid/
|
||||||
server=/lan/
|
local=/lan/
|
||||||
server=/local/
|
local=/local/
|
||||||
server=/localhost/
|
local=/localhost/
|
||||||
server=/onion/
|
local=/onion/
|
||||||
server=/test/
|
local=/test/
|
||||||
|
|
||||||
# DNS Server
|
# DNS Server
|
||||||
|
|
||||||
server=/fox.internal/172.16.1.1
|
server=/fox.internal/172.16.1.1
|
||||||
|
|
||||||
server=127.0.0.1#6053
|
server=127.0.0.1#6053
|
||||||
server=::1#6053
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
至此,新虚拟机已配置完成,重启后即可作为内网 DNS 服务器使用。
|
## 7.清理系统
|
||||||
|
|
||||||
|
内网 DNS 服务器已部署配置完毕,正式投产前,可按需对系统进行清理优化。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 清理系统软件包
|
||||||
|
$ sudo bash -c 'apt clean && apt autoclean && apt autoremove --purge'
|
||||||
|
|
||||||
|
## 清理系统缓存
|
||||||
|
$ sudo bash -c 'find /var/cache/apt/ /var/lib/apt/lists/ /tmp/ -type f -print -delete'
|
||||||
|
|
||||||
|
## 清理 SmartDNS 缓存、持久化数据文件(WebUI 自定义密码存储于此文件)
|
||||||
|
$ sudo bash -c 'find /var/cache/smartdns/ /var/lib/smartdns/ -type f -print -delete'
|
||||||
|
|
||||||
|
## 清理系统日志
|
||||||
|
$ sudo bash -c 'find /var/log/ -type f -print -delete'
|
||||||
|
|
||||||
|
## 清理命令历史记录文件并关闭系统
|
||||||
|
$ rm -rvf ~/.bash_history ~/.zsh_history ~/.zcompdump* && history -c && sudo shutdown now
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
### 1.1.配置 SSH
|
### 1.1.配置 SSH
|
||||||
|
|
||||||
与配置内网 DNS 服务器时一样,首先需要调整系统的 SSH 登录权限参数。
|
与配置 Debian 模板虚拟机时一样,首先需要调整系统的 SSH 登录权限参数。
|
||||||
|
|
||||||
在虚拟机的命令行界面,使用 `vim` 编辑器编辑 `sshd` 服务的配置文件,执行以下命令。
|
在虚拟机的命令行界面,使用 `vim` 编辑器编辑 `sshd` 服务的配置文件,执行以下命令。
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
$ sudo vim /etc/ssh/sshd_config.d/10-server-sshd.conf
|
$ sudo vim /etc/ssh/sshd_config.d/10-server-sshd.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中输入以下内容,并保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## SSH 配置项
|
## SSH 配置项
|
||||||
@@ -52,36 +52,23 @@ $ sudo systemctl restart ssh.service
|
|||||||
|
|
||||||
### 1.2.配置软件源
|
### 1.2.配置软件源
|
||||||
|
|
||||||
使用终端工具登录 TS 服务器,常用终端工具请参阅 [01.PVE系统安装](./01.PVE系统安装.md) 。
|
使用如下命令对 `debian.sources` 配置文件进行修改。
|
||||||
|
|
||||||
首先需要对 Debian 系统软件源进行修改,这里使用 [USTC](https://mirrors.ustc.edu.cn) 镜像站作为演示。
|
|
||||||
|
|
||||||
当系统版本发生变化时,请参考 USTC 镜像站的官方说明 [USTC Mirror Help - Debian](https://mirrors.ustc.edu.cn/help/debian.html) 。
|
|
||||||
|
|
||||||
使用 `vim` 编辑器编辑 `debian.sources` 配置文件,执行以下命令。
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 debian.sources 配置文件
|
## 配置 Debian 系统默认软件源脚本
|
||||||
$ sudo vim /etc/apt/sources.list.d/debian.sources
|
$ sudo tee /etc/apt/sources.list.d/debian.sources >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 系统软件源配置项
|
|
||||||
|
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: https://mirrors.ustc.edu.cn/debian
|
URIs: https://mirrors.ustc.edu.cn/debian
|
||||||
Suites: bookworm bookworm-updates
|
Suites: trixie trixie-updates
|
||||||
Components: main contrib non-free non-free-firmware
|
Components: main contrib non-free non-free-firmware
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: https://mirrors.ustc.edu.cn/debian-security
|
URIs: https://mirrors.ustc.edu.cn/debian-security
|
||||||
Suites: bookworm-security
|
Suites: trixie-security
|
||||||
Components: main contrib non-free non-free-firmware
|
Components: main contrib non-free non-free-firmware
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
为了防止 `Cloud-Init` 服务意外修改软件源配置,需要添加文件保护,执行以下命令。
|
为了防止 `Cloud-Init` 服务意外修改软件源配置,需要添加文件保护,执行以下命令。
|
||||||
@@ -97,16 +84,6 @@ $ lsattr /etc/apt/sources.list.d/debian.sources
|
|||||||
----i---------e------- /etc/apt/sources.list.d/debian.sources
|
----i---------e------- /etc/apt/sources.list.d/debian.sources
|
||||||
```
|
```
|
||||||
|
|
||||||
进一步添加 TS 签名密钥以及软件源,执行以下命令。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 添加 TS 签名密钥
|
|
||||||
$ curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg > /dev/null
|
|
||||||
|
|
||||||
## 添加 TS 软件源
|
|
||||||
$ curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.3.安装软件
|
### 1.3.安装软件
|
||||||
|
|
||||||
软件源设置完成后,需要更新系统,执行以下命令。
|
软件源设置完成后,需要更新系统,执行以下命令。
|
||||||
@@ -126,16 +103,22 @@ $ sudo apt full-upgrade
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ sudo apt install qemu-guest-agent zsh git btop tmux logrotate cron nftables sshguard neovim
|
$ sudo apt install btop cronie curl git logrotate neovim qemu-guest-agent tmux zsh
|
||||||
|
|
||||||
## 安装系统自动更新工具
|
## 安装系统自动更新工具
|
||||||
$ sudo apt install unattended-upgrades powermgmt-base python3-gi
|
$ sudo apt install powermgmt-base unattended-upgrades
|
||||||
|
|
||||||
## 安装网络工具
|
## 安装网络工具
|
||||||
$ sudo apt install iperf iperf3 iftop lsof knot-dnsutils dnsmasq conntrack
|
$ sudo apt install conntrack dnsmasq ethtool knot-dnsutils lsof networkd-dispatcher nftables sshguard
|
||||||
|
|
||||||
## 安装 TS
|
## 安装 TS
|
||||||
$ sudo apt install tailscale
|
$ curl -fsSL https://tailscale.com/install.sh | sh
|
||||||
|
|
||||||
|
## 安装网络检测工具(可选)
|
||||||
|
$ sudo apt install iftop iperf iperf3
|
||||||
|
|
||||||
|
## 刷新 systemd 日志分类索引
|
||||||
|
$ sudo journalctl --update-catalog
|
||||||
|
|
||||||
## 写入磁盘
|
## 写入磁盘
|
||||||
$ sudo sync
|
$ sudo sync
|
||||||
@@ -146,10 +129,8 @@ $ sudo sync
|
|||||||
`Zsh` 是比 `Bash` 好用的 `Shell` 程序,使用 `oh-my-zsh` 进行配置。
|
`Zsh` 是比 `Bash` 好用的 `Shell` 程序,使用 `oh-my-zsh` 进行配置。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 使用清华大学镜像站安装 oh-my-zsh
|
## 安装 oh-my-zsh
|
||||||
$ cd && git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git
|
$ sh -c "$(curl -fsSL https://install.ohmyz.sh)"
|
||||||
|
|
||||||
$ cd ohmyzsh/tools && REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh install.sh
|
|
||||||
|
|
||||||
## 询问是否切换默认 shell,输入 Y
|
## 询问是否切换默认 shell,输入 Y
|
||||||
|
|
||||||
@@ -158,47 +139,69 @@ Time to change your default shell to zsh:
|
|||||||
Do you want to change your default shell to zsh? [Y/n] y
|
Do you want to change your default shell to zsh? [Y/n] y
|
||||||
|
|
||||||
## oh-my-zsh 安装后清理
|
## oh-my-zsh 安装后清理
|
||||||
$ cd && rm -rvf ohmyzsh .bash_history .zsh_history .shell.pre-oh-my-zsh
|
$ cd && rm -rvf .bash_history .zsh_history .shell.pre-oh-my-zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.5.调整内核模块
|
### 1.5.配置默认编辑器
|
||||||
|
|
||||||
使用 `neovim` 编辑器编辑 **内核模块** 配置文件,执行以下命令。
|
Debian 系统默认编辑器为 `nano` ,推荐将默认编辑器更换为 `neovim` ,执行以下命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 修改系统默认编辑器(选择 nvim 所在条目,即可将 neovim 设为默认编辑器)
|
||||||
|
$ sudo update-alternatives --config editor
|
||||||
|
|
||||||
|
#### 系统默认编辑器示例输出
|
||||||
|
There are 4 choices for the alternative editor (providing /usr/bin/editor).
|
||||||
|
|
||||||
|
Selection Path Priority Status
|
||||||
|
------------------------------------------------------------
|
||||||
|
* 0 /bin/nano 40 auto mode
|
||||||
|
1 /bin/nano 40 manual mode
|
||||||
|
2 /usr/bin/nvim 30 manual mode
|
||||||
|
3 /usr/bin/vim.basic 30 manual mode
|
||||||
|
4 /usr/bin/vim.tiny 15 manual mode
|
||||||
|
|
||||||
|
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 install -D -m 0644 /dev/stdin /etc/xdg/nvim/sysinit.vim <<'EOF'
|
||||||
|
set mouse=
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.6.调整内核模块
|
||||||
|
|
||||||
|
编辑 **内核模块** 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 内核模块 配置文件
|
## 创建 内核模块 配置文件
|
||||||
$ sudo nvim /etc/modules-load.d/10-server-modules.conf
|
$ sudo tee /etc/modules-load.d/10-server-modules.conf >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
# Optimize netfilter related modules at system boot.
|
# Optimize netfilter related modules at system boot.
|
||||||
|
|
||||||
nf_conntrack
|
nf_conntrack
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.6.调整内核参数
|
### 1.7.调整内核参数
|
||||||
|
|
||||||
使用 `neovim` 编辑器编辑 **内核参数** 配置文件,执行以下命令。
|
编辑 **内核参数** 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 内核参数 配置文件
|
## 编辑 内核参数 配置文件
|
||||||
$ sudo nvim /etc/sysctl.d/99-sysctl.conf
|
$ sudo tee /etc/sysctl.d/99-sysctl.conf >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件末尾输入以下配置项,注意配置中间的空格。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
# Optimize sysctl parameters for local TS server.
|
# Optimize sysctl parameters for local TS server.
|
||||||
|
|
||||||
kernel.panic = 20
|
kernel.panic = 20
|
||||||
kernel.panic_on_oops = 1
|
kernel.panic_on_oops = 1
|
||||||
|
|
||||||
net.core.default_qdisc = fq_codel
|
net.core.default_qdisc = fq_pie
|
||||||
net.ipv4.tcp_congestion_control = bbr
|
net.ipv4.tcp_congestion_control = bbr
|
||||||
|
|
||||||
net.ipv4.ip_forward = 1
|
net.ipv4.ip_forward = 1
|
||||||
@@ -208,13 +211,13 @@ net.ipv6.conf.default.forwarding = 1
|
|||||||
|
|
||||||
# Other adjustable system parameters
|
# Other adjustable system parameters
|
||||||
|
|
||||||
net.core.netdev_budget = 600
|
net.core.netdev_budget = 800
|
||||||
net.core.netdev_budget_usecs = 20000
|
net.core.netdev_max_backlog = 8192
|
||||||
|
|
||||||
net.core.rps_sock_flow_entries = 32768
|
net.core.rmem_default = 262144
|
||||||
net.core.somaxconn = 8192
|
net.core.wmem_default = 262144
|
||||||
net.core.rmem_max = 26214400
|
net.core.rmem_max = 67108864
|
||||||
net.core.wmem_max = 655360
|
net.core.wmem_max = 67108864
|
||||||
|
|
||||||
net.ipv4.conf.all.accept_redirects = 0
|
net.ipv4.conf.all.accept_redirects = 0
|
||||||
net.ipv4.conf.default.accept_redirects = 0
|
net.ipv4.conf.default.accept_redirects = 0
|
||||||
@@ -233,19 +236,13 @@ net.ipv4.conf.default.send_redirects = 0
|
|||||||
|
|
||||||
net.ipv4.igmp_max_memberships = 256
|
net.ipv4.igmp_max_memberships = 256
|
||||||
|
|
||||||
net.ipv4.route.error_burst = 500
|
|
||||||
net.ipv4.route.error_cost = 100
|
|
||||||
|
|
||||||
net.ipv4.route.redirect_load = 2
|
|
||||||
net.ipv4.route.redirect_silence = 2048
|
|
||||||
|
|
||||||
net.ipv4.tcp_challenge_ack_limit = 1000
|
|
||||||
net.ipv4.tcp_fastopen = 3
|
net.ipv4.tcp_fastopen = 3
|
||||||
net.ipv4.tcp_fin_timeout = 30
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
net.ipv4.tcp_keepalive_time = 120
|
net.ipv4.tcp_keepalive_time = 600
|
||||||
|
net.ipv4.tcp_max_syn_backlog = 4096
|
||||||
net.ipv4.tcp_notsent_lowat = 131072
|
net.ipv4.tcp_notsent_lowat = 131072
|
||||||
net.ipv4.tcp_rmem = 4096 87380 26214400
|
net.ipv4.tcp_rmem = 4096 1048576 67108864
|
||||||
net.ipv4.tcp_wmem = 4096 16384 655360
|
net.ipv4.tcp_wmem = 4096 1048576 67108864
|
||||||
|
|
||||||
net.ipv6.conf.all.accept_redirects = 0
|
net.ipv6.conf.all.accept_redirects = 0
|
||||||
net.ipv6.conf.default.accept_redirects = 0
|
net.ipv6.conf.default.accept_redirects = 0
|
||||||
@@ -257,19 +254,19 @@ net.ipv6.conf.all.use_tempaddr = 0
|
|||||||
net.ipv6.conf.default.use_tempaddr = 0
|
net.ipv6.conf.default.use_tempaddr = 0
|
||||||
|
|
||||||
net.netfilter.nf_conntrack_acct = 1
|
net.netfilter.nf_conntrack_acct = 1
|
||||||
net.netfilter.nf_conntrack_checksum = 0
|
net.netfilter.nf_conntrack_checksum = 1
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_established = 7440
|
net.netfilter.nf_conntrack_tcp_timeout_established = 7440
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
保存该配置文件后,重启系统或者执行以下命令让配置生效。
|
配置文件编辑完成后,重启系统或者执行以下命令让配置生效。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 让内核参数生效
|
## 让内核参数生效
|
||||||
$ sudo sysctl -f
|
$ sudo sysctl --system
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.7.调整系统时间
|
### 1.8.调整系统时间
|
||||||
|
|
||||||
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
||||||
|
|
||||||
@@ -290,21 +287,16 @@ Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需
|
|||||||
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
||||||
|
|
||||||
## 创建 NTP 配置文件
|
## 创建 NTP 配置文件
|
||||||
$ sudo nvim /etc/systemd/timesyncd.conf.d/10-server-ntp.conf
|
$ sudo tee /etc/systemd/timesyncd.conf.d/10-server-ntp.conf >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
# Optimize system NTP server.
|
# Optimize system NTP server.
|
||||||
|
|
||||||
[Time]
|
[Time]
|
||||||
NTP=ntp.aliyun.com ntp.tencent.com cn.pool.ntp.org
|
NTP=ntp.aliyun.com ntp.tencent.com cn.pool.ntp.org
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
保存该配置文件后,需重启 `systemd-timesyncd.service` 服务,并再次检查系统 NTP 服务器地址。
|
配置文件编辑完成后,需重启 `systemd-timesyncd.service` 服务,并再次检查系统 NTP 服务器地址。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 重启 systemd-timesyncd.service
|
## 重启 systemd-timesyncd.service
|
||||||
@@ -314,7 +306,7 @@ $ sudo systemctl restart systemd-timesyncd.service
|
|||||||
$ sudo systemctl status systemd-timesyncd.service
|
$ sudo systemctl status systemd-timesyncd.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.8.配置自动更新
|
### 1.9.配置自动更新
|
||||||
|
|
||||||
配置系统自动更新策略,执行以下命令,使用键盘 `左右方向键` 进行选择,`回车键` 进行确认。
|
配置系统自动更新策略,执行以下命令,使用键盘 `左右方向键` 进行选择,`回车键` 进行确认。
|
||||||
|
|
||||||
@@ -326,36 +318,27 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
|||||||
<Yes>
|
<Yes>
|
||||||
```
|
```
|
||||||
|
|
||||||
进一步调整 `20auto-upgrades` 配置文件。
|
开始调整 `20auto-upgrades` 配置文件。
|
||||||
|
|
||||||
|
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`5` 表示更新周期为 `5` 天。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 20auto-upgrades 配置文件
|
## 编辑 20auto-upgrades 配置文件
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/20auto-upgrades
|
$ sudo tee /etc/apt/apt.conf.d/20auto-upgrades >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
|
||||||
|
|
||||||
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`7` 表示更新周期为 `7` 天。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 系统更新周期配置项
|
|
||||||
|
|
||||||
APT::Periodic::Update-Package-Lists "1";
|
APT::Periodic::Update-Package-Lists "1";
|
||||||
APT::Periodic::Unattended-Upgrade "7";
|
APT::Periodic::Unattended-Upgrade "5";
|
||||||
APT::Periodic::AutocleanInterval "1";
|
APT::Periodic::AutocleanInterval "1";
|
||||||
APT::Periodic::CleanInterval "1";
|
APT::Periodic::CleanInterval "1";
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
进一步调整 `50unattended-upgrades` 配置文件。
|
进一步调整 `50unattended-upgrades` 配置文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 50unattended-upgrades 配置文件
|
## 编辑 50unattended-upgrades 配置文件
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
$ sudo editor /etc/apt/apt.conf.d/50unattended-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
根据 “注释” 中相关说明,调整配置文件。
|
|
||||||
|
|
||||||
因为该配置文件很长,完整的配置文件可查看 [debian_ts_50unattended_upgrades.conf](./src/debian/debian_ts_50unattended_upgrades.conf) 以便对比。
|
因为该配置文件很长,完整的配置文件可查看 [debian_ts_50unattended_upgrades.conf](./src/debian/debian_ts_50unattended_upgrades.conf) 以便对比。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -367,7 +350,7 @@ $ sudo nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
|||||||
|
|
||||||
"origin=Tailscale,codename=${distro_codename},label=Tailscale";
|
"origin=Tailscale,codename=${distro_codename},label=Tailscale";
|
||||||
|
|
||||||
## 在配置文件末尾增加以下配置项,代表启用,并调整参数
|
## 在配置文件末尾增加以下内容,代表启用,并调整参数
|
||||||
|
|
||||||
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||||
|
|
||||||
@@ -383,14 +366,14 @@ Unattended-Upgrade::Automatic-Reboot-Time "13:00";
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
系统自动更新配置文件修改完成后,需要重设自动更新定时器,执行以下命令。
|
系统自动更新配置文件修改完成后,需调整自动更新定时器,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 配置系统定时器
|
## 配置系统定时器
|
||||||
$ sudo systemctl edit apt-daily-upgrade.timer
|
$ sudo systemctl edit apt-daily-upgrade.timer
|
||||||
```
|
```
|
||||||
|
|
||||||
根据配置文件中的提示,在中间空白处填入以下配置项。
|
根据配置文件中的提示,在中间空白处填入以下内容。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 定时器配置项
|
## 定时器配置项
|
||||||
@@ -404,7 +387,7 @@ RandomizedDelaySec=0
|
|||||||
|
|
||||||
设置完成后,重启自动更新定时器并检查其状态,执行以下命令。
|
设置完成后,重启自动更新定时器并检查其状态,执行以下命令。
|
||||||
|
|
||||||
在输出结果中,看到系统自动更新的触发时间为 `02:00` 则表示设置正确。
|
在输出结果中,看到系统自动更新的触发时间为 `12:00` 则表示设置正确。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 重启触发器
|
## 重启触发器
|
||||||
@@ -414,7 +397,7 @@ $ sudo systemctl restart apt-daily-upgrade.timer
|
|||||||
$ sudo systemctl status apt-daily-upgrade.timer
|
$ sudo systemctl status apt-daily-upgrade.timer
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.9.配置防火墙
|
### 1.10.配置防火墙
|
||||||
|
|
||||||
修改防火墙配置之前,需检查 `nftables.service` 服务状态,确保该服务开机自启。
|
修改防火墙配置之前,需检查 `nftables.service` 服务状态,确保该服务开机自启。
|
||||||
|
|
||||||
@@ -426,26 +409,24 @@ $ sudo systemctl status nftables.service
|
|||||||
$ sudo systemctl enable nftables.service
|
$ sudo systemctl enable nftables.service
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `neovim` 编辑器修改 `nftables` 配置文件,执行以下命令。
|
由于防火墙规则内容较多,请打开文件 [debian_ts_nftables.conf](./src/debian/debian_ts_nftables.conf) ,复制全文内容,完整替换 `nftables` 配置文件中的现有配置。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 备份 nftables 配置文件
|
## 编辑 nftables 配置文件
|
||||||
$ sudo mv /etc/nftables.conf /etc/nftables.conf.bak
|
$ sudo editor /etc/nftables.conf
|
||||||
|
|
||||||
## 创建新的 nftables 配置文件
|
|
||||||
$ sudo nvim /etc/nftables.conf
|
|
||||||
```
|
```
|
||||||
|
|
||||||
由于防火墙配置文件很长,因此请查阅文件 [debian_ts_nftables.conf](./src/debian/debian_ts_nftables.conf) 进行复制。
|
配置完成后,先检查防火墙规则,再重启 `nftables.service` 服务。
|
||||||
|
|
||||||
配置完成后,需重启 `nftables.service` 服务。
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
## 检查 nftables 配置文件
|
||||||
|
$ sudo nft --check --file /etc/nftables.conf
|
||||||
|
|
||||||
## 重启 nftables.service
|
## 重启 nftables.service
|
||||||
$ sudo systemctl restart nftables.service
|
$ sudo systemctl restart nftables.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.10.调整系统端口
|
### 1.11.调整系统端口
|
||||||
|
|
||||||
为了正常使用 `53` 端口,需要对 `systemd-resolved.service` 进行配置,执行以下命令。
|
为了正常使用 `53` 端口,需要对 `systemd-resolved.service` 进行配置,执行以下命令。
|
||||||
|
|
||||||
@@ -454,12 +435,7 @@ $ sudo systemctl restart nftables.service
|
|||||||
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
||||||
|
|
||||||
## 创建 systemd-resolved 配置文件
|
## 创建 systemd-resolved 配置文件
|
||||||
$ sudo nvim /etc/systemd/resolved.conf.d/10-server-dns.conf
|
$ sudo tee /etc/systemd/resolved.conf.d/10-server-dns.conf >/dev/null <<'EOF'
|
||||||
```
|
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
# Optimize system resolve parameters for local TS server.
|
# Optimize system resolve parameters for local TS server.
|
||||||
|
|
||||||
@@ -467,14 +443,14 @@ $ sudo nvim /etc/systemd/resolved.conf.d/10-server-dns.conf
|
|||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
DNS=::1
|
DNS=::1
|
||||||
DNSStubListener=no
|
DNSStubListener=no
|
||||||
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
保存该配置文件后,还需调整系统 `resolv.conf` 配置文件,执行以下命令。
|
配置文件编辑完成后,还需调整系统 `resolv.conf` 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 resolv.conf 软链接
|
## 创建 resolv.conf 软链接
|
||||||
$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
配置完成后,需重启 `systemd-resolved.service` 服务。
|
配置完成后,需重启 `systemd-resolved.service` 服务。
|
||||||
@@ -484,7 +460,7 @@ $ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
|||||||
$ sudo systemctl restart systemd-resolved.service
|
$ sudo systemctl restart systemd-resolved.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.11.配置 Dnsmasq
|
### 1.12.配置 Dnsmasq
|
||||||
|
|
||||||
检查 `dnsmasq.service` 服务状态,确保该服务开机自启。
|
检查 `dnsmasq.service` 服务状态,确保该服务开机自启。
|
||||||
|
|
||||||
@@ -503,21 +479,19 @@ $ sudo systemctl enable dnsmasq.service
|
|||||||
$ sudo mkdir -p /etc/dnsmasq.d
|
$ sudo mkdir -p /etc/dnsmasq.d
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `neovim` 编辑器创建 `Dnsmasq` 主配置文件,执行以下命令。
|
创建 `Dnsmasq` 主配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 Dnsmasq 主配置文件
|
## 创建 Dnsmasq 主配置文件
|
||||||
$ sudo nvim /etc/dnsmasq.d/10-server-dnsmasq.conf
|
$ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中输入以下内容,并保存。
|
在编辑器对话框中输入以下内容,并保存。
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
|
||||||
- 请根据系统内存使用情况,调整缓存参数 `cache-size`
|
- 请根据系统内存使用情况,调整缓存参数 `cache-size`
|
||||||
|
- 配置文件中监听的网卡名为 `eth0` 和 `tailscale0` ,请根据实际情况进行调整
|
||||||
- 配置文件中内网域名为 `fox.internal` ,请根据实际情况进行调整
|
- 配置文件中内网域名为 `fox.internal` ,请根据实际情况进行调整
|
||||||
|
|
||||||
- `Dnsmasq` 上游 DNS 服务器分为三类,请根据实际情况进行调整
|
- `Dnsmasq` 上游 DNS 服务器分为三类,请根据实际情况进行调整
|
||||||
- `server=/ts.net/100.100.100.100` :TS 服务 `MagicDNS` 专用 DNS 服务器
|
- `server=/ts.net/100.100.100.100` :TS 服务 `MagicDNS` 专用 DNS 服务器
|
||||||
- `server=/fox.internal/172.16.1.1` :内网域名解析 DNS 服务器,通常为主路由地址
|
- `server=/fox.internal/172.16.1.1` :内网域名解析 DNS 服务器,通常为主路由地址
|
||||||
@@ -529,9 +503,6 @@ $ sudo nvim /etc/dnsmasq.d/10-server-dnsmasq.conf
|
|||||||
|
|
||||||
# Main Config
|
# Main Config
|
||||||
|
|
||||||
conf-dir=/etc/dnsmasq.d/,*.conf
|
|
||||||
conf-file=/etc/dnsmasq.conf
|
|
||||||
|
|
||||||
log-facility=/var/log/dnsmasq.log
|
log-facility=/var/log/dnsmasq.log
|
||||||
log-async=20
|
log-async=20
|
||||||
|
|
||||||
@@ -539,39 +510,37 @@ cache-size=2048
|
|||||||
max-cache-ttl=7200
|
max-cache-ttl=7200
|
||||||
fast-dns-retry=1800
|
fast-dns-retry=1800
|
||||||
|
|
||||||
interface=eth0
|
interface=eth0,tailscale0
|
||||||
rebind-domain-ok=/fox.internal/
|
|
||||||
|
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
bogus-priv
|
bogus-priv
|
||||||
domain-needed
|
domain-needed
|
||||||
no-hosts
|
no-hosts
|
||||||
no-negcache
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
rebind-localhost-ok
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
|
rebind-domain-ok=/fox.internal/
|
||||||
|
|
||||||
# DNS Filter
|
# DNS Filter
|
||||||
|
|
||||||
server=/alt/
|
local=/alt/
|
||||||
server=/bind/
|
local=/bind/
|
||||||
server=/example/
|
local=/example/
|
||||||
server=/home.arpa/
|
local=/home.arpa/
|
||||||
server=/internal/
|
local=/internal/
|
||||||
server=/invalid/
|
local=/invalid/
|
||||||
server=/lan/
|
local=/lan/
|
||||||
server=/local/
|
local=/local/
|
||||||
server=/localhost/
|
local=/localhost/
|
||||||
server=/onion/
|
local=/onion/
|
||||||
server=/test/
|
local=/test/
|
||||||
|
|
||||||
# DNS Server
|
# DNS Server
|
||||||
|
|
||||||
server=/ts.net/100.100.100.100
|
server=/ts.net/100.100.100.100
|
||||||
|
|
||||||
server=/fox.internal/172.16.1.1
|
server=/fox.internal/172.16.1.1
|
||||||
|
|
||||||
server=172.16.1.1
|
server=172.16.1.1
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -587,7 +556,149 @@ $ sudo systemctl restart dnsmasq.service
|
|||||||
|
|
||||||
根据不同的启动参数,TS 服务将具有不同的业务能力。
|
根据不同的启动参数,TS 服务将具有不同的业务能力。
|
||||||
|
|
||||||
### 2.1.启动模式
|
### 2.1.网卡调优
|
||||||
|
|
||||||
|
根据 TS 官方文档 [Performance best practices](https://tailscale.com/docs/reference/best-practices/performance) 的技术指引,Linux 转发节点可通过调整网卡 Offload 参数提升 UDP 性能。
|
||||||
|
|
||||||
|
为了在网卡重新上线后自动恢复参数,本文使用 `networkd-dispatcher` 监听 `routable` 状态。
|
||||||
|
|
||||||
|
优化脚本直接使用事件中的 `IFACE`,仅处理由 `systemd-networkd` 配置的底层网卡,并跳过 `tailscale0` 和其他 TUN 设备。
|
||||||
|
|
||||||
|
首先检查 TS 服务器的底层出口网卡。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 检查 systemd-networkd 状态
|
||||||
|
$ systemctl is-active systemd-networkd
|
||||||
|
|
||||||
|
## 获取由 networkd 配置且已上线的以太网卡
|
||||||
|
$ NETDEV=$(networkctl list --no-legend --no-pager | awk '$3 == "ether" && $4 == "routable" && $5 == "configured" {print $2; exit}')
|
||||||
|
|
||||||
|
## 检查网卡管理状态
|
||||||
|
$ networkctl status "$NETDEV"
|
||||||
|
```
|
||||||
|
|
||||||
|
`systemd-networkd` 应显示为 `active`,底层出口网卡应显示为 `State: routable (configured)`。
|
||||||
|
|
||||||
|
检查完成后,创建 `networkd-dispatcher` 的 `routable` 事件脚本。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 创建 routable 事件脚本目录
|
||||||
|
$ sudo install -d -o root -g root -m 0755 /etc/networkd-dispatcher/routable.d
|
||||||
|
|
||||||
|
## 创建 TS 网卡优化脚本
|
||||||
|
$ sudo editor /etc/networkd-dispatcher/routable.d/50-tailscale
|
||||||
|
```
|
||||||
|
|
||||||
|
在脚本文件中输入以下内容,并保存。
|
||||||
|
|
||||||
|
**额外说明:**
|
||||||
|
- 脚本会记录跳过、成功或失败原因,并在执行失败时保留 `ethtool` 的原始退出状态
|
||||||
|
- `networkd-dispatcher` 会记录非零退出警告,但不会停止服务或立即重试
|
||||||
|
- 网卡再次进入 `routable` 状态时,脚本会重新执行
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# This script is customized by fox,
|
||||||
|
# Optimize NIC offload parameters for local TS server.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -z "${IFACE:-}" ]; then
|
||||||
|
echo "Error: IFACE is not set." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${AdministrativeState:-}" ]; then
|
||||||
|
echo "Error: AdministrativeState is not set for $IFACE." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$AdministrativeState" != "configured" ]; then
|
||||||
|
echo "Skipping network device $IFACE: administrative state is $AdministrativeState."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "/sys/class/net/$IFACE/device" ]; then
|
||||||
|
echo "Skipping network device $IFACE: no hardware device is associated."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
ETHTOOL_PATH=$(command -v ethtool 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -z "$ETHTOOL_PATH" ]; then
|
||||||
|
echo "Error: ethtool command not found in PATH. Please install ethtool." >&2
|
||||||
|
exit 127
|
||||||
|
fi
|
||||||
|
|
||||||
|
if "$ETHTOOL_PATH" -K "$IFACE" rx-udp-gro-forwarding on rx-gro-list off; then
|
||||||
|
echo "Configured network device $IFACE using $ETHTOOL_PATH successfully."
|
||||||
|
else
|
||||||
|
exit_status=$?
|
||||||
|
echo "Error: $ETHTOOL_PATH failed to configure network device $IFACE (exit status $exit_status)." >&2
|
||||||
|
exit "$exit_status"
|
||||||
|
fi
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`networkd-dispatcher` 仅执行属于 `root` 且具有可执行权限的脚本,执行以下命令进行设置。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 设置脚本所有者
|
||||||
|
$ sudo chown root:root /etc/networkd-dispatcher/routable.d/50-tailscale
|
||||||
|
|
||||||
|
## 设置脚本可执行权限
|
||||||
|
$ sudo chmod 0755 /etc/networkd-dispatcher/routable.d/50-tailscale
|
||||||
|
|
||||||
|
## 设置脚本文件防篡改
|
||||||
|
$ sudo chattr +i /etc/networkd-dispatcher/routable.d/50-tailscale
|
||||||
|
```
|
||||||
|
|
||||||
|
设置完成后,手动模拟网卡事件,检查脚本能否正常应用参数。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 测试 TS 网卡优化脚本
|
||||||
|
$ sudo env IFACE="$NETDEV" AdministrativeState=configured /etc/networkd-dispatcher/routable.d/50-tailscale
|
||||||
|
```
|
||||||
|
|
||||||
|
由于 TS 虚拟机不包含无线网卡,可通过 `systemd` 日志过滤器忽略无线工具探测信息。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 编辑 networkd-dispatcher.service 服务扩展配置
|
||||||
|
$ sudo systemctl edit networkd-dispatcher.service
|
||||||
|
```
|
||||||
|
|
||||||
|
根据配置文件中的提示,在中间空白处填入以下内容。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 日志过滤配置项
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
LogFilterPatterns=~^No valid path found for iw(config)?$
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
测试通过后,启动 `networkd-dispatcher` 并设置为开机自启状态。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 设置 networkd-dispatcher 开机自启
|
||||||
|
$ sudo systemctl enable --now networkd-dispatcher.service
|
||||||
|
|
||||||
|
## 验证启动状态事件补发机制
|
||||||
|
$ sudo systemctl restart networkd-dispatcher.service
|
||||||
|
```
|
||||||
|
|
||||||
|
最后检查网卡优化参数。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 检查网卡优化参数
|
||||||
|
$ sudo ethtool -k "$NETDEV" | grep -E 'rx-udp-gro-forwarding|rx-gro-list'
|
||||||
|
|
||||||
|
#### 网卡优化后 ethtool 示例输出
|
||||||
|
rx-gro-list: off
|
||||||
|
rx-udp-gro-forwarding: on
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2.2.启动模式
|
||||||
|
|
||||||
若仅需 TS 组网功能,执行以下命令。
|
若仅需 TS 组网功能,执行以下命令。
|
||||||
|
|
||||||
@@ -609,7 +720,6 @@ $ sudo tailscale up --advertise-exit-node --accept-dns=false --reset
|
|||||||
若需 TS 提供内网路由功能并能访问内网私有服务,执行以下命令。
|
若需 TS 提供内网路由功能并能访问内网私有服务,执行以下命令。
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
|
||||||
- 请根据内网网段,调整 TS 内网路由参数 `advertise-routes`
|
- 请根据内网网段,调整 TS 内网路由参数 `advertise-routes`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -619,7 +729,7 @@ $ sudo tailscale up --advertise-exit-node --accept-routes --advertise-routes=172
|
|||||||
|
|
||||||
执行命令后,TS 将自动显示登录链接,只需根据链接进行登录操作即可。
|
执行命令后,TS 将自动显示登录链接,只需根据链接进行登录操作即可。
|
||||||
|
|
||||||
### 2.2.自动更新
|
### 2.3.自动更新
|
||||||
|
|
||||||
目前 TS 将跟随系统自动更新,若需额外开启 TS 的自动更新功能,执行以下命令。
|
目前 TS 将跟随系统自动更新,若需额外开启 TS 的自动更新功能,执行以下命令。
|
||||||
|
|
||||||
@@ -631,22 +741,18 @@ $ sudo tailscale set --auto-update
|
|||||||
$ sudo tailscale set --auto-update=false
|
$ sudo tailscale set --auto-update=false
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2.3.定时任务
|
### 2.4.定时任务
|
||||||
|
|
||||||
本步骤为可选操作,主要用于设置 TS 定时重启。
|
本步骤为可选操作,主要用于设置 TS 定时重启。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑系统定时任务,编辑器选择 nano
|
## 创建 Tailscale 定时重启任务
|
||||||
$ sudo crontab -e
|
$ sudo tee /etc/cron.d/tailscale-restart >/dev/null <<'EOF'
|
||||||
```
|
30 10 * * * root /usr/bin/systemctl restart tailscaled.service
|
||||||
|
EOF
|
||||||
在配置文件末尾,增加以下配置项。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 定时任务配置项
|
|
||||||
|
|
||||||
30 10 * * * /usr/bin/systemctl restart tailscaled.service
|
|
||||||
|
|
||||||
|
## 设置定时任务文件权限
|
||||||
|
$ sudo chmod 0644 /etc/cron.d/tailscale-restart
|
||||||
```
|
```
|
||||||
|
|
||||||
至此,TS 服务器已配置完成。
|
至此,TS 服务器已配置完成。
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
在所有虚拟机创建并配置完成后,可以使用 PVE 自带的备份功能周期性的将虚拟机备份。
|
在所有虚拟机创建并配置完成后,可以使用 PVE 自带的备份功能周期性的将虚拟机备份。
|
||||||
|
|
||||||
点击 PVE 的 `数据中心` ,在右侧菜单中选择 `备份` 功能。
|
点击 PVE 的 `数据中心` ,在右侧菜单中选择 `备份` 功能,并点击顶部 `添加` 。
|
||||||
|
|
||||||
点击顶部 `添加` 按钮,添加一个 `备份作业` 。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.1.常规选项
|
### 1.1.常规
|
||||||
|
|
||||||
在弹出的 `创建:备份作业` 对话框中,勾选底部 `高级` 选项,`备份作业` 的各项参数如下。
|
在弹出的 `创建:备份作业` 对话框中,勾选底部 `高级` 选项,`备份作业` 的各项参数如下。
|
||||||
|
|
||||||
@@ -17,46 +15,47 @@
|
|||||||
|节点|`node01`|选择当前 PVE 服务器节点|
|
|节点|`node01`|选择当前 PVE 服务器节点|
|
||||||
|存储|`local`|选择存放备份文件的路径|
|
|存储|`local`|选择存放备份文件的路径|
|
||||||
|计划|`*-01,16 03:30`|`备份作业` 执行的时间计划|
|
|计划|`*-01,16 03:30`|`备份作业` 执行的时间计划|
|
||||||
|选择模式|`包括选中的VMs`|执行备份的虚拟机对象|
|
|选择模式|`包括选中的虚拟机`|执行备份的虚拟机对象|
|
||||||
|通知模式|`默认(自动)`|执行备份时的通知模式,保持默认即可|
|
|
||||||
|发送邮箱至|`your_email@domain.com`|`备份作业` 邮件的收件人邮箱|
|
|
||||||
|发送邮件|`总是`|发送 `备份作业` 邮件提醒的条件|
|
|
||||||
|压缩|`ZSTD`|选择备份文件的压缩算法|
|
|压缩|`ZSTD`|选择备份文件的压缩算法|
|
||||||
|模式|`停止`|选择备份虚拟机的方式,推荐使用 `停止` |
|
|模式|`停止`|选择备份虚拟机的方式,推荐使用 `停止` |
|
||||||
|启用|**勾选**|表示该 `备份作业` 为启用状态|
|
|启用|**勾选**|表示该 `备份作业` 为启用状态|
|
||||||
|作业评论|`Backup Your Server :)`|`备份作业` 的备注信息,使用英文输入|
|
|作业评论|`Backup Your Server :)`|`备份作业` 的备注信息,使用英文输入|
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
- 计划中的 `*-01,16 03:30` 表示每月 `1` 、`16` 号的 `03:30` 执行备份任务
|
||||||
1. 计划中的 `*-01,16 03:30` 表示每月 `1` 、`16` 号的 `03:30` 执行备份任务。
|
- `备份作业` 在正确配置收件人邮箱之前,并不能发出邮件
|
||||||
|
- `停止` 模式表示备份时会将虚拟机置于关机状态,备份完成后再恢复至之前的状态
|
||||||
2. `备份作业` 在正确配置收件人邮箱之前,并不能发出邮件。
|
- 虚拟机列表中,勾选 `备份作业` 需要备份的虚拟机(可多选)
|
||||||
|
|
||||||
3. `停止` 模式表示备份时会将虚拟机置于关机状态,备份完成后再恢复至之前的状态。
|
|
||||||
|
|
||||||
4. 虚拟机列表中,勾选 `备份作业` 需要备份的虚拟机(可多选)。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.2.保留选项
|
### 1.2.通知
|
||||||
|
|
||||||
|
|参数|值|说明|
|
||||||
|
|--|--|--|
|
||||||
|
|通知模式|`使用全局通知设置`|执行备份时的通知模式,保持默认即可|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 1.3.保留
|
||||||
|
|
||||||
该选项将控制备份文件的保留个数,选择保留最近 `3` 份备份文件。
|
该选项将控制备份文件的保留个数,选择保留最近 `3` 份备份文件。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.3.备注模板
|
### 1.4.备注模板
|
||||||
|
|
||||||
该选项将按照设置的内容,自动重命名备份文件。
|
该选项将按照设置的内容,自动重命名备份文件。
|
||||||
|
|
||||||
在 `备份日志` 右侧文本框中输入 `{{vmid}}_{{guestname}}_Auto_Backup` 。
|
在 `备份日志` 右侧文本框中输入 `{{vmid}}-{{guestname}}-Autobackup` 。
|
||||||
|
|
||||||
点击 `创建` 按钮,`备份作业` 创建完成。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.4.高级选项
|
### 1.5.高级
|
||||||
|
|
||||||
该选项提供 `备份作业` 进行时的高级可调参数,仅需勾选 `重复错过` 选项即可。
|
该选项提供 `备份作业` 执行时的高级可调参数,仅需勾选 `重复错过` 选项即可。
|
||||||
|
|
||||||
|
点击 `创建` ,此 `备份作业` 即完成设置与创建。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -68,7 +67,7 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
`计划` 处将显示 `备份作业` 的执行时间参数,点击 `模拟` 按钮,在右侧将显示模拟的时间结果。
|
`计划` 处将显示 `备份作业` 的执行时间参数,点击 `模拟` ,在右侧将显示模拟的时间结果。
|
||||||
|
|
||||||
确认 `备份作业` 的执行时间周期是否符合预期。
|
确认 `备份作业` 的执行时间周期是否符合预期。
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,7 @@
|
|||||||
## 介绍
|
## 介绍
|
||||||
PVE 虚拟化平台的安装以及折腾手记。
|
PVE 虚拟化平台的安装以及折腾手记。
|
||||||
|
|
||||||
- PVE ISO 版本:8.3-1 (更新时间: 2024-11-21)
|
- PVE ISO 版本:9.1-1 (更新时间: 2025-11-19)
|
||||||
|
|
||||||
- 演示机:
|
|
||||||
- CPU:N6005
|
|
||||||
- 内存:16GB DDR4
|
|
||||||
- 网卡:I226-V
|
|
||||||
- 硬盘:500GB NVMe
|
|
||||||
|
|
||||||
- PVE 网络:
|
- PVE 网络:
|
||||||
- IPv4 网络
|
- IPv4 网络
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 293 KiB |
|
After Width: | Height: | Size: 544 KiB |
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 308 KiB |
|
After Width: | Height: | Size: 594 KiB |
|
Before Width: | Height: | Size: 455 KiB |
|
After Width: | Height: | Size: 828 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 303 KiB |
|
After Width: | Height: | Size: 588 KiB |
|
Before Width: | Height: | Size: 318 KiB |
|
After Width: | Height: | Size: 508 KiB |
|
Before Width: | Height: | Size: 269 KiB |
|
After Width: | Height: | Size: 463 KiB |
|
Before Width: | Height: | Size: 203 KiB |
|
After Width: | Height: | Size: 373 KiB |
|
Before Width: | Height: | Size: 303 KiB |
|
After Width: | Height: | Size: 580 KiB |
|
Before Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 331 KiB |
|
After Width: | Height: | Size: 586 KiB |
|
Before Width: | Height: | Size: 281 KiB |
|
After Width: | Height: | Size: 470 KiB |
|
Before Width: | Height: | Size: 370 KiB After Width: | Height: | Size: 375 KiB |
|
Before Width: | Height: | Size: 429 KiB After Width: | Height: | Size: 403 KiB |
|
Before Width: | Height: | Size: 375 KiB After Width: | Height: | Size: 404 KiB |
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 165 KiB After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 244 KiB |
|
After Width: | Height: | Size: 495 KiB |
|
Before Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 499 KiB After Width: | Height: | Size: 664 KiB |
|
Before Width: | Height: | Size: 196 KiB |
|
After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 223 KiB |
|
After Width: | Height: | Size: 205 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 315 KiB |
|
Before Width: | Height: | Size: 184 KiB |
|
After Width: | Height: | Size: 232 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 170 KiB |
|
Before Width: | Height: | Size: 205 KiB |
|
After Width: | Height: | Size: 283 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 185 KiB |
|
After Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 174 KiB |
|
Before Width: | Height: | Size: 139 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 154 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 215 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 224 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 191 KiB |
|
Before Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 55 KiB |