mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-09-01 06:22:52 +08:00
Compare commits
4
Commits
d0f4ef53a0
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
126635206a | ||
|
|
d3715eaf4e | ||
|
|
66df985278 | ||
|
|
dfb4a767a8 |
+2
-6
@@ -124,14 +124,10 @@ Microsoft 官方终端工具,可以在 Github 平台或 Microsoft 应用商店
|
|||||||
|
|
||||||
此时会出现 `Target Harddisk` 选项,会显示出设备中存在的硬盘列表,可通过下拉框选择安装 PVE 的目标硬盘。
|
此时会出现 `Target Harddisk` 选项,会显示出设备中存在的硬盘列表,可通过下拉框选择安装 PVE 的目标硬盘。
|
||||||
|
|
||||||
|
如需修改文件系统参数,可点击目标硬盘右侧的 `Options` 菜单。若无特殊要求,建议保持系统默认配置。
|
||||||
|
|
||||||

|

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

|
|
||||||
|
|
||||||
### 1.4. PVE 时区选项
|
### 1.4. PVE 时区选项
|
||||||
|
|
||||||
此时 PVE 处于未联网的 “离线” 状态,因此不会从互联网中读取时区信息,需要手动设置时区。
|
此时 PVE 处于未联网的 “离线” 状态,因此不会从互联网中读取时区信息,需要手动设置时区。
|
||||||
|
|||||||
+1
-1
@@ -160,7 +160,7 @@ $ apt full-upgrade
|
|||||||
$ apt update
|
$ apt update
|
||||||
|
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ apt install btop curl knot-dnsutils lm-sensors neovim powermgmt-base unattended-upgrades sshguard tmux
|
$ apt install btop curl knot-dnsutils lm-sensors neovim powermgmt-base sshguard tmux unattended-upgrades
|
||||||
|
|
||||||
## 安装 CPU 调度调整工具
|
## 安装 CPU 调度调整工具
|
||||||
$ apt install linux-cpupower
|
$ apt install linux-cpupower
|
||||||
|
|||||||
+1
-55
@@ -472,61 +472,7 @@ $ find /sys/kernel/iommu_groups/ -type l
|
|||||||
/sys/kernel/iommu_groups/9/devices/0000:00:14.1
|
/sys/kernel/iommu_groups/9/devices/0000:00:14.1
|
||||||
```
|
```
|
||||||
|
|
||||||
## 5. BTRFS 调整
|
## 5.系统清理
|
||||||
|
|
||||||
**额外说明:**
|
|
||||||
- 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节
|
|
||||||
- `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作
|
|
||||||
- 有关在 PVE 中使用 `BTRFS` 的详情,请参阅 [Proxmox VE - BTRFS](https://pve.proxmox.com/wiki/BTRFS)
|
|
||||||
|
|
||||||
安装 PVE 时,若使用了 `BTRFS` 单盘 `RAID0` 的安装模式,系统默认未启用 swap 和 zstd 压缩,需要手动开启。
|
|
||||||
|
|
||||||
通常情况下,内存与 swap 的 **推荐** 比例为 `1:1` 。本机具有 `16GB` 内存,因此设置 `16GB` swap 空间。
|
|
||||||
|
|
||||||
执行以下命令,在 `BTRFS` 文件系统中创建子卷,并配置激活 swapfile 。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 创建用于存放交换文件的子卷
|
|
||||||
$ btrfs subvolume create /swap
|
|
||||||
|
|
||||||
## 在子卷中创建 16GB 的交换文件
|
|
||||||
$ btrfs filesystem mkswapfile --size 16g --uuid clear /swap/swapfile
|
|
||||||
|
|
||||||
## 激活交换文件
|
|
||||||
$ swapon /swap/swapfile
|
|
||||||
```
|
|
||||||
|
|
||||||
此时还需进一步修改系统的 `fstab` 配置文件,以启用 `BTRFS` 的 zstd 压缩功能并确保 swap 在系统启动时自动激活。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 编辑 fstab 配置文件
|
|
||||||
$ editor /etc/fstab
|
|
||||||
```
|
|
||||||
|
|
||||||
`fstab` 为系统关键配置文件,直接影响系统启动,修改此文件时,请注意以下几点:
|
|
||||||
|
|
||||||
- 仅修改根目录 `/` 对应的挂载选项,添加 `compress=zstd` 参数。
|
|
||||||
|
|
||||||
- 在文件末尾新增一行,添加 swap 的自动挂载。
|
|
||||||
|
|
||||||
- 请 **不要** 修改其余配置参数,尤其是设备的唯一标识符( `UUID` ),切勿修改。
|
|
||||||
|
|
||||||
修改完成后,示例如下。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#### 系统 fstab 示例配置
|
|
||||||
|
|
||||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
|
||||||
|
|
||||||
UUID=<DO-NOT-EDIT-YOUR-UUID> / btrfs defaults,compress=zstd 0 1
|
|
||||||
|
|
||||||
UUID=<YOUR-UUID> /boot/efi vfat defaults 0 1
|
|
||||||
proc /proc proc defaults 0 0
|
|
||||||
|
|
||||||
/swap/swapfile none swap defaults 0 0
|
|
||||||
```
|
|
||||||
|
|
||||||
## 6.系统清理
|
|
||||||
|
|
||||||
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -102,6 +102,8 @@ $ sudo tee /etc/systemd/resolved.conf.d/10-server-dns.conf >/dev/null <<'EOF'
|
|||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
DNS=::1
|
DNS=::1
|
||||||
DNSStubListener=no
|
DNSStubListener=no
|
||||||
|
LLMNR=no
|
||||||
|
MulticastDNS=no
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -383,7 +385,7 @@ server-https https://doh.360.cn/dns-query -fallback
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`SmartDNS` 主配置文件配置完成后,执行以下命令修正文件权限
|
`SmartDNS` 主配置文件配置完成后,执行以下命令修正文件权限。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 修正 SmartDNS 主配置文件权限
|
## 修正 SmartDNS 主配置文件权限
|
||||||
@@ -436,7 +438,6 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -443,6 +443,8 @@ $ sudo tee /etc/systemd/resolved.conf.d/10-server-dns.conf >/dev/null <<'EOF'
|
|||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
DNS=::1
|
DNS=::1
|
||||||
DNSStubListener=no
|
DNSStubListener=no
|
||||||
|
LLMNR=no
|
||||||
|
MulticastDNS=no
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -519,9 +521,8 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/ts.net/
|
||||||
|
|
||||||
# DNS Filter
|
# DNS Filter
|
||||||
|
|
||||||
@@ -539,8 +540,8 @@ local=/test/
|
|||||||
|
|
||||||
# DNS Server
|
# DNS Server
|
||||||
|
|
||||||
server=/ts.net/100.100.100.100
|
|
||||||
server=/fox.internal/172.16.1.1
|
server=/fox.internal/172.16.1.1
|
||||||
|
server=/ts.net/100.100.100.100
|
||||||
server=172.16.1.1
|
server=172.16.1.1
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -562,7 +563,7 @@ $ sudo systemctl restart dnsmasq.service
|
|||||||
|
|
||||||
为了在网卡重新上线后自动恢复参数,本文使用 `networkd-dispatcher` 监听 `routable` 状态。
|
为了在网卡重新上线后自动恢复参数,本文使用 `networkd-dispatcher` 监听 `routable` 状态。
|
||||||
|
|
||||||
优化脚本直接使用事件中的 `IFACE`,仅处理由 `systemd-networkd` 配置的底层网卡,并跳过 `tailscale0` 和其他 TUN 设备。
|
优化脚本直接使用事件中的 `IFACE` ,仅处理由 `systemd-networkd` 配置的底层网卡,并跳过 `tailscale0` 和其他 TUN 设备。
|
||||||
|
|
||||||
首先检查 TS 服务器的底层出口网卡。
|
首先检查 TS 服务器的底层出口网卡。
|
||||||
|
|
||||||
@@ -577,7 +578,7 @@ $ NETDEV=$(networkctl list --no-legend --no-pager | awk '$3 == "ether" && $4 ==
|
|||||||
$ networkctl status "$NETDEV"
|
$ networkctl status "$NETDEV"
|
||||||
```
|
```
|
||||||
|
|
||||||
`systemd-networkd` 应显示为 `active`,底层出口网卡应显示为 `State: routable (configured)`。
|
`systemd-networkd` 应显示为 `active` ,底层出口网卡应显示为 `State: routable (configured)` 。
|
||||||
|
|
||||||
检查完成后,创建 `networkd-dispatcher` 的 `routable` 事件脚本。
|
检查完成后,创建 `networkd-dispatcher` 的 `routable` 事件脚本。
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 508 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 463 KiB After Width: | Height: | Size: 464 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 586 KiB After Width: | Height: | Size: 474 KiB |
@@ -19,7 +19,6 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/ts.net/
|
||||||
|
|
||||||
# DNS Filter
|
# DNS Filter
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ local=/test/
|
|||||||
|
|
||||||
# DNS Server
|
# DNS Server
|
||||||
|
|
||||||
server=/ts.net/100.100.100.100
|
|
||||||
server=/fox.internal/172.16.1.1
|
server=/fox.internal/172.16.1.1
|
||||||
|
server=/ts.net/100.100.100.100
|
||||||
server=172.16.1.1
|
server=172.16.1.1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user