Getting Started
A new server is a blank slate. The first hour of setup decides how painful the next year will be.
1. Pick a distribution
Use a long-term support release: Ubuntu 24.04 LTS or Debian 12. LTS releases get security updates for five years, and most tutorials target them, which matters at 2 a.m.
2. First login and updates
Log in as root once, update the package index, and install security updates before anything else:
apt update && apt full-upgrade -y
apt install -y curl git ufw fail2ban
3. Create a non-root user
Do daily work as a normal user with sudo. Disable password login for root once key authentication works:
adduser deploy
usermod -aG sudo deploy
mkdir -p /home/deploy/.ssh
cp ~/.ssh/authorized_keys /home/deploy/.ssh/
chown -R deploy:deploy /home/deploy/.ssh
4. Set the timezone and hostname
timedatectl set-timezone UTC
hostnamectl set-hostname myserver
UTC everywhere avoids an entire class of timestamp confusion. Convert to local time at display, never at storage.
5. Enable automatic security updates
On Ubuntu, unattended-upgrades installs security patches on its own. On Debian, the same package exists under the same name. Reboot-required kernels can wait for a maintenance window; the important part is that patches land without you remembering.