NodexVPS
Deploy VPS
Back to All Guides
Getting Started15 min read•Updated 2026-11-09

Ubuntu VPS Setup Guide

Take a new Ubuntu server from first login to a secure, ready-to-use system, with every command explained.

A new Ubuntu server works straight away, but it is exposed to the internet with only a root password protecting it. This guide closes that gap in about 20 minutes.

You will finish with an up-to-date system, a personal admin account, key-only SSH, a firewall and automatic security patches.

  • Works on: Ubuntu 26.04, 24.04 and 22.04 LTS
  • Minimum server: 1 GB of RAM, 2 GB recommended
  • You will need: an SSH client and the root password we email you
1

Choose your Ubuntu release

Order from the Ubuntu VPS page and pick a release at checkout. For most servers, 24.04 LTS is the safest choice because almost all third-party software supports it. Choose 26.04 LTS for a new project if your software already works on it.

We email the root password as soon as the server is ready. Keep that email until you have finished this guide.

2

Log in and confirm your system

Connect from a terminal on your computer. The first connection asks you to confirm the server's fingerprint, so answer yes. Then check the release you are running.

ssh root@YOUR_SERVER_IP

lsb_release -a
uname -r
3

Install every available update

Your server image may be a few weeks old, so install updates before anything else. If the kernel was updated, reboot and log in again.

apt update && apt upgrade -y

# only if this file exists
ls /var/run/reboot-required && reboot
4

Create your own admin user

Daily work should not happen as root. Create a named account and give it sudo rights. The name deploy is only an example.

adduser deploy
usermod -aG sudo deploy
5

Set up SSH key login

SSH keys cannot be guessed the way passwords can. Run these on your own computer, not on the server. Skip the first line if you already have a key.

Check that you can log in with the key before moving on to the next step.

ssh-keygen -t ed25519
ssh-copy-id deploy@YOUR_SERVER_IP
ssh deploy@YOUR_SERVER_IP
6

Lock down SSH

On Ubuntu, files in sshd_config.d override the main configuration, so a small file keeps your change clear and survives package updates. Test the configuration before restarting.

Keep your current session open and test a new login in a second terminal. If it fails, you can still fix the file.

sudo tee /etc/ssh/sshd_config.d/10-hardening.conf > /dev/null <<'EOF'
PermitRootLogin no
PasswordAuthentication no
EOF

sudo sshd -t && sudo systemctl restart ssh
7

Turn on the UFW firewall

UFW is included with Ubuntu but is off until you enable it. Always allow SSH first. Add web ports only if you are running a website.

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verbose
8

Confirm automatic security updates

Ubuntu uses unattended-upgrades to apply security fixes for you. Check that it is enabled, and turn it on if not.

sudo systemctl status unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
9

Decide what comes next

Your base system is finished. Common next steps on Ubuntu:

  1. Web server: sudo apt install nginx
  2. Containers: follow Docker's official instructions for Ubuntu
  3. Backups: copy important data to storage outside this server, and test a restore

Get a server for this guide

Ubuntu Server plans run everything in this guide, from $10.99/mo.

See Ubuntu Server plans

Ubuntu VPS Setup Guide: Frequently Asked Questions

Quick answers to common questions.

What should I do first after logging in to a new Ubuntu VPS?

Install every available update first with apt update && apt upgrade -y, because the server image may be a few weeks old. If /var/run/reboot-required exists afterwards, the kernel was updated, so reboot and log in again. Then create your own admin user, set up SSH keys, lock down SSH and turn on the firewall.

How do I create a sudo user on an Ubuntu VPS?

Log in as root and run adduser deploy to create the account, then usermod -aG sudo deploy to give it sudo rights. The name deploy is only an example. Use this account for daily work instead of root, and run admin commands with sudo, which asks for the user's own password.

How do I set up SSH key login for an Ubuntu server?

On your own computer, run ssh-keygen -t ed25519 to create a key, then ssh-copy-id deploy@SERVER_ADDRESS to copy it to the Ubuntu server. Log in with ssh deploy@SERVER_ADDRESS to confirm the key works. Skip the first step if you already have a key, and test the key login before you disable passwords.

Why put SSH hardening in sshd_config.d on Ubuntu?

On Ubuntu, files in /etc/ssh/sshd_config.d override the main SSH configuration, so a small file such as 10-hardening.conf with PermitRootLogin no and PasswordAuthentication no keeps your change clear and survives package updates. Test it with sudo sshd -t before running sudo systemctl restart ssh, and keep your current session open while you test a new login.

How do I check that automatic security updates are on in Ubuntu?

Run sudo systemctl status unattended-upgrades to see whether the service is active. If it is not enabled, run sudo dpkg-reconfigure -plow unattended-upgrades and answer yes. Ubuntu then installs security fixes on its own, so your server stays patched between the times you log in.

Should I choose Ubuntu 24.04 or 26.04 for a new VPS?

For most servers, Ubuntu 24.04 LTS is the safest choice because almost all third-party software supports it. Choose Ubuntu 26.04 LTS for a new project if your software already works on it. You pick the release at checkout on the Ubuntu VPS page, and the setup steps in this guide are the same for both.

How do I know if my Ubuntu server needs a reboot after updates?

Check whether the file /var/run/reboot-required exists, for example with ls /var/run/reboot-required. Ubuntu creates it when an update, usually a new kernel, only takes effect after a restart. If it is there, reboot, log in again and run uname -r to confirm the new kernel is running.

Start Your NodexVPS Today

Save 50% with yearly billing.