Hello, this guide will show you how to set up a free cPanel alternative. cPanel is a famous control panel that helps you manage your web hosting service through a user-friendly web-based interface.
You can run cPanel on a free VPS server, but you’ll have to pay a monthly charge to utilize it. In this video, I’ll teach you how to install Webmin and Virtualmin, a free cPanel alternative and opensource web hosting control panel.
Webmin is a free online front-end that allows you to operate your server remotely using your browser. Virtualmin is a free Webmin plugin that, like cPanel, allows you to manage many virtual hosts from one place. Virtualmin is a powerful and efficient web server administration tool.
Domain accounts, email, user and reseller accounts, security, alerts, graphs, and logs, backups and cloud integration, databases, and installation scripts are all included.
You can use any type of fresh Virtual Private server or dedicated server to install this. Virtualmin supports both CentOS and Ubuntu Linux distributions. I use Google Cloud platform free tier as my VPS provider and CentOS Web Panel as Operation System. Let’s go to the actual process of installation.
Setup the VM Instance on Google Cloud Console
First, you have to signup google cloud platform and activate their free trial and free tier. It gives one virtual machine free forever. You can use it for this tutorial. Also, you can use other VPS providers, because GCP offers an f1 micro machine for the free tier.
After you successfully signup to the google cloud, go to the menu and select “VM instances”. You will get this window but if you do this for the first time it may differ. To set up, a new virtual server clicks the “create instance” button.
Now select a region that includes in the GCP free tier. Check the guide I will include all regions that cover under the free trial. I selected the US west region; you can select any zone you like. Select machine Series “N1” and machine type “f1 micro”. It is the only VM that gives with the free tier.
You can see the left side of the screen, it says “first 744 hours free for a month”. After that, you have to select a boot disk type. Click the “change” button to select a comfortable Operation System for Virtualmin. Here I select CentOS 8 as my OS but it is supported for Ubuntu and Debian also.
Supported Operation Systems (OS) for Virtualmin/Webmin Install;
- CentOS/RHEL 7 and 8 on x86_64
- Debian 10 on i386 and amd64
- Ubuntu 18.04 LTS and 20.04 LTS on i386 and amd64 (non-LTS releases are not supported)
For boot disk type, I select SSD, it is the fastest disk type and improves the performance of the instance. You can select disk size up to 30 GB under the free tier, furthermore, you will get charge.
In the firewall section, allow both HTTP and HTTPS traffic. After setup, all those things, click “create” to deploy the server.
Point out the Domain and Set DNS Records
After getting the domain name, you can continue with the tutorial from here.
Copy the public IP address of your VM instance. Then go to your domain name provider and enter it in the DNS management section. The interface may differ from different providers but the process is the same. You have to add an “A” record to the DNS.
You have to use a subdomain for this Virtualmin hosting otherwise it is not supported for the root domain.
After hosting the Virtualmin you can add the root domain and host WordPress on the root domain. To add the subdomain, type your preferred word as the name. you can see here I use “mail”. Then paste your Public IP address as the target. It will create a subdomain like this.
DNS records take some time to update, until it finishes you can proceed to the next step.
Add Virtual Memory to Server
This VPS is small and it comes with small memory. Before the installation, you can add a Swap file to increase the memory.
Go to your VM instance page, click the “SSH” button, it will open the terminal window. You can find all the commands and guidelines in the description.
You check the available memory first. There is no Swap memory, let’s add one.
Use this command to allocate the space from the disk. I take 3024 MB you can use any value you preferred.
sudo dd if=/dev/zero of=/mnt/swap.0 bs=3024 count=1048576
Use this to mount it.
sudo mkswap /mnt/swap.0
Get root access.
Now enter the following commands. Please note in the video, I enter it one by one. you can use this single code instead of that.
echo "/mnt/swap.0 swap swap defaults 0 0" >> /etc/fstab && swapon /mnt/swap.0 && sudo swapon -s
It is done. Check the available memory again. Swap file added to the system successfully. Let’s go to the Virtualmin installation process.
Run Virtualmin Auto-installer
After adding the swap memory, we can start the installation process. Get root access using this command.
Update the list of packages of the system using this code. Type “Y” to proceed.
sudo yum update
Now set the root password. It uses to login into the Webmin control panel. Type your password here, it is not visible due to security reasons, just type it and confirm the password. Ok, the password is set.
Next, you have to set the hostname for this instance, you can simply copy and paste this command. Remember to replace the subdomain you created before.
hostnamectl set-hostname sub.yourdomain.com
Next, you have to install Wget use this command to install it. If you chose Ubuntu as your OS, then you don’t want to install this. Ubuntu has pre-installation packages. Type “Y” to continue.
dnf install wget
Next, use this command to download the Virtualmin auto-installation script.
Execute the script using this command. It asks to proceed, type “Y” and enter.
sudo /bin/sh install.sh
This installation process takes a longer time. Please relax and get back to the instance after it is finished.
Now the process is completed, you can access the web user interface using your subdomain.
Add Google Cloud Console Firewall Rules
I am very sorry, i forgot to include this part in the video. You have to add firewall rules to Google Cloud Platform before the access to the web interface. I include a example video here.
In the menu, select “external IP address” under VPC network. Change the VM IP type to “Static”. Static IP doesn’t change during refresh the VPS.
Then click “firewall” at the left menu. You have to allow Following ports.
This is the port list of Virtualmin.
Primary Virtualmin Ports;
- 22 – SSH port
- 80 – HTTP web access
- 443 – HTTPS web access
- 10000 – Virtualmin port
Special Virtualmin Ports;
- 20 – 21 – FTP
- 25 – SMTP (Email)
- 53 (both tcp and udp) – DNS port (for custom nameservers)
- 110 – POP3 (Email)
- 143 – IMAP (Email)
- 993 – IMAPS (Email)
- 465 /587 – SMTPS (Email)
- 10001 – 10009 – Webmin RPC
- 20000 – Usermin
Click “create firewall rule” and name it whatever you want. Under target select “all instance in the network”. then put IP range (0.0.0.0/0) as this and under protocols and ports select “allow all”. I Open all port in this demonstration but you can open only above ports.
Now, click create button. this firewall rule allows all port and all IP ranges to connect the VM instance.
Complete Post Installation Wizard
You can simply type your host domain in the browser and enter to the Webmin. You will see this warning sign at the first login. This is because we did not install an SSL certificate on the site. Anyway, you can bypass this warning, click “advanced” and select “Accept the risk and continue”.
This is the Webmin login page, enter “root” as your username and type the password that you set previously.
You are in the web control panel but all the features are not enabling until you complete the post-installation wizard. There are few simple steps to complete the installation. Let’s begin.
If you want you can enable domain lookup server and preload virtual libraries, but they consume more RAM. So, I go with default settings.
This is also RAM consuming part, I skip it. I am not going to run a spam filter, click next.
If you plan to run a WordPress website enable MySQL database. This is your MySQL password copy and keeps it in a safe place. After that tick marks the below box and press “next”.
You can select the size of your MySQL database; you can leave it to default or select one of the options.
It automatically gets the primary name server. You don’t have to enter it. Leave this as default.
This part is important. If you want to host a website, you should enter your main root domain here as the default virtual server. I leave it as the subdomain. You can generate an SSL certificate for the server make sure you select it.
It automatically generates the SSL certificate for your server but this can cause connection loss. Refresh the page after few moments.
You have to go through the same process again but this time, it set all of your previously set settings. So simply press the “next” button until the end.
Ok finally, you have to recheck and refresh the configurations. After that, you are done. Now it is ready to use.
In my next video, I will show you how to host multiple WordPress sites using Virtualmin. Hope you enjoy this tutorial. Thank You.