新机器开荒:从装系统到能用

2026-09-05 · LinuxVPS

每次开新机器都要重复一遍的事,索性写成流程,照着走不漏项。

第一步:SSH

ssh-keygen -t ed25519
# 把公钥放进 ~/.ssh/authorized_keys 后再关密码登录
# /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin prohibit-password

顺序别反:先确认密钥能登,再关密码,不然把自己锁外面。

第二步:常用工具

apt update && apt install -y curl vim htop git tmux ufw fail2ban

第三步:自动安全更新

apt install -y unattended-upgrades
dpkg-reconfigure --priority=low unattended-upgrades

第四步:时区和时间同步

timedatectl set-timezone Asia/Shanghai
timedatectl

做完这四步再装业务,机器就算开过荒了。剩下的防火墙规则、备份策略,按这台机器的用途单独配。