Debian 13 初体验:升级之后值得改的五个默认配置

Linux2026-10-08 · 阅读 8 分钟

从 Debian 12 一路用过来,13(trixie)的变化比想象中大:新内核、新的 systemd、默认 nftables 后端,还有一堆包的大版本跳跃。这篇整理一下我装完系统必做的几件事。

1. 打开 BBR 与 fq 队列

新内核早就内置 BBR 了,但默认还是 cubic。加个配置文件、跑一遍 sysctl 就行:

cat > /etc/sysctl.d/99-bbr.conf <<'EOF'
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
EOF
sysctl --system

顺手把 UDP 缓冲区也加大,QUIC 类应用会明显受益:

net.core.rmem_max=26214400
net.core.wmem_max=26214400

2. 自动安全更新

服务器最怕的就是漏补丁。装上 unattended-upgrades,让它每天自己跑,内核重启可以留到手动窗口:

apt install unattended-upgrades
dpkg-reconfigure unattended-upgrades

3. 限制 journald 的日志体积

默认日志会一直涨。改 /etc/systemd/journald.conf:

[Journal]
SystemMaxUse=200M
SystemMaxFileSize=50M

然后 systemctl restart systemd-journald 生效。

4. 时区与时间同步

VPS 默认多半是 UTC,日志和 cron 对照起来很费劲。改成东八区并确认 timesyncd 在工作:

timedatectl set-timezone Asia/Shanghai
timedatectl set-ntp true
timedatectl status

5. 给 SSH 加把锁

关密码登录、只留密钥,是最省事的一次性投资。改 /etc/ssh/sshd_config.d/99-hardening.conf:

PasswordAuthentication no
PermitRootLogin prohibit-password

改完先 sshd -t 验证配置,再 reload,别把自己锁在外面。

小结

这五步总共花不了十分钟,但能省掉后面一大串麻烦。Debian 13 本身很稳,升级过程中唯一要留意的就是第三方源和 PHP 相关的包,其余基本无痛。

← 返回首页