mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-09-01 22:42:53 +08:00
更新配置文件创建方法
This commit is contained in:
+12
-33
@@ -53,7 +53,7 @@ $ sudo systemctl restart ssh.service
|
||||
|
||||
```bash
|
||||
## 配置 Debian 系统默认软件源脚本
|
||||
$ sudo bash -c 'cat > /etc/apt/sources.list.d/debian.sources <<EOF
|
||||
$ sudo tee /etc/apt/sources.list.d/debian.sources >/dev/null <<'EOF'
|
||||
Types: deb
|
||||
URIs: https://mirrors.ustc.edu.cn/debian
|
||||
Suites: trixie trixie-updates
|
||||
@@ -65,9 +65,7 @@ URIs: https://mirrors.ustc.edu.cn/debian-security
|
||||
Suites: trixie-security
|
||||
Components: main contrib non-free non-free-firmware
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
|
||||
EOF'
|
||||
|
||||
EOF
|
||||
```
|
||||
|
||||
为了防止 `Cloud-Init` 服务意外修改软件源配置,需要添加文件保护,执行以下命令。
|
||||
@@ -168,11 +166,9 @@ update-alternatives: using /usr/bin/nvim to provide /usr/bin/editor (editor) in
|
||||
$ sudo mkdir -p /etc/xdg/nvim
|
||||
|
||||
## 配置 nvim 鼠标交互行为脚本
|
||||
$ sudo tee /etc/xdg/nvim/sysinit.vim << 'EOF'
|
||||
$ sudo tee /etc/xdg/nvim/sysinit.vim >/dev/null <<'EOF'
|
||||
set mouse=
|
||||
|
||||
EOF
|
||||
|
||||
```
|
||||
|
||||
### 1.6.调整内核参数
|
||||
@@ -183,12 +179,7 @@ EOF
|
||||
|
||||
```bash
|
||||
## 编辑 内核参数 配置文件
|
||||
$ sudo editor /etc/sysctl.d/99-sysctl.conf
|
||||
```
|
||||
|
||||
在配置文件中输入以下内容,注意配置中间的空格。
|
||||
|
||||
```bash
|
||||
$ sudo tee /etc/sysctl.d/99-sysctl.conf >/dev/null <<'EOF'
|
||||
# This configuration file is customized by fox,
|
||||
# Optimize sysctl parameters for local TPL server.
|
||||
|
||||
@@ -217,10 +208,10 @@ net.ipv4.tcp_wmem = 4096 524288 16777216
|
||||
|
||||
net.ipv6.conf.all.use_tempaddr = 0
|
||||
net.ipv6.conf.default.use_tempaddr = 0
|
||||
|
||||
EOF
|
||||
```
|
||||
|
||||
保存该配置文件后,重启系统或者执行以下命令让配置生效。
|
||||
配置文件编辑完成后,重启系统或者执行以下命令让配置生效。
|
||||
|
||||
```bash
|
||||
## 让内核参数生效
|
||||
@@ -251,21 +242,16 @@ Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需
|
||||
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
||||
|
||||
## 创建 NTP 配置文件
|
||||
$ sudo editor /etc/systemd/timesyncd.conf.d/10-server-ntp.conf
|
||||
```
|
||||
|
||||
在配置文件中输入以下内容,并保存。
|
||||
|
||||
```bash
|
||||
$ sudo tee /etc/systemd/timesyncd.conf.d/10-server-ntp.conf >/dev/null <<'EOF'
|
||||
# This configuration file is customized by fox,
|
||||
# Optimize system NTP server.
|
||||
|
||||
[Time]
|
||||
NTP=ntp.aliyun.com ntp.tencent.com cn.pool.ntp.org
|
||||
|
||||
EOF
|
||||
```
|
||||
|
||||
保存该配置文件后,需重启 `systemd-timesyncd.service` 服务,并再次检查系统 NTP 服务器地址。
|
||||
配置文件编辑完成后,需重启 `systemd-timesyncd.service` 服务,并再次检查系统 NTP 服务器地址。
|
||||
|
||||
```bash
|
||||
## 重启 systemd-timesyncd.service
|
||||
@@ -321,23 +307,16 @@ $ sudo dpkg-reconfigure -plow unattended-upgrades
|
||||
|
||||
开始调整 `20auto-upgrades` 配置文件。
|
||||
|
||||
```bash
|
||||
## 编辑 20auto-upgrades 配置文件
|
||||
$ sudo editor /etc/apt/apt.conf.d/20auto-upgrades
|
||||
```
|
||||
|
||||
清空当前全部配置项后,输入以下内容,并保存。
|
||||
|
||||
配置文件中,用来控制更新周期的参数为 `APT::Periodic::Unattended-Upgrade` ,`3` 表示更新周期为 `3` 天。
|
||||
|
||||
```bash
|
||||
## 系统更新周期配置项
|
||||
|
||||
## 编辑 20auto-upgrades 配置文件
|
||||
$ sudo tee /etc/apt/apt.conf.d/20auto-upgrades >/dev/null <<'EOF'
|
||||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Unattended-Upgrade "3";
|
||||
APT::Periodic::AutocleanInterval "1";
|
||||
APT::Periodic::CleanInterval "1";
|
||||
|
||||
EOF
|
||||
```
|
||||
|
||||
进一步调整 `50unattended-upgrades` 配置文件。
|
||||
|
||||
Reference in New Issue
Block a user