We earn commissions when you shop through the links below. Affiliate disclosure

Buy a VPS through us and get a month of help free: server, apps and support, up to 10 hours. How it worksSkip to content
All guides

Linux VPS hosting: choosing a system and setting it up safely

A Linux VPS gives you a lot of control for relatively little money, and with it the responsibility for keeping the server safe. Nobody will patch it for you unless that's part of what you've bought. The good news is that the essentials are few, and they rarely change.

Which distribution?

Choose one that's widely used, has long-term support, and that your software expects. For most people that comes down to three families. Debian is stable and conservative. Ubuntu LTS has a very large community and is what much documentation assumes. AlmaLinux and Rocky Linux suit environments built around the Red Hat family.

Avoid short-lived releases on a server, since you'll have to upgrade them soon. Pick a release with years of support remaining and note its end-of-life date somewhere you'll see it.

The first hour on a new server

Do these before installing anything else:

  • Update the system.
  • Create a normal user with sudo rights, and use it instead of root.
  • Set up SSH key login, then turn off password login and direct root login.
  • Enable a firewall that only allows what you need, usually SSH, HTTP and HTTPS.
  • Turn on automatic security updates, such as unattended-upgrades on Debian and Ubuntu.
  • Consider Fail2ban or similar to slow down repeated login attempts.

Keep it from quietly going wrong

Most servers don't fail dramatically. They fail slowly: a disk fills up with logs, a certificate expires, a service stops after a reboot. Basic monitoring of disk space, memory, certificates and service health will warn you about all of these before your users do.

Write down what you've changed. A short text file describing the setup is enough, and it's worth far more than you would expect on the day you have to rebuild.

Backups are only real once restored

A provider's snapshots are convenient, but they live with the same provider. Keep an encrypted copy of your important data somewhere else, automate it, and try a full restore on a spare server. Do that at least once, and again after any large change.

Common questions

Is a VPS safe if I only run a small website?
Bots scan every public address, however small the site. With key-only SSH, a firewall and automatic security updates, a small server is in good shape. Without them, it's an easy target.
Do I need a control panel?
Not necessarily. Panels make common tasks easier, but they add software to keep updated, and some have licence costs. For a single application, the command line and a few well-written configuration files are often simpler.