Go back ⮌

Setting up a basic VPS

NOTE: I replaced some parts of following text so they might seem out of place.

As always I am struggling between Ubuntu and Debian. For desktop I use various distributions, with or without Systemd, with or without desktop environments, I really have no problem with installing and uninstalling, experimenting and breaking things, but for server… You want to have something stable. Usually I have been using Ubuntu. For like a year I tried Debian and now I am to decide which of them will be my standard approach. Like really, I mean now, at the moment of writing. The answer is Ubuntu. More than that we will use Systemd and try to get most of it.


Before doing anything make sure that your installation of operating system on server is clean. Like really, really clean. Or at least half clean. Remove any existing services that are not crucial to managing the server. That means you should leave SSH server and networking service working. Do not remove them, dumbass.

You can verify services with systemctl. Additionally you may upgrade installed packages.

systemctl list-unit-files --type service --state enabled,generated
apt update
apt upgrade


Since we hope to use quite clean instance of whatever distro we got installed, we should install tools that we will most likely use commonly, but let’s try to keep this list as short as possible (I’m looking at that wget+curl).


I encourage usage of Uncomplicated Firewall. It is simple and quite powerful. Way easier to use than iptables.

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


At the beginning just make sure that SSH is not allowing password authentication for root.

In /etc/ssh/sshd_config:

PermitRootLogin prohibit-password

Make sure to add your public key to root’s ~/.shh/authorized_keys.


If you host also likes to add some fun hostnames to newly created machine then change it. I usually go with simple editing of /etc/hostname, updating /etc/hosts with public IP of server and correct hostname and then restarting server.


OVH sometimes like to make a nice and user friendly VPS images and so on. They also like to change locale to my native locale which I do not really prefer. Sometimes it will result in various errors in PERL, git and so on. To fix issues regarding locale you will need to reconfigure locales package:

dpkg-reconfigure locales
update-locale LANG=en_US.UTF-8