How to Set Up a VPS from Scratch: The Complete Beginner Guide
Super AdminJune 11, 202612 min read
What You Need
- A VPS running Ubuntu 22.04 LTS
- An SSH client
- About 60-90 minutes
Step 1: Connect via SSH
ssh root@YOUR_SERVER_IPStep 2: Update the System
apt update && apt upgrade -yStep 3: Create a Non-Root User
adduser deploy
usermod -aG sudo deployStep 4: Set Up SSH Key Authentication
Generate an SSH key pair and copy your public key to the server. Then disable password login to block brute-force attacks.
Step 5: Configure the Firewall
ufw allow OpenSSH
ufw allow 80
ufw allow 443
ufw enableStep 6: Install Nginx
apt install nginx -y
systemctl enable nginx
systemctl start nginxStep 7: Install SSL Certificate
apt install certbot python3-certbot-nginx -y
certbot --nginx -d yourdomain.comCertbot automatically configures HTTPS and sets up auto-renewal.
VPS setupUbuntu serverNginxLEMP stackserver configuration