Theo's Corner
dev / irl / thoughts
← Back
tech

How I set up a new VPS from scratch

Theo|Jul 2026|~5 min read

Every time I spin up a new VPS the process is roughly the same. Here's the exact sequence I follow, from first SSH in to actually useful server.

Step 1 — Initial SSH and update

First thing after getting the server is SSH in as root and update everything:

apt update && apt upgrade -y

Don't skip this. You want the latest security patches before you do anything else.

Step 2 — Create a non-root user

Running everything as root is bad practice. Create a user, give it sudo, set up SSH key auth for it:

adduser theo
usermod -aG sudo theo
# Copy SSH key
rsync --archive --chown=theo:theo ~/.ssh /home/theo

Step 3 — Harden SSH

Edit /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes

Then restart SSH. Now only your key can get in and root login is disabled.

Step 4 — Firewall

ufw default deny incoming
ufw default allow outgoing
ufw allow 22
ufw allow 80
ufw allow 443
ufw enable
Always allow port 22 BEFORE enabling UFW. Locking yourself out of SSH on a remote server is a bad time.

Step 5 — Install Docker

curl -fsSL https://get.docker.com | sh
usermod -aG docker theo

Step 6 — nginx + Certbot

apt install nginx certbot python3-certbot-nginx -y

Set up a basic server block, point the domain DNS at the server, then run Certbot. Done — HTTPS, auto-renewing.

Step 7 — Add to SSH config locally

On my local machine, add an entry to ~/.ssh/config so I can just type ssh servername going forward. That's the last step and then the server is actually usable.

The whole process takes about twenty minutes once you've done it enough times. Most of it is just waiting for packages to install.