HostingRanked
HomeBlogVPS

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_IP

Step 2: Update the System

apt update && apt upgrade -y

Step 3: Create a Non-Root User

adduser deploy
usermod -aG sudo deploy

Step 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 enable

Step 6: Install Nginx

apt install nginx -y
systemctl enable nginx
systemctl start nginx

Step 7: Install SSL Certificate

apt install certbot python3-certbot-nginx -y
certbot --nginx -d yourdomain.com

Certbot automatically configures HTTPS and sets up auto-renewal.

VPS setupUbuntu serverNginxLEMP stackserver configuration