Management Guides Getting started
VPS Management: A Practical Guide to Running a Linux VPS
The jobs that keep a Linux VPS healthy: access, firewall, updates, monitoring, backups and housekeeping, with commands for Ubuntu, Debian, AlmaLinux and Rocky Linux and a check for each step.
Managing a VPS means doing a small set of jobs on a schedule: keep it patched, keep attackers out, know when something is wrong, be able to restore it, and keep it from filling up. None of the jobs is difficult. Servers get into trouble when a job is skipped for months.
This guide walks through those jobs in the order you meet them, with the commands for the two main Linux families. Use it as a map: each section ends with a way to check that the job is done.
Commands are given for Ubuntu 26.04/24.04 and Debian 13 (apt) and for AlmaLinux and Rocky Linux 9 and 10 (dnf). They are standard tools from each distribution; this guide is a reference and was not benchmarked on a test server.
What you are responsible for
On an unmanaged VPS the provider keeps the hardware, network and hypervisor running. Everything inside the virtual machine is yours:
| Job | How often | What goes wrong if you skip it |
|---|---|---|
| Security updates | Daily, automated | Known flaws stay open; most mass attacks use old bugs |
| Access control (SSH, firewall) | Once, then on every change | Password guessing, exposed databases and admin ports |
| Monitoring | Continuous, automated | You learn about an outage from a visitor |
| Backups and restore tests | Daily backup, restore test every few months | One mistake or one provider failure loses everything |
| Disk, memory and log housekeeping | Weekly look, alerts in between | Full disk, out-of-memory kills, a database that will not start |
| Release upgrades | Every few years | An operating system that no longer gets security fixes |
If that list looks like more than you want to own, read Managed vs Unmanaged VPS before going further.
1. First hour: lock down access
A new VPS is scanned within minutes of going online. Do these four things before installing anything else.
Update the system.
# Ubuntu, Debian
sudo apt update && sudo apt full-upgrade
# AlmaLinux, Rocky Linux
sudo dnf upgrade
Create your own user with sudo rights so that you stop logging in as root.
# Ubuntu, Debian
adduser deploy
usermod -aG sudo deploy
# AlmaLinux, Rocky Linux
adduser deploy
passwd deploy
usermod -aG wheel deploy
Log in with an SSH key. On your own computer:
ssh-keygen -t ed25519
ssh-copy-id deploy@YOUR_SERVER_IP
Open a second terminal and confirm that ssh deploy@YOUR_SERVER_IP works with the key and that sudo -v succeeds. Keep the first session open until you have confirmed it: this is the step where people lock themselves out.
Turn off password and root logins. Create /etc/ssh/sshd_config.d/00-hardening.conf with:
PasswordAuthentication no
PermitRootLogin no
The file name starts with 00 on purpose. OpenSSH uses the first value it reads, and some cloud images ship a file such as 50-cloud-init.conf that turns passwords back on. Then test and reload:
sudo sshd -t
sudo systemctl reload ssh # Ubuntu, Debian
sudo systemctl reload sshd # AlmaLinux, Rocky Linux
Check: sudo sshd -T | grep -E "passwordauthentication|permitrootlogin" should print no for both.
2. Firewall: allow only what you serve
Allow SSH first, then switch the firewall on, then add the ports your services need.
# Ubuntu, Debian (ufw)
sudo apt install ufw
sudo ufw allow OpenSSH
sudo ufw allow 80,443/tcp
sudo ufw enable
sudo ufw status verbose
# AlmaLinux, Rocky Linux (firewalld)
sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
Two things catch people out. Databases, Redis and admin panels should listen on 127.0.0.1, not on the public address. And Docker publishes container ports by writing its own firewall rules, so a port published with -p 5432:5432 is reachable from the internet even when ufw says it is closed. Publish to localhost instead (-p 127.0.0.1:5432:5432) or use your provider's cloud firewall as the outer layer.
Check: sudo ss -tulpn lists every listening port and the program behind it. Anything bound to 0.0.0.0 or [::] that you did not intend to expose needs fixing.
3. Automatic security updates
# Ubuntu, Debian
sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
# AlmaLinux, Rocky Linux 9
sudo dnf install dnf-automatic
sudo systemctl enable --now dnf-automatic.timer
On AlmaLinux and Rocky Linux, dnf-automatic only downloads updates by default. To install them, set apply_updates = yes (and, if you want security fixes only, upgrade_type = security) in /etc/dnf/automatic.conf. On version 10, confirm the package and timer names with dnf search automatic before relying on them.
Automatic updates do not restart the server. A new kernel or a patched library takes effect only after a reboot or a service restart.
# Ubuntu, Debian: is a reboot pending?
cat /var/run/reboot-required 2>/dev/null
# AlmaLinux, Rocky Linux
sudo dnf install dnf-utils
sudo needs-restarting -r
Check: systemctl list-timers | grep -E "apt|dnf" shows when the next run is due.
4. Monitoring: find out before your users do
You need two kinds of monitoring, and they answer different questions.
- From outside: is the site reachable? An uptime checker that requests your URL every minute and emails you on failure. It must run somewhere other than the server it watches.
- From inside: is the server healthy? CPU, memory, disk space and failed services.
For a quick look by hand, five commands cover most problems:
uptime # load averages
free -h # memory and swap
df -h # disk space
systemctl --failed # services that crashed
journalctl -p err -b # errors since boot
Set an alert for disk usage above 80%. A full disk is the most common avoidable outage on a small VPS, and it stops databases from starting. When the server feels slow, follow our triage guide. For background on the individual tools, see 20 command-line tools to monitor Linux performance.
5. Backups you have actually restored
A provider snapshot is convenient and not enough. It lives with the same provider and usually in the same data centre as the server, so an account problem or a provider failure takes both.
- Keep three copies of anything important: the live data, a snapshot or local copy, and a copy with a different provider.
- Dump databases properly. Copying a running database's files can produce a backup that will not start. Use
mysqldump --single-transaction,mariadb-dumporpg_dump. - Back up configuration too:
/etc, your web server and application config, cron jobs, and the list of installed packages. - Encrypt off-site backups and keep the password somewhere other than the server.
- Test a restore. Every few months, restore last night's backup onto a fresh VPS and load the site. A backup you have never restored is an assumption.
Tools such as restic and BorgBackup handle encryption, deduplication and retention. Our older guide on encrypted backups with Duplicity shows the same idea with a different tool.
6. Housekeeping: disk, memory and logs
df -h # which filesystem is filling up
df -i # inodes: "disk full" with free space left
sudo du -xh / --max-depth=2 2>/dev/null | sort -h | tail -20
journalctl --disk-usage # size of the systemd journal
sudo journalctl --vacuum-time=14d
The usual culprits are logs, old backups kept on the server, package caches and Docker. If you run Docker, docker system df shows what images, containers and volumes use, and container logs grow without limit unless you set max-size for the logging driver.
On a VPS with 1–2 GB of RAM, add a small swap file so that a short memory spike slows the server down instead of killing the database. See how to create a Linux swap file.
7. Know your support dates
An operating system past its end of life gets no security fixes, however carefully you manage it.
| Release | Status in November 2026 |
|---|---|
| Ubuntu 26.04 LTS, 24.04 LTS | Supported |
| Debian 13 | Current stable; Debian 12 still supported |
| Debian 11 | Long-term support ended on 31 August 2026: plan a move |
| AlmaLinux and Rocky Linux 9, 10 | Supported (9.9 and 10.3 released 16 November 2026) |
| CentOS 7 | End of life since June 2024 |
For a major release change, building a new VPS and moving the sites across is usually safer than upgrading in place: the old server stays untouched until the new one is proven.
A routine you can keep
| When | What |
|---|---|
| Automatic | Security updates, backups, uptime check, disk alert |
| Weekly (5 minutes) | systemctl --failed, df -h, pending reboot, last backup finished |
| Monthly (20 minutes) | Reboot for kernel updates, review ss -tulpn and user accounts, check backup size and retention |
| Every 3–6 months | Restore test, review firewall rules, check the operating system's support date |
Frequently asked questions
Is it hard to manage a VPS?
The setup takes an afternoon the first time. After that, a single small server needs a few minutes a week if updates, backups and alerts are automated. The hard part is the unplanned work: diagnosing a problem at a bad moment with nobody to call.
Do I need a control panel?
No. A panel saves time if you host many sites or mailboxes and prefer a web interface. It also adds software that must be kept updated and an admin port that should not be open to the whole internet. Our overview of open-source control panels lists the options.
How often should I reboot?
Whenever a kernel or core library update is waiting, which in practice means about once a month. Check with the commands in section 3.
What is the single most important step?
SSH keys with password login switched off, closely followed by automatic security updates. Together they remove the two most common ways servers are taken over.