Setup Virtualmin on Google Cloud Console Optimally

This post enlists the steps required to configure Virtualmin on Google Cloud Console.

Note: This post is being incomplete and is being updated.

At the end of this tutorial, we would have successfully achieved this:

  • Created a Google Cloud Console based virtual server
  • Installed ubuntu 18.04 on our server (you can choose your own OS too)
  • Installed and configured Virtualmin and Webmin with minimal configuration and LEMP stack (Nginx instead of Apache). However, you’ll also see how to install simple apache with non-minimal configuration
  • Setup firewall on google cloud console to allow the use of Virtualmin
  • Use Cloudflare as DNS and caching method for our site
  • setup root login password for Virtualmin (and google cloud console)
  • change the default port for Virtualmin and Webmin admin panel

Setup root login password for Virtualmin (& Google cloud console)

Many people get confused at how to get the Webmin and Virtualmin default login and password after a fresh install. This post will guide you through to fix that issue.

Virtualmin uses the servers own root user to login into admin interface when we first set up the Virtualmin.

If you don’t know the root password for your GCC virtual machine user, follow these steps to change it to a custom new password.

  1. Go to Google Cloud Console > VM Instances
  2. Click on SSH on your VM instance row to open the SSH terminal for your GCC virtual machine
  3. Enter the following commands to create a new password
sudo -i
sudo bash
sudo passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

Your password is now set to the new password. You can use this password to login to virtualmin and webmin admin panel as default root user.

Please make sure that you enter the same password at both prompts above and also remember the password that you entered. If you forget the password you can repeat the process again too without any issue.

Change default port 10000 of virtualmin / webmin to custom port

Virtualmin setups the default port as 10000. this can be a security risk and thus it’s recommended to change it. Follow these steps to change the port for Webmin or Virtualmin admin panel to a custom port.

Please note, that this consists of two steps:

  1. Setting up the new port in webmin settings
  2. Opening up the new port in Google Cloud Console Settings

Setting up new port in webmin settings

  1. Go to Webmin > Webmin Configuration > Ports and Addresses
  2. Change the port value in 2 places on same page from 10000 to your custom port that you want to use. Please note that both places should have same port number before you hit save.
  3. You might have to select No for Accept IPv6 connections? if it gives an error (Failed to change address : IPv6 cannot be enabled unless the Socket6 Perl module is installed) and you’re not planning on using the IPv6 connections in DNS zones for your domains.

The settings page should look like this (before change):

The process isn’t complete yet, now we have to go to Google Cloud Console and setup the firewall for the new port.

Allow new port in Google Cloud Console firewall settings

Remember that we have set up the port 10000 already in Google Cloud Console firewall settings previously. All we have to do is to go in the same settings and change the allowed port from 10000 to our new port.

  1. Go to Google Cloud Console > VM Instances
  2. Press three dots at the end of your instance row, and select view network details, it will take you to the network interface details of this instance, including firewall details on the same page
  3. Click on the name of the entry which you set up earlier to open the port 10000 in GCC for our Virtualmin server
  4. Click on edit on top of the entry details page
  5. Change the port value at the end from tcp:10000 to your custom new port number that you want to use. (Make sure you change the port, not the priority or anything else).
  6. Save the settings.

The network interface details page before changing the port looks like this:

Now you can login to the virtualmin and webmin settings using the new port like: https://your-domain-or-server-ip:custom-port-number

Leave a Reply

Your email address will not be published. Required fields are marked *