I use to see VPS management as quite a tedious and highly skilled pursuit, i would always leave the VPS option and settle for shared hosting because they seem quite easier to manage and everything is setup for you. Shared hosting are costlier but i normally do have no choice. I have tried my hands on VPSs over the years but i end up not achieving what i want, its either the mails don’t work well or managing multiple websites become elusive due to mis-configs in Apache.
I have tried WHM/Cpanel for VPS they seem to make the job easier but they are costly, they are just ideal for a hosting companies or resellers. I have setup webmin before now but i got confused and tore everything down, but i have been able to get a hank of it now and can comfortably setup linux webservers with it and manage everything within. without even having to manually configure any apache directive.
Alright lets dive right into it.
Choosing the perfect Hosting company for your VPS
I have tried many many hosting companies and it all boils down to Uptime and the Packages they offer. well this article is not about hosting company review so i skip that part. Just choose a company with good reputation and attractive packages.
Choosing the VPS package
This part is going to cover the right options to select, while choosing the right VPS package.
For the Operating system we would want to choose CentOS 7 or CentOS 8.
For the Pre-installed server we would want to choose Webmin. In some hosting platforms you might see the options together as CentOS 7 + Webmin. you would see WHM/Cpanel, Plesk and the rest but we are sticking with Webmin.
Some companies will further give you options for a pre-installed script like WordPress etc. but we dont want that so we are going to leave that part unselected.
You will see other options like IP address and the rest but this article wouldn’t go into that, choose your other options and purchase your server.
Server Provisioned
Alright in this paragraph i assume you have signed up with a hosting company, paid for a VPS and the server has been provisioned, normally you will get an email with your server configuration details. among those details will be your server root details, and the Webmin login url and login details, the webmin server runs on port 10000.
you will also be given access to the company’s control panel where you can add domain names, set DNS, set rDNS, set IPs and sometimes even SSL. Some companies will setup virtualmin for you alongside Webmin.
Virtualmin is a feature of webmin that allows you conveniently run different websites on same IP address, you can do this with Webmin alone but Virtualmin makes it easier and more convenient. In this Article i will assume Virtualmin was not installed for you, if it was installed for, then you can skip the below steps.
Installing Virtualmin
Login to your server using putty – Putty is an SSH and Telnet client, you can download putty here: use the username and password sent to your email by your hosting company (I will assume you know how to use putty.).
Download the latest version of virtualmin by running the below code.
wget https://software.virtualmin.com/gpl/scripts/install.sh
Grant permission to the installer for execution by everyone by running the below code.
chmod +x install.sh
Install Virtualmin by running the below code
/bin/sh ./install.sh
Congratulations, you have successfully installed Virtualmin, now login to webmin from the URL advised in your mail, you will see Virtualmin as a tab beside webmin.
Domain and DNS
Now you have your server setup, you need to manage your domains. If you dont have a domain already, you need to purchase one, if you have already then you will need update the nameservers, your hosting company would have communicated the default nameservers to use, you can also find it in your webhosting company’s control panel.
Alright go ahead and update your domain with the appropriate nameservers(I will assume you know how to do this), having done that, then move over to your host company’s control panel you will need to add the domain to the control panel, below is the picture of the a Contabo control panel where you add your domain name.
Other hosting companies platform will definitely be different, for Contabo you add your domain in the DNS Zone Management as above. Enter your domain in the domain box and select the IP you wish to link it to, this means you can add as many domains as you want to share the VPS server and they all will share same Target IP Address.
Creating Virtual Servers(Virtualmin) for your domains
Head over to your Webmin control panel -> Virtualmin, select Create Virtual Server enter the details as shown below.
Domain name: Enter the domain name that owns the virtual server.
Description: Describe the Domain to help you identify from other virtual servers
Administrative password: Choose your password
Server Configuration template: you can leave it as default, in case you wish to custom configure based on domain look at the menu in the left hand side-> Server Configuration
Account plan: you can leave as default or you can configure it from the menu in the left hand side, Its paramount to custom configure this if you intend to sell off your server space(as a mini hosting company).
Administration username: you can leave Automatic or set custom.
For Advanced Options, Enabled Features, IP address and forwarding you can set it like the picture above. in the enabled features do not tick Setup IP-based Virtual FTP it cause you issues later on when you start adding other websites because it ties down the first website with the IP address allocated to you. its fine to tick it if you intend to run only 1website on the VPS, or you have different IPs for each website.
Now go ahead and Create Server.
Your new server will be provisioned, please note that SSL may fail if your DNS took a while to propagate, you dont have to worry just go to the menu -> Server Configuration -> SSL certificate->Let’s Encrypt (Thats if you want to use it).
Request certificate for: you can leave the fault(domains associated with the server)
Select Months between automatic renewal: type: 2
Then Request certiifcate.
If your request fails again then you need to make sure your domains DNS records are set correctly with the IP address.
Some hosts don’t do this automatically for you, so Head over to your host’s control panel go to the DNS section create an A record with @ as the name pointing to your IP address. Also set another A record with name as www pointing your IP address.
That’s it, any SSL issue should be solved at this stage.
Notables:
you can go ahead and manage your nearly created virtual server, you can create as much as you want by follow the steps.
you can even install some CMS like wordpress etc, from the virtual server by clicking on install scripts in the menu.
Also its good to note that the default php version that will be installed with the Apache and webmin will be the latest php version, you can install other versions by running the approprait yum command in when logged in with putty, if there are some missing php modules you can still install it with the right yum command and virtualmin will automatically pick the updates.
Do enjoy your new installation.