What is Ubuntu Server? A beginner’s guide to running one

What Ubuntu Server is, how it differs from Ubuntu Desktop, which release to pick and the first steps to set up and look after a new server safely.

6–10 minutes
Front panels of rack-mounted servers

Ubuntu Server is the edition of the Ubuntu Linux operating system built to run websites, databases and other services on a machine with no screen or desktop. This guide is for anyone who has just rented a VPSVPS A private slice of a powerful server, with its own guaranteed share of memory and processing and full control, at a fraction of the price of a whole machine. More about VPS →, been handed a server, or wants to know what Ubuntu Server is before choosing it.

Ubuntu Server is a free Linux operating system from Canonical, made for running services such as web serversWeb server The program that answers visitors’ browsers and sends them your website. Also used for the computer it runs on. More about Web server →, databases and mail. It has no graphical desktop: you manage it from the command line, usually over SSHSSH A secure way to type commands on a server from your own computer, as if you were sitting at it. More about SSH →. Pick an LTS (long term support) release such as 24.04 or 26.04, because each one gets five years of free security updates. On a new server, update it, create a sudo user, switch to SSH keys and turn on the firewallFirewall A gatekeeper that decides which connections are allowed into a server and blocks the rest. More about Firewall → before installing anything else.

What Ubuntu Server is

Ubuntu is a Linux distribution: the Linux kernel plus a set of tools, a package manager and a release schedule, all maintained together. Canonical, the company behind Ubuntu, publishes it in several editions. Ubuntu Server is the one designed for servers, the always-on computers that answer requests from browsers, apps and other machines.

You will find it in three common places:

  • Virtual servers and cloud instances. Most VPS and cloud providers offer an Ubuntu Server image you can choose when you create a machine. It boots in a minute or so and is ready to log in to.
  • Physical servers. You can download the installer and put it on your own hardware, from a rack server to an old office PC.
  • Small devices. There are Ubuntu Server images for the Raspberry Pi and other boards, handy for learning at home.

Once it is running, Ubuntu Server can host almost anything: a WordPress site behind Nginx, a MariaDB database, a mail server, a file share or your own app.

Ubuntu Server vs Ubuntu Desktop

Both editions share the same core and install software from the same package archive, so a command that works on one generally works on the other. The difference is what comes installed and how you use it.

Ubuntu ServerUbuntu Desktop
InterfaceCommand line onlyGraphical desktop with windows and mouse
How you use itRemotely, over SSHSitting in front of the screen
ResourcesLean, so more memory is left for your sitesDesktop uses a good share of RAM and CPU
InstallerText-based, asks about network, disks and SSHGraphical, aimed at personal computers
Typical jobWeb, database, mail and file serversEveryday computing and development

You can add a desktop to a server, but it is rarely worth it. It uses memory your sites could use, adds software that needs patching and gives attackers more to aim at. Learning a handful of commands is the better path.

Which Ubuntu Server release to choose

Ubuntu versions are numbered by year and month of release: 24.04 came out in April 2024. A new version appears every six months, but only the April release in even years is an LTS release.

Release typeExampleFree security updates
LTS22.04, 24.04, 26.045 years
Interim25.04, 25.10About 9 months

For a server, always choose an LTS release. Interim releases run out of updates quickly, which forces an upgrade every few months. At the time of writing, Canonical lists the end of standard support as May 2027 for 22.04, May 2029 for 24.04 and May 2031 for 26.04.

If you already have a server and are not sure what it runs, check the Ubuntu version with lsb_release -a.

Canonical also offers Ubuntu Pro, which extends security coverage of an LTS release beyond the five free years and covers more packages. It is free for personal use on a small number of machines. You do not need it for a new server on a current LTS release.

Your first steps on a new Ubuntu server

Most problems with new servers come from skipping the basics. Do these in order, right after the server is created. The examples use the user name exampleco and the address 203.0.113.10.

1. Log in over SSH

Your provider gives you an IP addressIP address The number address of a device on the internet, like 203.0.113.10. Computers use it to find each other, the way post uses street addresses. More about IP address → and either a root password or a place to add an SSH key. From your own computer, open a terminal and run:

ssh root@203.0.113.10

Some images use a default user such as ubuntu instead of root. If you are new to this, read how to connect to a server with SSH first, including the host key question you will see the first time.

2. Install updates

The image may be weeks old. Refresh the package list, then install everything that is waiting:

sudo apt update
sudo apt upgrade

apt update downloads the latest list of available packages; apt upgrade installs the newer versions. If the kernel was updated, the file /var/run/reboot-required exists and you should restart with sudo reboot.

3. Create your own user with sudo

Working as root all the time means one typo can damage the whole system. Create a normal user and give it the right to run admin commands with sudo:

adduser exampleco
usermod -aG sudo exampleco

Open a second terminal and check that ssh exampleco@203.0.113.10 works and that sudo whoami prints root before you close the first session.

4. Switch to SSH keys

Passwords can be guessed by bots that try thousands of combinations a day. An SSH key pair cannot. Follow how to set up SSH keys to copy your public key to the server, test a key login, then turn password logins off.

5. Turn on the firewall

Ubuntu Server comes with UFW (Uncomplicated Firewall) installed but switched off. Allow SSH first, then the web portsPort A numbered door on a server. Each service listens behind its own door: web pages on 443, email on others, remote login on 22. More about Port →, then enable it:

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

The guide to setting up a firewall on Linux explains each rule and how to avoid locking yourself out.

6. Set the hostname and time zone

A clear hostname helps you tell servers apart in your terminal and logs. Setting the time zone makes log times match your clock:

sudo hostnamectl set-hostname web1
sudo timedatectl set-timezone Europe/London
timedatectl

The last command should show your time zone and System clock synchronized: yes.

Installing software

Ubuntu installs software from its package archive with apt. Packages are tested for that release and receive security fixes for as long as the release is supported, which is why it is the best place to get software.

apt search nginx
sudo apt install nginx
systemctl status nginx

systemctl controls services: start, stop, restart, enable (start at boot) and status. When something will not start, read its log:

sudo journalctl -u nginx --since "1 hour ago"

For a full walk-through of serving a first site, see how to install Nginx on Ubuntu.

Ubuntu also supports snaps, self-contained packages installed with snap install. Some tools, such as Certbot for Let’s EncryptLet’s Encrypt A free, non-profit service that gives websites the certificate they need for the padlock, and renews it automatically. More about Let’s Encrypt → certificates, recommend the snap. Both kinds can live side by side.

Keeping an Ubuntu server healthy

A server is never finished. A few habits keep it safe and running.

  • Security updates. Ubuntu Server normally has unattended-upgrades installed and enabled, which applies security fixes daily. Check it and adjust it with how to turn on automatic security updates.
  • Disk space. A full disk stops databases and breaks sites. Check with df -h, and look for large logs in /var/log.
  • Memory. free -h shows used and available RAM. If available memory stays near zero, your plan may be too small.
  • Backups. Keep copies of site files and databases somewhere other than the server itself, and test that you can restore them.
  • Release upgrades. Before your LTS release reaches the end of support, move to the next LTS. On a server, the safest way is often to build a new server on the new release and move your sites across, keeping the old one as your way back. In-place upgrades use sudo do-release-upgrade, but take a full backup or snapshot first.

Never run do-release-upgrade on a production server without a tested backup. An upgrade changes default versions of PHP, MariaDB and other software, and sites can break if their code expects the older versions.

Common problems

SymptomCauseFix
Permission denied (publickey) when logging inPassword login is off and your key is not on the serverAdd your public key in the provider’s console or recovery mode, then try again
SSH times out after enabling UFWThe firewall was enabled before SSH was allowedUse the provider’s web console, run sudo ufw allow OpenSSH
Could not get lock /var/lib/dpkg/lock-frontendAutomatic updates are running in the backgroundWait a few minutes and run the command again
E: Unable to locate packageThe package list is out of date or the name is wrongRun sudo apt update, then check the name with apt search
Old release, no more updatesThe release has reached end of supportPlan a move to a current LTS release

Official documentation

Get the next guide

One email when there is something worth reading: new guides, errors going around, and hosting changes that affect your site.

No tracking pixels, and one click to leave.

Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.