Install Virtualmin on Webmin

Virtualmin is a web hosting control panel, designed to make it easy to manage websites, mailbox users, databases, and web applications. Installing Virtualmin provides a full-featured web hosting stack with web, email, databases, spam and antivirus filtering, analytics, etc.

In this tutorial, we’ll show you how to install the free edition, Virtualmin GPL. Once this is done, you will be able to create any number of user accounts to host multiple domains on a single server through your browser.

DO NOT follow this tutorial on a live production server that is already running Apache, MySQL and PHP, as this can result in data loss. Use a new server and transfer your data over instead.

Prerequisites

  • Ubuntu server with Webmin installed.
  • A Fully-Qualified Domain Name configured to point to your server.

Step 1: Setting the Hostname and FQDN (optional)

For Virtualmin to work properly, you need to configure the hostname and FQDN on the server itself by editing the /etc/hostname and /etc/hosts files, as well as update your DNS settings so DNS lookups resolve properly.

First, log in to your server as your non-root user. Once you have logged in, update the package database:

sudo apt-get update

Then install any necessary updates and packages to ensure you start with a stable and up-to-date system.

sudo apt-get dist-upgrade -y

Next, change the hostname to match the FQDN you’ve pointed to the server in the prerequisites.

To check the current server hostname, run this command:

hostname -f

To change the hostname for your server, open the file /etc/hostname in your editor:

sudo nano /etc/hostname

Delete the current hostname and replace it with your hostname: /etc/hostname

<mark>your_hostname</mark>

Use just the hostname, not the entire FQDN, in this file. For example, if your FQDN is virtualmin.example.com, enter virtualmin in this file.

Save the file and exit the editor.

Next, add both the hostname and FQDN in the /etc/hosts file:

sudo nano /etc/hosts

Modify the line that starts with 127.0.0.1 to use your FQDN and hostname, in that order: /etc/hosts

127.0.1.1    <mark>your_hostname.your_domain.com your_hostname</mark>
127.0.0.1    localhost
...

Remember to replace your_hostname and your_domain.com with your own hostname and domain name. Save the file and exit the editor.

If this line doesn’t exist in your file, add it to avoid some compatibility issues with other software on your Ubuntu system.

To check if the name has been changed correctly, reboot your server.

sudo reboot

Then ssh into your server again. You should see the new hostname on your terminal prompt. For example:

your_user@<mark>your_hostname</mark>:~$

Use the hostname command to verify that the FQDN was set correctly:

hostname -f

You’ll see your FQDN in the output:

<mark>your_hostname</mark>.<mark>your_domain</mark>.com

If you don’t, double-check the changes you made to your configuration, correct any errors, and reboot.

Next, edit the network configuration file so that it uses this server as one of the DNS servers to resolve domain names. Open the configuration file:

sudo nano /etc/network/interfaces.d/50-cloud-init.cfg

Add the IP address 127.0.0.1 to the configuration file. Look for the following line: /etc/network/interfaces.d/50-cloud-init.cfg

dns-nameservers 8.8.8.8 8.8.4.4

Change it to: /etc/network/interfaces.d/50-cloud-init.cfg

dns-nameservers 8.8.8.8 8.8.4.4 <mark>127.0.0.1</mark>

Make sure there is a space before 127.0.0.1. Save the file and exit the editor.

You have prepared the server by setting the hostname, FQDN, and the network configuration. Let’s install Virtualmin.

Step 2: Installing Virtualmin

To install Virtualmin, download and run the official Virtualmin installation script, which will install Virtualmin, and Webmin, along with a LAMP stack, BIND, and Postfix.

wget https://software.virtualmin.com/gpl/scripts/install.sh

While this script comes from the official Virtualmin website, you may want to open the script in your editor and review the contents before running it.

sudo nano ./install.sh

Once you’re comfortable with the contents of the script, use it to install Virtualmin and its prerequisites:

sudo /bin/sh ./install.sh

The script will display a warning message about existing data and compatible operating systems. Press y to confirm that you want to continue the installation.

The script will take some time to complete all the steps as it installs various software packages and components.

Once the script completes, you can configure the root password.

Step 3: Configuring Webmin’s Root Password

Virtualmin is an add-on to Webmin, and by default, Webmin uses the system root user and password for the web interface login. If you log in to your server using an SSH key, you may not have the system root password, or may not feel comfortable using it to log in remotely through a browser. Let’s tell Webmin to use a different password for its web interface. This process won’t change the system root password; it’ll just tell Webmin to use the password you specify for the login.

To change Webmin’s root password, use the following command:

sudo /usr/share/webmin/changepass.pl /etc/webmin root yourpassword

Replace yourpassword with your preferred password. You can bypass this step if you have done this before.

Next, restart the Webmin service so the changes take effect.

sudo systemctl restart webmin

Next, we will configure Webmin using the web front-end.

Step 4: Configuring Webmin Using The Post-Installion Wizard

To configure Webmin, we’ll use its web-based Post-Installation Wizard. Open your web browser and navigate to https://[your_server_ip]:10000. You can also use your fully-qualified domain name to access the site.

Note: Your browser may show a “Your connection is not secure” or “Your connection is not private” warning since Virtualmin uses a self-signed certificate. This warning is normal. You can add Let’s Encrypt SSL certificate once you have completed this tutorial.

Log in as the root user with the newly-changed password you set in the previous step.

Once you have logged in, you’ll see the Introduction screen stating that you are going through the steps to configure Virtualmin. Press Next to continue.

On the Memory use screen, select No for Preload Virtualmin libraries, since you don’t need to run the Virtualmin UI all the time. Select Yes for Run email domain lookup server to enable faster mail processing. Press Next to continue.

On the Virus scanning screen, select No for Run ClamAV server scanner so you’ll use less RAM. Press Next to continue.

On the Spam filtering screen, select No for Run SpamAssassin server filter and press Next to continue.

The next three screens configure the database server:

  • On the Database servers screen, select Yes to Run MySQL database server and no to Run PostgreSQL database server. Press Next to continue.
  • On the MySQL password screen, enter your desired MySQL root password or leave the default. It should be different from the root password you used to log in to Webmin.
  • On the MySQL database size screen, select the RAM option that matches the amount of RAM your server has. For a 2GB (or more) server, select Huge system (2G or more) on which MySQL is heavily used. Press Next to continue.

Next, you’ll see a screen like the following, where you’re asked to enter nameservers:

Enter your primary and secondary nameservers here which you configured in the prerequisites. If you haven’t set these up, check the Skip check for resolvability box to avoid error message and proceed.

Ta da! You have finished Virtualmin post-installation configuration. Click Next to continue with the wizard to configure optional features.

On the Password storage screen, select Store plain-text passwords if you must support password recovery. Otherwise, choose Only store hashed passwords.

Click Next to the SSL key directory screen, select 1 option to choose the location for SSL certificates.

Next, you will be redirected to setup default virtual server. Select No, thanks to set up later, Virtualmin will use the latest created domain to be default virtual server. Otherwise, select Create server with domain and enter your desired domain or leave the default.

Click Next

Finally, select Finish to complete the post-installation configuration.

You may also see a message stating that Virtualmin’s configuration has not been checked. Click the Re-check and refresh configuration button to check your Virtualmin configuration. Address any errors that the check reports.

Conclusion

In this tutorial, you have learned how to install VirtualMin add-on to Webmin on Ubuntu server.

To learn more about Virtualmin, look at the official Virtualmin documentation. Don’t forget to get familiar with the Webmin documentaiton, since you can use Webmin to manage services, install updates, and do other system administration tasks.

Reference

  • https://www.digitalocean.com/community/tutorials/how-to-install-virtualmin-with-webmin-lamp-bind-and-postfix-on-ubuntu-16-04

Leave a Comment

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

Scroll to Top