从零搭建个人服务器(02):Ubuntu 初始化
新服务器到手后的 20 分钟:用户、SSH、防火墙、时区与基础安全项。
☰ 本文目录(3 节)
VPS 开通后的第一件事不是装软件,而是把「默认状态」清理干净。以下是我的初始化清单,全程约 20 分钟。
创建部署用户#
adduser deployusermod -aG sudo deploySSH 加固#
PermitRootLogin noPasswordAuthentication noPubkeyAuthentication yesPort 2222防火墙与基础工具#
sudo ufw allow 2222/tcpsudo ufw allow 443/tcpsudo ufw enablesudo apt install -y git htop curl unattended-upgradesUFW 默认拒绝入站。允许 443 之外按需开放,80 只用于证书验证与跳转。