F
FromTune
ArticlesTutorialsAboutContact
How to Set Up a VPS: A Step‑by‑Step Tutorial
TutorialFeatured

How to Set Up a VPS: A Step‑by‑Step Tutorial

Learn how to choose, provision, secure, and configure a Virtual Private Server (VPS) from scratch with this comprehensive, beginner‑friendly guide.

Anonymous
2/16/2026
VPStutorialsetupservercloudLinux

Setting up a Virtual Private Server (VPS) can feel daunting if you’ve never done it before, but with the right guidance it’s a straightforward process. This tutorial walks you through every stage—from picking a provider to securing your new server—so you can have a fully functional VPS up and running in under an hour.


Table of Contents

  1. Choose a VPS Provider & Plan
  2. Create and Access Your VPS
  3. Initial Server Configuration
  4. Secure Your VPS
  5. Set Up a Basic Web Stack (Optional)
  6. Useful Post‑Setup Tips

1. Choose a VPS Provider & Plan

ProviderStarting Price (USD/mo)OS OptionsNotable Features
DigitalOcean$4Ubuntu, CentOS, Debian, FedoraSimple UI, 1‑click apps
Linode$5Ubuntu, Debian, Arch, AlmaLinuxHigh‑performance SSD
Vultr$2.5Ubuntu, CentOS, Rocky LinuxGlobal data‑centers
Hetzner (Germany)€3Ubuntu, Debian, FedoraExcellent price‑to‑performance

What to look for:

  • CPU & RAM: For a basic web server, 1 vCPU + 1 GB RAM is enough. Scale up as needed.
  • SSD storage: Faster I/O for databases and web traffic.
  • Data‑center location: Choose a region close to your target audience for lower latency.
  • Backup options: Some providers offer automated snapshots—useful for disaster recovery.

Selecting an OS

For beginners, Ubuntu LTS (e.g., 22.04) is the most user‑friendly due to its large community and extensive documentation.


2. Create and Access Your VPS

  1. Sign up for your chosen provider and verify your email.
  2. Create a new droplet/instance:
    • Choose the OS (Ubuntu 22.04 LTS recommended).
    • Select the plan you identified earlier.
    • Pick a data‑center region.
    • (Optional) Add SSH keys now—this is the most secure way to log in.
F
FromTune

Empowering developers with cutting-edge insights and practical tutorials for modern web development.

Content

  • Articles
  • Tutorials
  • Guides
  • Resources

Categories

  • React & Next.js
  • TypeScript
  • AI & ML
  • Performance

Connect

  • About
  • Contact
  • Newsletter
  • RSS Feed

© 2025 FromTune. All rights reserved.

Privacy PolicyTerms of Service
  • Launch the instance. You’ll receive an IP address (e.g., 203.0.113.45).
  • Connect via SSH:
    ssh root@203.0.113.45
    • If you didn’t add an SSH key during creation, the provider will email a temporary password. Log in, then immediately change the password with passwd.
  • Tip: Use a terminal emulator like iTerm2 (macOS) or PuTTY (Windows) if you’re on a desktop.


    3. Initial Server Configuration

    3.1 Update the System

    apt update && apt upgrade -y

    This ensures you have the latest security patches.

    3.2 Create a Non‑Root User

    Running everything as root is risky. Create a regular user and grant sudo privileges.

    adduser alice # replace "alice" with your preferred username usermod -aG sudo alice

    Test sudo:

    su - alice sudo whoami # should output "root"

    3.3 Harden SSH

    Edit /etc/ssh/sshd_config:

    nano /etc/ssh/sshd_config

    Change or add the following lines:

    Port 2222               # optional: move away from default 22
    PermitRootLogin no
    PasswordAuthentication no   # if you use SSH keys only
    

    Restart SSH:

    systemctl restart sshd

    Now you’ll connect with:

    ssh -p 2222 alice@203.0.113.45

    4. Secure Your VPS

    4.1 Install a Firewall (UFW)

    apt install ufw -y ufw default deny incoming ufw default allow outgoing ufw allow 2222/tcp # SSH port you set ufw allow http ufw allow https ufw enable

    4.2 Enable Fail2Ban

    apt install fail2ban -y systemctl enable fail2ban

    Fail2Ban will block repeated failed login attempts.

    4.3 Set Up Automatic Updates (Optional but recommended)

    apt install unattended-upgrades -y dpkg-reconfigure --priority=low unattended-upgrades

    5. Set Up a Basic Web Stack (Optional)

    If you plan to host a website, the classic LAMP (Linux‑Apache‑MySQL‑PHP) or LEMP (Linux‑Nginx‑MySQL‑PHP) stack works well.

    Example: LEMP Stack on Ubuntu

    # Install Nginx apt install nginx -y # Install MySQL (or MariaDB) apt install mariadb-server -y # Secure MySQL installation mysql_secure_installation # Install PHP and extensions apt install php-fpm php-mysql -y # Configure Nginx to use PHP cat > /etc/nginx/sites-available/example.com <<'EOF' server { listen 80; server_name example.com www.example.com; root /var/www/html; index index.php index.html index.htm; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; } } EOF ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/ nginx -t && systemctl reload nginx

    Place your site files in /var/www/html and you’re live.


    6. Useful Post‑Setup Tips

    • Backups: Set up regular snapshots (most providers have an API/CLI for this).
    • Monitoring: Tools like htop, netdata, or external services (UptimeRobot, Pingdom) help you keep an eye on performance.
    • Documentation: Keep a simple markdown file on the server (~/setup_notes.md) with commands you ran—great for future reference or rebuilding.
    • Domain & DNS: Point your domain’s A record to the VPS IP, then configure a virtual host in Nginx/Apache.
    • SSL/TLS: Use Let’s Encrypt for free HTTPS certificates:
      apt install certbot python3-certbot-nginx -y certbot --nginx -d example.com -d www.example.com

    Conclusion

    Setting up a VPS is a valuable skill for developers, sysadmins, and hobbyists alike. By following this tutorial you’ve:

    1. Chosen a provider and launched a server.
    2. Secured SSH and the firewall.
    3. Created a non‑root user with sudo rights.
    4. (Optionally) Deployed a basic web stack.
    5. Implemented essential security measures.

    From here you can expand—install Docker, run a Git server, host a game server, or anything else your project demands. Happy hosting!