Install a custom OS on a VPS

Hugo Rodrigues

One of the cool things about a Virtual Private Server is the price, you can get the most basic one for 50€ per year. But the catch is the limitation of the OS you can run and the settings. Depending of the vendor, you will be limited to a few distros like Debian, Ubuntu, CentOS and Fedora. A part from the OS, the disk layout is also a limitation. In general, you have a single partition with all of your data.

Of course, running an "unofficial" OS on your VPS has some drawbacks, mainly the optimizations that your provider may have done to improve the system performance.

On this post, I will show to all of you how I run vanilla Debian on my VPS.

Why Debian and what about the others?

This article is base on Debian, since is the distribution I use, but the method is almost the same (if actually not the same) for other distros.

Of course of some have their specific tricks, like Alpine, but if many people want, I can show with a different OS.

Lets start then

Before everything, ensure that distribution has an installer that can run entirely from memory. This is a requirement since we are going to copy the installer image into the hard drive. In case of Debian, you need the get the very small netboot image, aka mini.iso.

To "flash" the installer, we need a running system on our VPS. I recommend a recovery environment if you provider has the options, this way you can write the installer with the disk being used. If your provider doesn't have a recovery option, you can try to flash the image while the disk is running. It isn't impossible, you just need luck.

After copying the installer image to disk, you should check the network configuration of the current system. Some providers can have a working DHPC system and you can use the auto configuration, but some, like OVH, you must manually configure the network and knowing the correct settings before hand can help.

Now we just need to reboot into disk mode (if you have booted you VPS into recovery mode) and install the distro you want on your VPS. For here, the installation process is the same as if you were installing on a physical server.

Now you have your VPS with the settings you want.

Best Regards,

Hugo Rodrigues