Getting started with Ubuntu Server on your VPS
Ubuntu is the most popular Linux distribution for VPS. First steps: connect via SSH, update packages, set up UFW firewall, create a user,
On this page
Ubuntu 24.04 LTS (Long Term Support) is the most widely used Linux distribution for VPS hosting. It has the largest community, the most tutorials, and excellent compatibility with control panels like aaPanel and HestiaCP. LTS releases are supported for 5 years.
Connect via SSH
ssh root@your-server-ip
Your root password (or SSH key) is in your VPS welcome email. If you have an SSH key, the connection will succeed without a password.
Update packages
apt update && apt upgrade -y
Ubuntu uses apt as its package manager. Run this immediately after provisioning and regularly thereafter.
Configure UFW firewall
# Install UFW (usually pre-installed)
apt install ufw -y
# Allow SSH first (before enabling, so you don't lock yourself out)
ufw allow ssh
ufw allow 80/tcp
ufw allow 443/tcp
# Enable firewall
ufw enable
# Check status
ufw status verbose
Always add the SSH rule before running ufw enable. If you enable UFW without allowing SSH first, you will lock yourself out of the server.
Create a non-root user
adduser deploy
usermod -aG sudo deploy
This creates a user named deploy with sudo access. SSH in as this user for day-to-day tasks and use sudo for commands that need root access.
Install LAMP stack
# Apache web server
apt install apache2 -y
# MySQL database
apt install mysql-server -y
# PHP and common extensions
apt install php php-mysql php-fpm php-gd php-xml php-mbstring php-curl -y
# Optional: Nginx instead of Apache
apt install nginx -y
Enable services to start at boot:
systemctl enable apache2 mysql
systemctl start apache2 mysql
Visit http://your-server-ip in a browser-you should see the Apache default page confirming the web server is running.
Related: Linux and Windows operating systems for VPS-which to choose | How to choose the right operating system for your VPS | Manage VPS | VPS firewall | Install aaPanel
Need a server with this OS?
Deploy Linux or Windows workloads on an UnderHost Cloud VPS or dedicated server with the operating system that fits your stack.





















