mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-09-01 14:32:53 +08:00
适配 trixie 版本
This commit is contained in:
+34
-12
@@ -56,7 +56,7 @@ $ sudo systemctl restart ssh.service
|
||||
```bash
|
||||
## 配置 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
|
||||
URIs: https://mirrors.ustc.edu.cn/debian
|
||||
Suites: trixie trixie-updates
|
||||
@@ -69,7 +69,7 @@ Suites: trixie-security
|
||||
Components: main contrib non-free non-free-firmware
|
||||
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
|
||||
```
|
||||
|
||||
### 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 服务器,因此需要调整内核参数来简单优化性能。
|
||||
|
||||
使用 `neovim` 编辑器编辑 **内核参数** 配置文件,执行以下命令。
|
||||
编辑 **内核参数** 配置文件,执行以下命令。
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
### 1.6.调整系统时间
|
||||
### 1.7.调整系统时间
|
||||
|
||||
默认情况下 Debian 云镜像的系统时间需要调整,执行以下命令将系统时区设置为中国时区。
|
||||
|
||||
@@ -221,7 +243,7 @@ Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需
|
||||
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
||||
|
||||
## 创建 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.
|
||||
```
|
||||
|
||||
### 1.7.配置自动更新
|
||||
### 1.8.配置自动更新
|
||||
|
||||
配置 Debian 云镜像的系统自动更新,与配置 PVE 系统自动更新方法基本一致,参阅 [03.PVE系统调整](./03.PVE系统调整.md) 。
|
||||
|
||||
@@ -292,7 +314,7 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
||||
|
||||
```bash
|
||||
## 编辑 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
|
||||
## 编辑 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
|
||||
```
|
||||
|
||||
### 1.8.配置定时任务
|
||||
### 1.9.配置定时任务
|
||||
|
||||
本步骤为可选操作,主要设置系统定时重启。
|
||||
|
||||
@@ -393,7 +415,7 @@ $ sudo crontab -e
|
||||
|
||||
```
|
||||
|
||||
### 1.9.清理系统
|
||||
### 1.10.清理系统
|
||||
|
||||
Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对系统进行清理。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user