跳到正文
English

从零搭建个人服务器(02):Ubuntu 初始化

新服务器到手后的 20 分钟:用户、SSH、防火墙、时区与基础安全项。

DigitalScope1 min

ubuntulinux

☰ 本文目录(3 节)

VPS 开通后的第一件事不是装软件,而是把「默认状态」清理干净。以下是我的初始化清单,全程约 20 分钟。

创建部署用户#

bash
adduser deployusermod -aG sudo deploy

SSH 加固#

bash · sshd_config
PermitRootLogin noPasswordAuthentication noPubkeyAuthentication yesPort 2222

防火墙与基础工具#

bash
sudo ufw allow 2222/tcpsudo ufw allow 443/tcpsudo ufw enablesudo apt install -y git htop curl unattended-upgrades

UFW 默认拒绝入站。允许 443 之外按需开放,80 只用于证书验证与跳转。