Debian 12 重装后必做的 8 件事
新开的 Debian 12 小鸡(1核4G/16G盘),重装后先做这 8 步,后面省心。 1. 换国内源(可选) sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list apt update 2. 加 swap 云镜像默认没 swap,3.8G 内存也建议加 1G 防爆: fallocate -l 1G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile echo '/swapfile none swap sw 0 0' >> /etc/fstab 3. 内核网络优化 /etc/sysctl.d/99-perf-net.conf: net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 vm.swappiness = 10 4. 硬盘 noatime # fstab 加 noatime,nodiratime,commit=30,然后 mount -o remount / tune2fs -m 1 /dev/vda1 # 预留块 5%→1%,16G盘省出600M 5. SSH 改端口 sshd_config 里 Port 9120,systemctl restart ssh。 Debian 用的是 service 模式,改 Port 直接生效(Ubuntu 24.04 是 socket 激活,坑多)。 ...