Skip to content
glowfish

Home · Help · Setting up an Ubuntu server

Setting up an Ubuntu server: apt, updates and firewall

Ubuntu is the most widely used server distribution. Almost every guide on the web has an Ubuntu version. This guide applies to Ubuntu 26.04 LTS on an Ubuntu server, the commands also fit 24.04 and 22.04.

What is installed

  • systemd with journald, plus rsyslog for logs under /var/log.
  • cron for scheduled jobs.
  • Netplan for the network. The settings are in /etc/netplan, the address is set during setup.
  • sudo. OpenSSH for logging in is added when the server is set up.

ufw and unattended-upgrades are not installed. Snap is not included in the container image either. Most programs are available as apt packages. These details apply to the container. A vServer with KVM starts from the official cloud image of Ubuntu and is set up with cloud-init at first boot. The package selection there can be slightly larger.

1. Updating

apt update && apt full-upgrade

2. Automatic security updates

The package unattended-upgrades installs security updates daily by itself:

apt install unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades

3. Setting up a firewall

apt install ufw
ufw allow 22/tcp
ufw enable
ufw status

Allow the SSH port first, then switch the firewall on. If SSH runs on a port other than 22, enter that port. If you still lock yourself out, the console in the customer portal helps.

4. Services, logs and cron

systemctl status nginx
systemctl enable --now nginx
journalctl -u nginx -e

cron is already running, crontab -e adds your own jobs. Logs are shown by journalctl and the files under /var/log.

Network settings

Netplan reads the files in /etc/netplan and applies them at boot. After a change, netplan try tests the new setting and reverts it if the connection drops. Do not change the configured main address.

Releases and upgrades

Every two years in April an LTS release appears with five years of security updates. A change to another release is done by reinstalling in the customer portal. Data can be saved beforehand with the Rettungsverzeichnis, see Reinstalling a server without losing data.

Frequently asked questions

How long is Ubuntu 26.04 LTS maintained?
Five years of security updates from its release in April 2026, so until 2031.

See also: First steps on your vServer Setting up a Debian server Setting up a WireGuard server

View Ubuntu servers