Compare commits

..
5 Commits
Author SHA1 Message Date
CallMeR 9f86e73f61 更新 PVE 虚拟机克隆 2023-06-28 13:04:33 +08:00
CallMeR fdceec75ba 更新 PVE 制作虚拟机模板 2023-06-28 00:30:32 +08:00
CallMeR 182a939f5e 更新 PVE 系统调整 2023-06-28 00:24:19 +08:00
CallMeR b71d013431 更新 PVE 虚拟机克隆 2023-06-28 00:12:07 +08:00
CallMeR e64d6f9b7f 更新 PVE 创建模板虚拟机 2023-06-27 22:32:10 +08:00
10 changed files with 77 additions and 21 deletions
+4 -6
View File
@@ -43,9 +43,7 @@ Sun, 25 Jun 2023 12:12:12 +0800
Debian 系统常用 `systemd-timesyncd.service` 来同步时间,而 PVE 系统使用 `chrony.service` 来同步时间。
为了使用国内的 NTP 服务器,需要对 `chrony.service` 进行配置。
执行以下命令对 `chrony` 的配置文件进行修改。
为了使用国内的 NTP 服务器,需要对 `chrony.service` 进行配置,执行以下命令
```bash
## 编辑 chrony 配置文件
@@ -66,7 +64,7 @@ pool ntp.aliyun.com iburst
```
保存该配置文件后,需重启 `chrony` 服务,并再次检查系统 NTP 服务器地址。
保存该配置文件后,需重启 `chrony.service` ,并再次检查系统 NTP 服务器地址。
```bash
## 重启 chrony 服务
@@ -258,7 +256,7 @@ $ dpkg-reconfigure -plow unattended-upgrades
Creating config file /etc/apt/apt.conf.d/20auto-upgrades with new version
```
进一步调整 apt 的 `20auto-upgrades` 配置文件。
进一步调整 `20auto-upgrades` 配置文件。
```bash
## 进入 apt 的配置目录
@@ -282,7 +280,7 @@ APT::Periodic::CleanInterval "1";
```
进一步调整 apt 的 `50unattended-upgrades` 配置文件。
进一步调整 `50unattended-upgrades` 配置文件。
```bash
## 编辑 50unattended-upgrades 配置文件
+10 -8
View File
@@ -216,20 +216,21 @@ Successfully imported disk as 'unused0:local-lvm:vm-1000-disk-0'
|参数|值|说明|
|--|--|--|
|用户|fox|新系统的管理员账户|
|密码|********|使用强密码|
|DNS域|fox.local|内网域名(可选)|
|DNS服务器|`172.16.1.1 127.0.0.1`|本机DNS服务器,用空格隔开|
|SSH公钥||使用秘钥登录服务器,暂不使用|
|用户|`fox`|新系统的管理员账户|
|密码|`********`|使用强密码|
|DNS域|`fox.local`|内网域名(可选)|
|DNS服务器|`172.16.1.1`|本机 DNS 服务器|
|SSH公钥|`无`|使用秘钥登录服务器,暂不使用|
|Upgrade packages|`是`|启动时更新软件包,保持默认即可|
|IP配置(net0)|`ip=172.16.1.250/24,gw=172.16.1.1,ip6=auto`|模板的 IP 设置|
**额外说明:**
1. 修改 `Cloud-Init` 参数时,需要在虚拟机关机情况下修改才会生效。
2. `DNS服务器` 设置部分,如果先设置了 `127.0.0.1` 作为 DNS 服务器,后续其他 DNS 的 IP 地址将被忽略
2. `DNS服务器` 参数支持输入多个 IPv4 / IPv6 地址,使用空格隔开
此时内网没有其他 DNS 服务器,因此将 `DNS服务器` 设置为 `172.16.1.1 127.0.0.1` IP 之间用空格隔开
3. 当前 `DNS服务器` 参数为主路由 LAN 口 IPv4 地址,确保虚拟机能正常联网
![CI网络配置](img/p04/vm_ci_dns.jpeg)
@@ -245,7 +246,8 @@ Successfully imported disk as 'unused0:local-lvm:vm-1000-disk-0'
|参数|值|说明|
|--|--|--|
|DNS服务器|`172.16.1.1 fdac::1 127.0.0.1`|本机DNS服务器,用空格隔开|
|DNS域|`fox.local`|内网域名(可选)|
|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 设置|
`DNS服务器` 参数中需要加入主路由 LAN 口 ULA IPv6 地址。
+3 -3
View File
@@ -215,7 +215,7 @@ $ sudo sysctl -f
### 1.5.调整系统时间
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
```bash
## 设置系统时区
@@ -305,7 +305,7 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
Creating config file /etc/apt/apt.conf.d/20auto-upgrades with new version
```
接下来调整 apt 的 `20auto-upgrades` 配置文件。
进一步调整 `20auto-upgrades` 配置文件。
```bash
## 编辑 20auto-upgrades 配置文件
@@ -326,7 +326,7 @@ APT::Periodic::CleanInterval "1";
```
进一步调整 apt 的 `50unattended-upgrades` 配置文件。
进一步调整 `50unattended-upgrades` 配置文件。
```bash
## 编辑 50unattended-upgrades 配置文件
+60 -4
View File
@@ -63,10 +63,66 @@
![克隆虚拟机自动启动顺序](img/p06/vm_clone_autostart_order.jpeg)
## 4.安装 Adguard Home
## 4.调整系统端口
设置完成后,将该虚拟机开机,并使用 SSH 工具登录。
Adguard Home 需监听系统 `53` 端口来提供 DNS 服务,使用以下命令检查端口占用。
```bash
## 检查 53 端口占用
$ sudo lsof -i :53
#### 端口占用示例输出
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 347 systemd-resolve 17u IPv4 13445 0t0 UDP localhost:domain
systemd-r 347 systemd-resolve 18u IPv4 13446 0t0 TCP localhost:domain (LISTEN)
systemd-r 347 systemd-resolve 19u IPv4 13447 0t0 UDP localhost:domain
systemd-r 347 systemd-resolve 20u IPv4 13448 0t0 TCP localhost:domain (LISTEN)
```
当前系统 `53` 端口被 `systemd-resolved.service` 占用,会导致 Adguard Home 监听端口失败。
为了正常使用 Adguard Home ,需要对 `systemd-resolved.service` 进行配置,逐行执行以下命令。
```bash
## 创建 systemd-resolved 配置文件夹
$ sudo mkdir -p /etc/systemd/resolved.conf.d
## 创建 systemd-resolved 配置文件
$ sudo vim /etc/systemd/resolved.conf.d/adguardhome.conf
```
在配置文件中添加以下配置项,并保存。
```bash
## systemd-resolved 配置项
[Resolve]
DNS=127.0.0.1
DNSStubListener=no
```
保存该配置文件后,还需调整系统 `resolv.conf` 配置文件,逐行执行以下命令。
```bash
## 备份 resolv.conf 配置文件
$ sudo mv /etc/resolv.conf /etc/resolv.conf.bak
## 创建 resolv.conf 软链接
$ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
```
配置完成后,需重启 `systemd-resolved.service` 服务,并再次检查系统 `53` 端口占用。
```bash
## 重启 systemd-resolved 服务
$ sudo systemctl restart systemd-resolved.service
```
## 5.安装 Adguard Home
Adguard Home 将采用 `snap` 形式安装,逐行执行以下命令。
```bash
@@ -77,7 +133,7 @@ $ sudo apt install snapd
$ sudo snap install adguard-home
```
### 4.1. Snap 自动更新
### 5.1. Snap 自动更新
查看 Snap 当前的更新策略,执行以下命令。
@@ -96,7 +152,7 @@ $ sudo snap set system refresh.timer=2:30-3:30,14:30-15:30
$ sudo snap set system refresh.timer=mon,2:30,,fri,2:30
```
### 4.2. Snap 定时任务
### 5.2. Snap 定时任务
本步骤为可选操作,主要设置定时重启 Snap 服务。
@@ -117,7 +173,7 @@ $ sudo crontab -e
```
## 5.配置 Adguard Home
## 6.配置 Adguard Home
关于 Adguard Home 配置相关内容,请参阅 [Adguard Home 折腾手记](https://gitee.com/callmer/agh_toss_notes) 。
Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 88 KiB