Home · Help · Setting up a Debian server
Setting up a Debian server: apt, updates and firewall
Debian is the most stable of the major systems: few changes, long maintenance, a very large package selection. This guide applies to Debian 13 (Trixie) on a Debian server.
What is installed
- systemd with journald for services and logs.
- systemd-networkd for the network. The address is set during setup.
- apt with the package sources
mainandcontrib, plustrixie-updatesandtrixie-security. - sudo. OpenSSH for logging in is added when the server is set up.
cron, a classic logging daemon and a firewall are not installed. The steps below set them up if needed. These details apply to the container. A vServer with KVM starts from the official cloud image of Debian 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
Scheduled jobs run with systemd timers or with cron after apt install cron. journalctl shows the logs. If you need text files under /var/log, install rsyslog.
Releases and upgrades
Debian 13 receives security updates until 2030, Debian 12 until 2028. A change of the major version 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
- Debian or Ubuntu?
- Both use apt and the same way of working. Debian changes little and stays the same for a long time. Ubuntu ships newer program versions, and many guides on the web assume it.
See also: First steps on your vServer Setting up an Ubuntu server Setting up a Devuan server without systemd