How to Set Up an Ubuntu VPS Server: A Complete Step by step Guide
Setting up an Ubuntu VPS server is a practical way to host websites, applications, databases, and other online services with greater control over your hosting environment. Unlike traditional shared hosting, a VPS gives you dedicated virtual resources, root access, and the flexibility to configure your server according to your requirements.
Whether you are a beginner, developer, or business owner, this guide explains how to set up an Ubuntu VPS server, connect through SSH, configure essential security settings, and prepare your server for hosting applications.
What Is an Ubuntu VPS Server?
An Ubuntu VPS (Virtual Private Server) is a virtualized server running the Ubuntu Linux operating system. It provides allocated computing resources, including CPU, RAM, storage, and network access, within a virtual server environment.
An Ubuntu VPS is commonly used for:
- Hosting websites and WordPress installations.
- Running web applications and APIs.
- Deploying Docker containers.
- Hosting databases and development environments.
- Running automation tools and self-hosted applications.
- Managing custom server configurations.
With a VPS, you can install the software you need and manage your server through a command-line interface.
What You Need Before Setting Up a VPS
Before beginning the installation, make sure you have the following:
| Requirement | Description |
|---|---|
| VPS server | A VPS with Ubuntu installed or an Ubuntu installation option |
| Operating system | Ubuntu 24.04 LTS is used in this guide |
| Root or sudo access | Required for administrative commands |
| Server IP address | The public IPv4 address of your VPS |
| SSH client | OpenSSH, Windows Terminal, or another SSH application |
| Secure password or SSH key | Required for authenticated server access |
Choosing the Right VPS Resources
Your resource requirements depend on what you plan to host.
- Basic website: A small VPS may be sufficient for a low-traffic website.
- WordPress website: Consider additional RAM and CPU resources for plugins, traffic, and caching.
- Docker applications: Resources depend on the number and type of containers.
- Databases and business applications: Choose resources according to database size, concurrent users, and workload.
DigitalBerg offers VPS hosting solutions that can be evaluated according to your application’s CPU, RAM, storage, and scalability requirements.
Step 1: Choose an Ubuntu VPS Hosting Plan
The first step is to select a VPS plan that matches your intended workload.
When comparing VPS hosting options, consider:
- CPU and RAM allocation.
- SSD or NVMe storage availability.
- Operating system support.
- Root access and server management options.
- Network performance and bandwidth.
- Upgrade and scalability options.
- Backup and security features.
For a new website or learning environment, start with a suitable entry-level configuration. For resource-intensive applications, select a plan with enough capacity for both current usage and expected growth.
Once your VPS is provisioned, you should receive the server’s IP address and login credentials.
Step 2: Connect to Your Ubuntu VPS Using SSH
SSH, or Secure Shell, allows you to securely access and manage a remote Linux server through a terminal.
Connect from Windows
Windows 10 and Windows 11 commonly include OpenSSH through Windows Terminal or PowerShell.
Open Windows Terminal or PowerShell and run:
ssh root@YOUR_SERVER_IP
Replace YOUR_SERVER_IP with the public IP address of your VPS.
For example:
ssh [email protected]
The IP address above is an example and should not be used as your actual server address.
If your server uses a different username, replace root with that username.
Connect from Linux or macOS
Open your terminal and run the same SSH command:
ssh root@YOUR_SERVER_IP
When prompted, enter your server password. If you are using SSH key authentication, your configured key will be used instead.
Security note: Never share your VPS password or private SSH key with anyone.
Step 3: Update Ubuntu Packages
After connecting to your server, update the package information and install available updates.
Run:
sudo apt update && sudo apt upgrade -y
If you are logged in as root, you can also run:
apt update && apt upgrade -y
This updates the package index and upgrades installed packages.
After the process completes, you can check the Ubuntu version:
lsb_release -a
You can also check the Linux kernel version:
uname -r
Keeping your operating system updated is an important part of server maintenance.
Step 4: Create a Non-Root User
Although root access is useful for initial configuration, it is generally better to perform routine administration using a non-root user with sudo privileges.
Create a new user:
adduser deploy
Replace deploy with your preferred username.
Follow the prompts to create a password and user details.
Next, add the user to the sudo group:
usermod -aG sudo deploy
You can verify the user’s groups with:
groups deploy
The new user should now be able to run administrative commands using sudo.
To switch to the new user:
su - deploy
You can return to the previous shell by running:
exit
Step 5: Configure SSH Key Authentication
SSH keys provide an alternative to password-based authentication. They consist of a private key stored securely on your device and a public key installed on the server.
Generate an SSH Key on Your Computer
On a Linux, macOS, or Windows system with OpenSSH, run:
ssh-keygen -t ed25519
Follow the prompts to save the key and optionally protect it with a passphrase.
Copy the Public Key to the VPS
If supported by your environment, use:
ssh-copy-id deploy@YOUR_SERVER_IP
Alternatively, add the contents of your public key file to:
/home/deploy/.ssh/authorized_keys
Make sure the .ssh directory and authorized_keys file have appropriate ownership and permissions.
After installing the key, test the connection in a new terminal:
ssh deploy@YOUR_SERVER_IP
Do not disable password authentication until you have confirmed that key-based login works correctly.
Step 6: Configure the Ubuntu Firewall
Ubuntu commonly uses UFW (Uncomplicated Firewall) as a convenient interface for managing firewall rules.
Before enabling the firewall, allow SSH access:
sudo ufw allow OpenSSH
If you use a custom SSH port, allow that port instead.
For a web server, allow HTTP and HTTPS:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Check the firewall rules:
sudo ufw status verbose
Enable UFW:
sudo ufw enable
Confirm the status:
sudo ufw status
Important: Always allow your SSH access method before enabling the firewall. Incorrect firewall rules can prevent you from connecting to your VPS.
Only open the ports required by your applications. Avoid exposing databases, administration panels, or other services publicly unless necessary and properly secured.
Step 7: Install Essential Server Utilities
A few basic utilities can make server administration easier.
Run:
sudo apt install -y curl wget unzip git vim htop
These packages provide tools for downloading files, managing archives, working with repositories, editing configuration files, and monitoring system resources.
You can check running processes and resource usage with:
htop
Press q to exit the monitoring interface.
Step 8: Check CPU, RAM, and Disk Usage
Before deploying an application, review the available resources.
Check Memory Usage
free -h
Check Disk Space
df -h
Check CPU Information
lscpu
Check System Uptime
uptime
These commands help you understand the current state of your VPS and identify potential resource limitations.
Step 9: Set the Server Hostname
A meaningful hostname can help you identify your server when managing multiple machines.
Set a hostname using:
sudo hostnamectl set-hostname app-server
Replace app-server with your preferred hostname.
Verify the hostname:
hostnamectl
Use a consistent naming convention if you manage several VPS instances, such as web-server, db-server, or staging-server.
Step 10: Configure the Time Zone
Correct time settings are important for logs, scheduled tasks, monitoring, and application operations.
Check the current time zone:
timedatectl
To view available time zones:
timedatectl list-timezones
Set your preferred time zone. For example:
sudo timedatectl set-timezone Europe/London
Replace the example time zone with the one appropriate for your server or application requirements.
Step 11: Install Nginx for Website Hosting
If you plan to host a website, Nginx is a popular web server that can handle HTTP requests and serve website files.
Install Nginx:
sudo apt update
sudo apt install -y nginx
Check its status:
sudo systemctl status nginx
If Nginx is running, open your VPS IP address in a web browser:
http://YOUR_SERVER_IP
You should see the default Nginx welcome page.
You can also check whether the service is enabled to start automatically:
sudo systemctl is-enabled nginx
For more information, see our related guide: How to Install Nginx on Ubuntu VPS.
Step 12: Point Your Domain Name to the VPS
To host a website using your domain, you need to configure DNS records with your domain provider.
The most common setup includes:
| Record | Purpose |
|---|---|
| A | Points a domain or subdomain to an IPv4 address |
| AAAA | Points a domain or subdomain to an IPv6 address |
| CNAME | Creates an alias for another hostname |
For example, you may create an A record for:
example.com
and point it to:
YOUR_SERVER_IP
DNS changes may take time to propagate. The exact timing depends on DNS caching and TTL settings.
For a complete guide, see: How to Point a Domain Name to a VPS.
Step 13: Secure Your Website with HTTPS
HTTPS encrypts traffic between visitors and your website. For websites hosted on Nginx, Let’s Encrypt can provide SSL/TLS certificates through Certbot.
Install Certbot and the Nginx plugin:
sudo apt update
sudo apt install -y certbot python3-certbot-nginx
Before requesting a certificate, ensure that:
- Your domain points to the correct VPS IP address.
- Nginx is running.
- Your website configuration is correct.
- Port 80 is accessible for the certificate validation method you intend to use.
Request a certificate:
sudo certbot --nginx -d example.com
Replace example.com with your actual domain.
Certbot may update the Nginx configuration to enable HTTPS. Review the proposed changes and follow the prompts.
Check certificate renewal status:
sudo certbot renew --dry-run
Always verify that your certificate renewal process works before relying on it for a production website.
Step 14: Configure Basic Server Monitoring
Monitoring helps you identify resource usage, service failures, and unusual activity.
Useful commands include:
top
free -h
df -h
To check the status of a service:
sudo systemctl status nginx
To view recent system logs:
journalctl -p warning -b
For production workloads, consider a suitable monitoring and alerting solution that can notify you when CPU, memory, disk, or service health crosses an important threshold.
Step 15: Prepare Your VPS for Application Deployment
Once the operating system, SSH access, firewall, and basic services are configured, your VPS is ready for further setup.
Depending on your project, you can install:
- Docker and Docker Compose.
- WordPress and a database.
- Node.js applications.
- Python applications.
- MySQL or PostgreSQL.
- Control panels such as cPanel or Plesk, where supported.
- Self-hosted applications such as n8n.
For example, Docker can help you package applications and their dependencies into containers, making deployment and management more consistent.
Related tutorials to explore:
- How to Install Docker on Ubuntu VPS.
- How to Install Docker Compose on Ubuntu 24.04.
- How to Host a Website on a VPS.
- How to Install WordPress on a VPS.
Common Ubuntu VPS Setup Problems and Solutions
1. SSH Connection Refused
If SSH returns a connection refused error, check:
- Whether the VPS is running.
- Whether the SSH service is active.
- Whether the correct IP address and port are being used.
- Whether the firewall permits SSH traffic.
Check the SSH service:
sudo systemctl status ssh
2. Permission Denied When Running Commands
Some commands require administrative privileges. Try using sudo with the command, provided your user has the necessary permissions.
For example:
sudo apt update
Do not use sudo as a way to bypass permissions without understanding what the command does.
3. Website Not Loading
If your website does not load, check:
- Whether Nginx or Apache is running.
- Whether DNS points to the correct server.
- Whether ports 80 and 443 are allowed.
- Whether the website configuration contains errors.
For Nginx, test the configuration:
sudo nginx -t
4. Insufficient Disk Space
Check disk usage:
df -h
Review large directories and application logs before deleting anything. Avoid removing system files or application data without confirming their purpose.
5. VPS Running Slowly
High resource usage may result from demanding applications, insufficient resources, background processes, or inefficient configurations.
Check CPU and memory usage:
htop
free -h
Review application logs and consider optimizing the workload or upgrading the VPS resources when necessary.
Ubuntu VPS Setup FAQ
Is Ubuntu good for VPS hosting?
Ubuntu is a widely used Linux distribution for VPS hosting. It supports many popular web servers, databases, development tools, and self-hosted applications.
Can I host a website on an Ubuntu VPS?
Yes. You can install a web server such as Nginx or Apache, configure your domain, and deploy your website files or application.
Do I need Linux experience to set up a VPS?
Basic Linux knowledge is helpful, but beginners can learn VPS administration by following a structured guide and understanding each command before running it.
How much RAM do I need for an Ubuntu VPS?
The required RAM depends on your workload. A simple website may need fewer resources than a database-driven application, multiple Docker containers, or an AI application.
Is a VPS better than shared hosting?
A VPS provides more control and configurable resources than typical shared hosting. However, it also requires more administration and security responsibility. The right option depends on your website, budget, technical requirements, and management preferences.
How do I secure an Ubuntu VPS?
Start with system updates, SSH key authentication, a non-root administrative user, a properly configured firewall, strong access controls, and regular monitoring and backups.
Conclusion
Setting up an Ubuntu VPS server involves more than installing an operating system. You also need to configure secure access, update packages, manage firewall rules, monitor resources, and prepare the server for your intended applications.
By following the steps in this guide, you can establish a practical foundation for hosting websites, applications, and development environments on Ubuntu.
If you are looking for a flexible hosting environment with configurable resources and the ability to deploy your own software, explore DigitalBerg VPS Hosting and choose a server configuration that matches your requirements.
Related DigitalBerg Tutorials
- How to Connect to a VPS Using SSH.
- How to Secure a New VPS Server.
- How to Configure UFW Firewall on Ubuntu.
- How to Install Docker on Ubuntu VPS.
- How to Install Nginx on Ubuntu.
- How to Host a Website on a VPS.
- How to Point a Domain Name to a VPS.
-







Leave a Reply
Want to join the discussion?Feel free to contribute!