How not to get a VPS
VPS, or Virtual Private Server, is a server that isn’t an individual device, but acts like one. This allows full administrator access to the OS like with a dedicated server, but is far cheaper and allows more virtualisation-related magic.
This is usually the cheapest option to host server software written in a compiled language. However, such a use case is often ignored in this era where a lot of software is just a bunch of scripts communicating with a database.
So I googled things like VPS hosting, cheap VPS hosting et cetera and found a load of links. I did not expect a lot of activity on the server, so I had little requirements on hardware. The cheapest one was for $15/month. However, that affiliate discount price wasn’t available when I checked it again and the cheapest one, BlueHost was for $25/month.
So I googled if there wasn’t anything bad about them and found no complaints, that they were good enough, for a good price. So I chose that.
Only later I was told that DigitalOcean and some othe rcompanies offer VPS hosting for $5/month. Apparently, the search results were skewed by promoters.
I wanted a Linux server because it’s cheaper, more convenient and used more frequently. I got one, but while I was expecting some version of Ubuntu Server, it had CentOS 6. First, I thought it wasn’t a big deal.
The server came with CPanel, a set of tools for deploying typical web solutions, all configurable from the web. However, it was completely unsuitable for hosting my own program. And it turned out it wasn’t free, it was a part of the price I was paying for it.
After some search, I have found the ssh login and a hint what is my password there. So I logged in and realised I had no sudo access and thus couldn’t install any programs (as it later turned out, this one didn’t matter). I asked tech support and she asked her colleagues and finally told me how to login as root.
A whole new level of obsolete
My program was written in C++14. I thought that it’s better not to use C++17, because it’s not supported properly by all compilers yet. Turned out it didn’t matter.
It couldn’t even start compiling, because its CMake was obsolete. I can’t even recall anything ever changed in CMake. I had to clone the repository and compile it myself (fortunately, git was not too modern for it). Then I bumped into another problem.
The compiler available on CentOS 6 didn’t support C++14. In year 2019! CentOS 6 is not only an old operating system, its package manager’s repos are old as well. I had to compile it myself. Again.
A quick check on Wikipedia has shown that since 2014, the up-to-date version of CentOS was CentOS 7. They were selling VPS with an operating system that was already out of date for five years and its full support ended 2 years before!
The nuisance that CPanel can be
When all was set up, I tried to run my program and… it could not connect to port 80. Because Apache was connected there already. So I killed Apache and tried to run it again. It failed. Because Apache was connected there… because screw you, Apache belongs to port 80. Clearly, Apache was set to restart whenever it failed. I tried to uninstall it, but it said that the apache package wasn’t installed.
It turned out it was a part of CPanel. So I looked at removing CPanel, but all I have found that CPanel is nigh impossible to remove and that it’s better to reinstall the OS (which I would enjoy doing to get rid of that obsolete CentOS 6, but it wasn’t an option). So I asked on ServerFault how can I remove that Apache from CPanel and I got downvoted with comments like that I should uninstall CPanel instead. So those were the douchebags so many posts on /r/ProgrammerHumor/ were about. I eventually found that it had Apache installed with a different package name from a CPanel repository and removing that one finally freed port 80.
So my program was finally running. For some time.
After some time, CPanel decided to reinstall Apache and it killed my program so that it could connect to port 80. It however redirected links into my program to its site announcing a dead link and my browser remembered it. I uninstalled it again, this time with more frustration and had to use another browser that didn’t have the redirect saved.
Later, it filled the /var/logs/ directory with its logs. It prevented many programs from working and it took me quite long to find out that there was no more space in /var/logs. It contained several gigabytes of CPanel logs even if I wasn’t using it at all. Because I don’t know what a regular web developer do if his web-based solution stopped working and could be fixed only through SSH and a root access even common tech support people don’t know about, CPanel can probably continue working without space for logs. Magnificent design.
When it reinstalled Apache yet again, I gave up and cancelled the renewal of the service.
If you want a VPS and you don’t have experience with VPS hosting services, I recommend asking some friends who have more experience about their suggestions for a good service that suits your needs instead of just using google. You want to get what you wanted and not what you asked for.