Ubuntu is the most popular Linux distribution for VPS hosting and it is not even close. Roughly 40 percent of all Linux servers on the internet run some version of Ubuntu, and there are good reasons for that. The package manager is straightforward, the community support is massive, and nearly every tutorial or guide you find online assumes you are running Ubuntu.
But choosing Ubuntu is just the first step. Setting it up properly on a VPS determines whether you end up with a fast, secure server or a vulnerable mess that gets compromised within weeks. This guide walks through the entire process from the moment you provision your VPS to having a production ready Ubuntu server.
Ubuntu Server vs Ubuntu Desktop on a VPS
This is the first decision most people get wrong. Ubuntu Desktop includes a full graphical interface that wastes 500MB to 1GB of RAM. On a VPS where every megabyte costs money, running a desktop environment is like paying rent on rooms you never enter.
Ubuntu Server ships without a graphical interface. Everything happens through the command line. It boots faster, uses less RAM, and has a smaller attack surface. For a VPS, Ubuntu Server is almost always the right choice. If you need GUI applications, install a lightweight desktop like XFCE on top of Ubuntu Server rather than using the full Desktop edition.
Choosing the Right Ubuntu Version
Ubuntu releases a new version every six months, but the ones that matter for servers are the LTS (Long Term Support) releases. LTS versions come out every two years and receive security updates for five years.
The current LTS release is Ubuntu 24.04, codenamed Noble Numbat. This is what you should install on a production VPS. Non-LTS releases like 24.10 or 25.04 get security updates for only nine months. Unless you have a specific reason to run a non-LTS version, stick with 24.04 LTS.
Initial Server Setup After Provisioning
The moment your VPS is provisioned, you receive an IP address and root credentials. The first 15 minutes of setup are the most important because your server is at its most vulnerable right now. Automated bots scan the internet constantly for new servers with default configurations, and they will find yours within hours.
Log In and Update Everything
Connect to your server using SSH:
On Windows, use PowerShell's built-in OpenSSH client or PuTTY. The first command you run should update everything:
If the kernel was updated, reboot the server:
Create a Non-Root User
Running everything as root is dangerous. One wrong command and you can destroy your entire system. Create a regular user with sudo privileges:
Set a strong password when prompted. Log out and log back in as your new user to verify:
Set Up SSH Key Authentication
Password authentication is the weakest link in server security. Bots try thousands of password combinations per hour. Key-based authentication eliminates this attack vector entirely.
On your local machine, generate an SSH key pair:
Copy the public key to your server:
Test logging in without a password. If it works, disable password authentication:
Find and change these settings:
Restart SSH to apply:
Important: keep your current SSH session open while testing a new connection in a separate terminal. If something is misconfigured, you will not be locked out of your existing session.
Configure the Firewall
Ubuntu comes with UFW (Uncomplicated Firewall). By default it is disabled, meaning all ports are open. Fix that immediately:
Only allow the ports you actually need. For a web server:
The fewer open ports, the smaller your attack surface. Do not open database ports (3306, 5432) to the internet unless you have a specific reason.
Change the Default SSH Port (Optional)
Moving SSH from port 22 to a random high port eliminates 99 percent of automated brute force attempts:
Essential Software for an Ubuntu VPS
Web Server: Nginx or Apache
For most new projects, Nginx is the better choice. It handles static files faster, uses less memory, and works as a reverse proxy:
Verify it is running by visiting your server's IP in a browser. You should see the Nginx welcome page. Configuration files live in /etc/nginx/:
Database: MySQL or PostgreSQL
Install your database and run the security hardening script:
Create a dedicated database user for your application instead of using root:
SSL Certificates with Certbot
Every website needs HTTPS. Certbot provides free SSL certificates and automates the entire process:
Certbot automatically configures Nginx, obtains the certificate, and sets up auto-renewal. Verify auto-renewal works:
Performance Tuning for Ubuntu VPS
Swap Space
If your VPS has limited RAM, swap space prevents crashes when memory runs out:
File Descriptor Limits
The default limit of 1024 open files is too low for busy servers:
Kernel Network Parameters
Tune the network stack for better performance under load:
Automated Backups
Set up your own backup system that copies critical data to an external location:
Monitoring Your Ubuntu VPS
A server without monitoring is a server waiting to surprise you. Install basic monitoring tools:
For ongoing monitoring, install Netdata for a web dashboard with zero configuration:
Netdata runs on port 19999 and provides real-time graphs of CPU, RAM, disk, network, and hundreds of other metrics. Restrict access to your IP only:
Automatic Security Updates
Configure unattended upgrades to automatically install security patches:
Verify the configuration:
This ensures your server receives critical security patches automatically without manual intervention. The system only installs security updates, not feature updates, so it will not break your applications.
Install Fail2Ban
Protect against brute force attacks on SSH and other services:
Configure the SSH jail:
Quick Reference: Essential Commands
Commands you will use regularly when managing your Ubuntu VPS:
BlastVPS offers Ubuntu VPS hosting with NVMe storage, full root access, and one-click Ubuntu deployment. Get your server running in minutes with the performance and reliability your projects need.
Ready to Deploy?
Get a high performance VPS with instant setup, full root access, and 24/7 support.