mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 14:02:53 +08:00
更新 PVE 制作虚拟机模板
This commit is contained in:
+3
-6
@@ -93,14 +93,11 @@ CPU `类别` 选择 `host` ,`插槽` 与 `核心` 数根据物理 CPU 核心
|
|||||||
使用 SSH 工具登录 PVE 服务器,并进入 `tmp` 目录,逐行执行以下命令创建一个文件夹。
|
使用 SSH 工具登录 PVE 服务器,并进入 `tmp` 目录,逐行执行以下命令创建一个文件夹。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 进入 tmp 目录
|
## 创建存放 Debian 云镜像的临时目录
|
||||||
$ cd /tmp
|
$ mkdir -p /tmp/Debian
|
||||||
|
|
||||||
## 创建文件夹
|
|
||||||
$ mkdir Debian
|
|
||||||
|
|
||||||
## 进入文件夹
|
## 进入文件夹
|
||||||
$ cd Debian
|
$ cd /tmp/Debian
|
||||||
```
|
```
|
||||||
|
|
||||||
将 Debian 云镜像传输到该文件夹,并检查 `hash` 。
|
将 Debian 云镜像传输到该文件夹,并检查 `hash` 。
|
||||||
|
|||||||
+146
-3
@@ -90,7 +90,7 @@ systemd-r 347 systemd-resolve 20u IPv4 13448 0t0 TCP localhost:domain
|
|||||||
$ 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/adguardhome.conf
|
$ sudo nvim /etc/systemd/resolved.conf.d/server_dns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -121,7 +121,7 @@ $ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
|
|||||||
$ sudo systemctl restart systemd-resolved.service
|
$ sudo systemctl restart systemd-resolved.service
|
||||||
```
|
```
|
||||||
|
|
||||||
## 5.安装 Adguard Home
|
## 5. Adguard Home
|
||||||
|
|
||||||
Adguard Home 将采用 `snap` 形式安装,逐行执行以下命令。
|
Adguard Home 将采用 `snap` 形式安装,逐行执行以下命令。
|
||||||
|
|
||||||
@@ -173,9 +173,152 @@ $ sudo crontab -e
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6.配置 Adguard Home
|
### 5.3.配置 AGH
|
||||||
|
|
||||||
关于 Adguard Home 配置相关内容,请参阅 [Adguard Home 折腾手记](https://gitee.com/callmer/agh_toss_notes) 。
|
关于 Adguard Home 配置相关内容,请参阅 [Adguard Home 折腾手记](https://gitee.com/callmer/agh_toss_notes) 。
|
||||||
|
|
||||||
|
## 6. SmartDNS
|
||||||
|
|
||||||
|
若需使用 SmartDNS 代替 Adguard Home,可 Debian 官方源进行安装,但 SmartDNS 版本通常较为 “过时” 。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 安装 SmartDNS
|
||||||
|
$ sudo apt install smartdns
|
||||||
|
```
|
||||||
|
|
||||||
|
因此,更推荐使用其 Github 仓库中最新的稳定版进行安装,官方仓库请参阅 [pymumu/smartdns](https://github.com/pymumu/smartdns/releases) 。
|
||||||
|
|
||||||
|
下载 SmartDNS 最新版本时,请根据系统架构选择对应版本,逐行执行以下命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 创建存放 SmartDNS 安装包的临时目录
|
||||||
|
$ mkdir -p /tmp/SmartDNS
|
||||||
|
|
||||||
|
## 进入文件夹
|
||||||
|
$ cd /tmp/SmartDNS
|
||||||
|
|
||||||
|
## 下载 SmartDNS 安装包
|
||||||
|
$ wget https://github.com/pymumu/smartdns/releases/download/Release42/smartdns.1.2023.05.07-1641.x86_64-linux-all.tar.gz
|
||||||
|
|
||||||
|
## 解压缩 SmartDNS 安装包
|
||||||
|
$ tar zxf smartdns.1.2023.05.07-1641.x86_64-linux-all.tar.gz
|
||||||
|
|
||||||
|
## 进入安装包目录
|
||||||
|
$ cd smartdns
|
||||||
|
|
||||||
|
## 赋予安装脚本执行权限
|
||||||
|
$ chmod +x ./install
|
||||||
|
|
||||||
|
## 安装 SmartDNS
|
||||||
|
$ sudo ./install -i
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6.1.配置 SmartDNS
|
||||||
|
|
||||||
|
若需使用 SmartDNS 的广告过滤功能,需下载其广告过滤配置文件,为可选操作。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 下载广告过滤配置文件
|
||||||
|
$ sudo wget https://anti-ad.net/anti-ad-for-smartdns.conf -O /etc/smartdns/anti-ad-smartdns.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
修改 SmartDNS 主配置文件之前,使用以下命令将其备份。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 备份 SmartDNS 主配置文件
|
||||||
|
$ sudo mv /etc/smartdns/smartdns.conf /etc/smartdns/smartdns.conf.bak
|
||||||
|
```
|
||||||
|
|
||||||
|
使用 `neovim` 编辑器创建 SmartDNS 配置文件,执行以下命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 创建 SmartDNS 主配置文件
|
||||||
|
$ sudo nvim /etc/smartdns/smartdns.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
在编辑器对话框中输入以下内容,并保存。
|
||||||
|
|
||||||
|
**额外说明:**
|
||||||
|
|
||||||
|
- 当不使用 `anti-ad-smartdns.conf` 进行广告过滤时,需移除主配置文件中对应配置项。
|
||||||
|
|
||||||
|
- 请检查配置文件中关于本地域名及其上游 DNS 服务器相关配置,并根据实际情况进行调整。
|
||||||
|
|
||||||
|
- 若仅需 `DoT / DoH` 作为上游 DNS 服务器,可移除 `server-tcp` 相关配置项。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# This configuration file is customized by fox,
|
||||||
|
# Optimize SmartDNS parameters for local DNS server.
|
||||||
|
|
||||||
|
conf-file /etc/smartdns/anti-ad-smartdns.conf
|
||||||
|
|
||||||
|
bind [::]:53
|
||||||
|
bind-tcp [::]:53
|
||||||
|
|
||||||
|
cache-size 32768
|
||||||
|
|
||||||
|
prefetch-domain yes
|
||||||
|
serve-expired-prefetch-time 43200
|
||||||
|
|
||||||
|
speed-check-mode ping,tcp:80,tcp:443
|
||||||
|
|
||||||
|
force-qtype-SOA 65
|
||||||
|
|
||||||
|
log-level warn
|
||||||
|
|
||||||
|
server 119.29.29.29 -group dnspod
|
||||||
|
server 2402:4e00:: -group dnspod
|
||||||
|
|
||||||
|
server 223.5.5.5 -group alidns
|
||||||
|
server 2400:3200::1 -group alidns
|
||||||
|
|
||||||
|
server 172.16.1.1 -group fox
|
||||||
|
server fdac::1 -group fox
|
||||||
|
|
||||||
|
nameserver /doh.pub/dnspod
|
||||||
|
nameserver /dot.pub/dnspod
|
||||||
|
|
||||||
|
nameserver /dns.alidns.com/alidns
|
||||||
|
|
||||||
|
nameserver /fox.local/fox
|
||||||
|
|
||||||
|
server-tcp 119.29.29.29
|
||||||
|
server-tcp 223.5.5.5
|
||||||
|
server-tcp 114.114.114.114
|
||||||
|
|
||||||
|
server-tcp 2402:4e00::
|
||||||
|
server-tcp 2400:3200::1
|
||||||
|
server-tcp 2400:3200:baba::1
|
||||||
|
|
||||||
|
server-tls 1.12.12.12 -spki-pin 5TIMjgyMhA0qmPdK+AM9LX6vNI/9EPBydh/ZXdfcYmI= -host-name dot.pub
|
||||||
|
server-tls 120.53.53.53 -spki-pin 5TIMjgyMhA0qmPdK+AM9LX6vNI/9EPBydh/ZXdfcYmI= -host-name dot.pub
|
||||||
|
server-tls 223.5.5.5 -spki-pin ZwR21gnCMTzsM6VWtnb/azufgYegWWuhE9reP5tamWU= -host-name dns.alidns.com
|
||||||
|
server-tls 223.6.6.6 -spki-pin ZwR21gnCMTzsM6VWtnb/azufgYegWWuhE9reP5tamWU= -host-name dns.alidns.com
|
||||||
|
|
||||||
|
server-https https://doh.pub/dns-query
|
||||||
|
server-https https://dns.alidns.com/dns-query
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6.2. SmartDNS 定时任务
|
||||||
|
|
||||||
|
本步骤为可选操作,主要设置 SmartDNS 定时更新广告过滤配置文件和定时重启。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 编辑系统定时任务,编辑器选择 nano
|
||||||
|
$ sudo crontab -e
|
||||||
|
```
|
||||||
|
|
||||||
|
在配置文件末尾,增加以下配置项。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 定时任务配置项
|
||||||
|
|
||||||
|
0 5 * * * /usr/bin/wget -q --tries=10 --retry-connrefused --random-wait https://anti-ad.net/anti-ad-for-smartdns.conf -O /etc/smartdns/anti-ad-smartdns.conf
|
||||||
|
|
||||||
|
30 5 * * * /usr/bin/systemctl restart smartdns.service
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
至此,新虚拟机已配置完成,可作为内网 DNS 服务器使用。
|
至此,新虚拟机已配置完成,可作为内网 DNS 服务器使用。
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
# This configuration file is customized by fox,
|
||||||
|
# Optimize SmartDNS parameters for local DNS server.
|
||||||
|
|
||||||
|
conf-file /etc/smartdns/anti-ad-smartdns.conf
|
||||||
|
|
||||||
|
bind [::]:53
|
||||||
|
bind-tcp [::]:53
|
||||||
|
|
||||||
|
cache-size 32768
|
||||||
|
|
||||||
|
prefetch-domain yes
|
||||||
|
serve-expired-prefetch-time 43200
|
||||||
|
|
||||||
|
speed-check-mode ping,tcp:80,tcp:443
|
||||||
|
|
||||||
|
force-qtype-SOA 65
|
||||||
|
|
||||||
|
log-level warn
|
||||||
|
|
||||||
|
server 119.29.29.29 -group dnspod
|
||||||
|
server 2402:4e00:: -group dnspod
|
||||||
|
|
||||||
|
server 223.5.5.5 -group alidns
|
||||||
|
server 2400:3200::1 -group alidns
|
||||||
|
|
||||||
|
server 172.16.1.1 -group fox
|
||||||
|
server fdac::1 -group fox
|
||||||
|
|
||||||
|
nameserver /doh.pub/dnspod
|
||||||
|
nameserver /dot.pub/dnspod
|
||||||
|
|
||||||
|
nameserver /dns.alidns.com/alidns
|
||||||
|
|
||||||
|
nameserver /fox.local/fox
|
||||||
|
|
||||||
|
server-tcp 119.29.29.29
|
||||||
|
server-tcp 223.5.5.5
|
||||||
|
server-tcp 114.114.114.114
|
||||||
|
|
||||||
|
server-tcp 2402:4e00::
|
||||||
|
server-tcp 2400:3200::1
|
||||||
|
server-tcp 2400:3200:baba::1
|
||||||
|
|
||||||
|
server-tls 1.12.12.12 -spki-pin 5TIMjgyMhA0qmPdK+AM9LX6vNI/9EPBydh/ZXdfcYmI= -host-name dot.pub
|
||||||
|
server-tls 120.53.53.53 -spki-pin 5TIMjgyMhA0qmPdK+AM9LX6vNI/9EPBydh/ZXdfcYmI= -host-name dot.pub
|
||||||
|
server-tls 223.5.5.5 -spki-pin ZwR21gnCMTzsM6VWtnb/azufgYegWWuhE9reP5tamWU= -host-name dns.alidns.com
|
||||||
|
server-tls 223.6.6.6 -spki-pin ZwR21gnCMTzsM6VWtnb/azufgYegWWuhE9reP5tamWU= -host-name dns.alidns.com
|
||||||
|
|
||||||
|
server-https https://doh.pub/dns-query
|
||||||
|
server-https https://dns.alidns.com/dns-query
|
||||||
|
|
||||||
Reference in New Issue
Block a user