mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 14:02:53 +08:00
适配 trixie 版本
This commit is contained in:
+28
-10
@@ -4,7 +4,25 @@
|
|||||||
|
|
||||||
在 PVE 系统调整之前,请确认必要的软件包已经安装完成,本文后续命令均在 SSH 终端下执行。
|
在 PVE 系统调整之前,请确认必要的软件包已经安装完成,本文后续命令均在 SSH 终端下执行。
|
||||||
|
|
||||||
关于 [Neovim](https://neovim.io/) 的基础使用方法,请参阅:[Neovim 基础教程](https://cn.bing.com/search?q=Neovim+%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B) 。
|
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
|
||||||
|
## 修改系统默认编辑器(选择 nvim 所在条目,即可将 neovim 设为默认编辑器)
|
||||||
|
$ update-alternatives --config editor
|
||||||
|
|
||||||
|
#### 系统默认编辑器示例输出
|
||||||
|
There are 3 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.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
|
||||||
|
```
|
||||||
|
|
||||||
## 1.系统时区
|
## 1.系统时区
|
||||||
|
|
||||||
@@ -29,7 +47,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 服务器。
|
||||||
@@ -150,11 +168,11 @@ performance powersave
|
|||||||
|
|
||||||
- CPU 驱动为 `intel_pstate` 时,推荐使用 `powersave` 调度器。
|
- CPU 驱动为 `intel_pstate` 时,推荐使用 `powersave` 调度器。
|
||||||
|
|
||||||
本文使用 `powersave` 调度器为演示,使用 `neovim` 编辑器创建 `cpupower` 的配置文件。
|
本文使用 `powersave` 调度器创建 `cpupower` 的配置文件。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 cpupower 默认配置文件
|
## 创建 cpupower 默认配置文件
|
||||||
$ nvim /etc/default/cpupower
|
$ editor /etc/default/cpupower
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中修改以下配置项,并保存。
|
在配置文件中修改以下配置项,并保存。
|
||||||
@@ -172,7 +190,7 @@ CPUPOWER_STOP_OPTS="frequency-set -g performance"
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 cpupower.service 配置文件
|
## 创建 cpupower.service 配置文件
|
||||||
$ nvim /etc/systemd/system/cpupower.service
|
$ editor /etc/systemd/system/cpupower.service
|
||||||
```
|
```
|
||||||
|
|
||||||
在服务配置文件中修改以下配置项,并保存。
|
在服务配置文件中修改以下配置项,并保存。
|
||||||
@@ -290,7 +308,7 @@ $ dpkg-reconfigure -plow unattended-upgrades
|
|||||||
$ cd /etc/apt/apt.conf.d
|
$ cd /etc/apt/apt.conf.d
|
||||||
|
|
||||||
## 编辑 20auto-upgrades 配置文件
|
## 编辑 20auto-upgrades 配置文件
|
||||||
$ nvim /etc/apt/apt.conf.d/20auto-upgrades
|
$ editor /etc/apt/apt.conf.d/20auto-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
删除里面全部内容,添加以下配置项,并保存。
|
||||||
@@ -311,7 +329,7 @@ APT::Periodic::CleanInterval "1";
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 50unattended-upgrades 配置文件
|
## 编辑 50unattended-upgrades 配置文件
|
||||||
$ nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
$ editor /etc/apt/apt.conf.d/50unattended-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
配置文件中,被修改的参数解释如下:
|
配置文件中,被修改的参数解释如下:
|
||||||
@@ -421,7 +439,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` 参数,注意命令中间的空格。
|
||||||
@@ -455,7 +473,7 @@ $ update-grub
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑系统配置文件
|
## 编辑系统配置文件
|
||||||
$ nvim /etc/modules
|
$ editor /etc/modules
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -581,7 +599,7 @@ $ swapon /swap/swapfile
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 fstab 配置文件
|
## 编辑 fstab 配置文件
|
||||||
$ nvim /etc/fstab
|
$ editor /etc/fstab
|
||||||
```
|
```
|
||||||
|
|
||||||
`fstab` 为系统关键配置文件,直接影响系统启动,修改此文件时,请注意以下几点:
|
`fstab` 为系统关键配置文件,直接影响系统启动,修改此文件时,请注意以下几点:
|
||||||
|
|||||||
+34
-12
@@ -56,7 +56,7 @@ $ sudo systemctl restart ssh.service
|
|||||||
```bash
|
```bash
|
||||||
## 配置 Debian 系统默认软件源脚本
|
## 配置 Debian 系统默认软件源脚本
|
||||||
|
|
||||||
$ sudo cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
$ sudo bash -c 'cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: https://mirrors.ustc.edu.cn/debian
|
URIs: https://mirrors.ustc.edu.cn/debian
|
||||||
Suites: trixie trixie-updates
|
Suites: trixie trixie-updates
|
||||||
@@ -69,7 +69,7 @@ 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
|
EOF'
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -143,15 +143,37 @@ Do you want to change your default shell to zsh? [Y/n] y
|
|||||||
$ cd && rm -rvf ohmyzsh .bash_history .zsh_history .shell.pre-oh-my-zsh
|
$ cd && rm -rvf ohmyzsh .bash_history .zsh_history .shell.pre-oh-my-zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.5.调整内核参数
|
### 1.5.配置默认编辑器
|
||||||
|
|
||||||
|
Debian 系统默认编辑器为 `nano` ,推荐将默认编辑器更换为 `neovim` ,执行以下命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 修改系统默认编辑器(选择 nvim 所在条目,即可将 neovim 设为默认编辑器)
|
||||||
|
$ sudo update-alternatives --config editor
|
||||||
|
|
||||||
|
#### 系统默认编辑器示例输出
|
||||||
|
There are 3 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.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
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.6.调整内核参数
|
||||||
|
|
||||||
由于该 Debian 虚拟机模板将用于克隆内网 DNS 服务器,因此需要调整内核参数来简单优化性能。
|
由于该 Debian 虚拟机模板将用于克隆内网 DNS 服务器,因此需要调整内核参数来简单优化性能。
|
||||||
|
|
||||||
使用 `neovim` 编辑器编辑 **内核参数** 配置文件,执行以下命令。
|
编辑 **内核参数** 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 内核参数 配置文件
|
## 编辑 内核参数 配置文件
|
||||||
$ sudo nvim /etc/sysctl.d/99-sysctl.conf
|
$ sudo editor /etc/sysctl.d/99-sysctl.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,注意配置中间的空格。
|
在配置文件中添加以下配置项,注意配置中间的空格。
|
||||||
@@ -197,7 +219,7 @@ net.ipv6.conf.default.use_tempaddr = 0
|
|||||||
$ sudo sysctl --system
|
$ sudo sysctl --system
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.6.调整系统时间
|
### 1.7.调整系统时间
|
||||||
|
|
||||||
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
||||||
|
|
||||||
@@ -221,7 +243,7 @@ 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 editor /etc/systemd/timesyncd.conf.d/10-server-ntp.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -267,7 +289,7 @@ Oct 07 18:06:29 DNS01 systemd-timesyncd[1706]: Contacted time server 203.107.6.8
|
|||||||
Oct 07 18:06:29 DNS01 systemd-timesyncd[1706]: Initial clock synchronization to Mon 2024-10-07 18:06:29.499548 CST.
|
Oct 07 18:06:29 DNS01 systemd-timesyncd[1706]: Initial clock synchronization to Mon 2024-10-07 18:06:29.499548 CST.
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.7.配置自动更新
|
### 1.8.配置自动更新
|
||||||
|
|
||||||
配置 Debian 云镜像的系统自动更新,与配置 PVE 系统自动更新方法基本一致,参阅 [03.PVE系统调整](./03.PVE系统调整.md) 。
|
配置 Debian 云镜像的系统自动更新,与配置 PVE 系统自动更新方法基本一致,参阅 [03.PVE系统调整](./03.PVE系统调整.md) 。
|
||||||
|
|
||||||
@@ -292,7 +314,7 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 20auto-upgrades 配置文件
|
## 编辑 20auto-upgrades 配置文件
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/20auto-upgrades
|
$ sudo editor /etc/apt/apt.conf.d/20auto-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
删除里面全部内容,添加以下配置项,并保存。
|
||||||
@@ -313,7 +335,7 @@ APT::Periodic::CleanInterval "1";
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 50unattended-upgrades 配置文件
|
## 编辑 50unattended-upgrades 配置文件
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
$ sudo editor /etc/apt/apt.conf.d/50unattended-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
根据 “注释” 中相关说明,调整配置文件。
|
根据 “注释” 中相关说明,调整配置文件。
|
||||||
@@ -372,7 +394,7 @@ $ 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.配置定时任务
|
||||||
|
|
||||||
本步骤为可选操作,主要设置系统定时重启。
|
本步骤为可选操作,主要设置系统定时重启。
|
||||||
|
|
||||||
@@ -393,7 +415,7 @@ $ sudo crontab -e
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.9.清理系统
|
### 1.10.清理系统
|
||||||
|
|
||||||
Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对系统进行清理。
|
Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对系统进行清理。
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -94,7 +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 editor /etc/systemd/resolved.conf.d/10-server-dns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -324,11 +324,11 @@ $ 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
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中输入以下内容,并保存。
|
在编辑器对话框中输入以下内容,并保存。
|
||||||
@@ -399,11 +399,11 @@ 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
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中输入以下内容,并保存。
|
在编辑器对话框中输入以下内容,并保存。
|
||||||
|
|||||||
+43
-21
@@ -63,7 +63,7 @@ $ sudo systemctl restart ssh.service
|
|||||||
```bash
|
```bash
|
||||||
## 配置 Debian 系统默认软件源脚本
|
## 配置 Debian 系统默认软件源脚本
|
||||||
|
|
||||||
$ sudo cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
$ sudo bash -c 'cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
||||||
Types: deb
|
Types: deb
|
||||||
URIs: https://mirrors.ustc.edu.cn/debian
|
URIs: https://mirrors.ustc.edu.cn/debian
|
||||||
Suites: trixie trixie-updates
|
Suites: trixie trixie-updates
|
||||||
@@ -76,7 +76,7 @@ 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
|
EOF'
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -163,13 +163,35 @@ Do you want to change your default shell to zsh? [Y/n] y
|
|||||||
$ cd && rm -rvf ohmyzsh .bash_history .zsh_history .shell.pre-oh-my-zsh
|
$ cd && rm -rvf ohmyzsh .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 3 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.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
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.6.调整内核模块
|
||||||
|
|
||||||
|
编辑 **内核模块** 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 内核模块 配置文件
|
## 创建 内核模块 配置文件
|
||||||
$ sudo nvim /etc/modules-load.d/10-server-modules.conf
|
$ sudo editor /etc/modules-load.d/10-server-modules.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -182,13 +204,13 @@ nf_conntrack
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.6.调整内核参数
|
### 1.7.调整内核参数
|
||||||
|
|
||||||
使用 `neovim` 编辑器编辑 **内核参数** 配置文件,执行以下命令。
|
编辑 **内核参数** 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 内核参数 配置文件
|
## 编辑 内核参数 配置文件
|
||||||
$ sudo nvim /etc/sysctl.d/99-sysctl.conf
|
$ sudo editor /etc/sysctl.d/99-sysctl.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,注意配置中间的空格。
|
在配置文件中添加以下配置项,注意配置中间的空格。
|
||||||
@@ -273,7 +295,7 @@ net.netfilter.nf_conntrack_tcp_timeout_established = 7440
|
|||||||
$ sudo sysctl --system
|
$ sudo sysctl --system
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.7.调整系统时间
|
### 1.8.调整系统时间
|
||||||
|
|
||||||
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
||||||
|
|
||||||
@@ -294,7 +316,7 @@ 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 editor /etc/systemd/timesyncd.conf.d/10-server-ntp.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -318,7 +340,7 @@ $ sudo systemctl restart systemd-timesyncd.service
|
|||||||
$ sudo systemctl status systemd-timesyncd.service
|
$ sudo systemctl status systemd-timesyncd.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.8.配置自动更新
|
### 1.9.配置自动更新
|
||||||
|
|
||||||
配置系统自动更新策略,执行以下命令,使用键盘 `左右方向键` 进行选择,`回车键` 进行确认。
|
配置系统自动更新策略,执行以下命令,使用键盘 `左右方向键` 进行选择,`回车键` 进行确认。
|
||||||
|
|
||||||
@@ -334,7 +356,7 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 20auto-upgrades 配置文件
|
## 编辑 20auto-upgrades 配置文件
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/20auto-upgrades
|
$ sudo editor /etc/apt/apt.conf.d/20auto-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
删除里面全部内容,添加以下配置项,并保存。
|
删除里面全部内容,添加以下配置项,并保存。
|
||||||
@@ -355,7 +377,7 @@ APT::Periodic::CleanInterval "1";
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 50unattended-upgrades 配置文件
|
## 编辑 50unattended-upgrades 配置文件
|
||||||
$ sudo nvim /etc/apt/apt.conf.d/50unattended-upgrades
|
$ sudo editor /etc/apt/apt.conf.d/50unattended-upgrades
|
||||||
```
|
```
|
||||||
|
|
||||||
根据 “注释” 中相关说明,调整配置文件。
|
根据 “注释” 中相关说明,调整配置文件。
|
||||||
@@ -418,7 +440,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` 服务状态,确保该服务开机自启。
|
||||||
|
|
||||||
@@ -430,14 +452,14 @@ $ sudo systemctl status nftables.service
|
|||||||
$ sudo systemctl enable nftables.service
|
$ sudo systemctl enable nftables.service
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `neovim` 编辑器修改 `nftables` 配置文件,执行以下命令。
|
修改 `nftables` 配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 备份 nftables 配置文件
|
## 备份 nftables 配置文件
|
||||||
$ sudo mv /etc/nftables.conf /etc/nftables.conf.bak
|
$ sudo mv /etc/nftables.conf /etc/nftables.conf.bak
|
||||||
|
|
||||||
## 创建新的 nftables 配置文件
|
## 创建新的 nftables 配置文件
|
||||||
$ sudo nvim /etc/nftables.conf
|
$ sudo editor /etc/nftables.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
由于防火墙配置文件很长,因此请查阅文件 [debian_ts_nftables.conf](./src/debian/debian_ts_nftables.conf) 进行复制。
|
由于防火墙配置文件很长,因此请查阅文件 [debian_ts_nftables.conf](./src/debian/debian_ts_nftables.conf) 进行复制。
|
||||||
@@ -449,7 +471,7 @@ $ sudo nvim /etc/nftables.conf
|
|||||||
$ sudo systemctl restart nftables.service
|
$ sudo systemctl restart nftables.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.10.调整系统端口
|
### 1.11.调整系统端口
|
||||||
|
|
||||||
为了正常使用 `53` 端口,需要对 `systemd-resolved.service` 进行配置,执行以下命令。
|
为了正常使用 `53` 端口,需要对 `systemd-resolved.service` 进行配置,执行以下命令。
|
||||||
|
|
||||||
@@ -458,7 +480,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 editor /etc/systemd/resolved.conf.d/10-server-dns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -488,7 +510,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` 服务状态,确保该服务开机自启。
|
||||||
|
|
||||||
@@ -507,11 +529,11 @@ $ 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
|
||||||
```
|
```
|
||||||
|
|
||||||
在编辑器对话框中输入以下内容,并保存。
|
在编辑器对话框中输入以下内容,并保存。
|
||||||
|
|||||||
Reference in New Issue
Block a user