Virtualmin is a web hosting control panel for Linux based Operating system like cPanel or Plesk. Virtualmin software Available in Open Source community-supported edition, and a more feature-filled Professional web Licence version.

Virtualmin GPL

This is the absolutely free version, licensed under the GPL. It is under active development, but does not contain all of the features of the Pro version.

Virtualmin Pro

This is the commercial version that you have to pay for. It includes numerous features not in the GPL version.

More details about can be found from below link

https://www.virtualmin.com/buy/virtualmin

Virtualmin is build on top of Webmin, where Webmin is a Linux/UNIX systems management graphical user interface. So in additional to virtual web hosting capabilities like manage websites, mailbox users, databases, and web applications the Virtualmin also have the capability of managing Server settings. Virtualmin is for serious system administrators who expect more than just a flashy user interface over the LAMP stack.

The url used to access Virtualmin and Webmin are identical and features available in the panel depend on the Permission level of user we used to login. We use the provided install script for everything we need to use with Virtualmin, including Webmin. After installation we will configure everything we need to setup before creating a website through virtualmin using graphical interface. After that we will create our first website through virtualmin.

The New Virtualmin software is Faster, Better, Flexible, More Configurable User interface and Mobile friendly than the older versions.

Virtualmin Operating System Supports.

Virtualmin can be installed on CentOS 6,7,8 Systems, Debian 9 and 10 , Ubuntu 16.04 LTS, 18.04 LTS and 20.04 LTS.

The installation script for any of these supported OS are same. In this blog post we are discussing about how to install virtualmin GPL Control Panel on centos7. You can also refer this article if your server has different Operating system. The idea of implementation is identical. Below are the main topic we discuss.

  • Install and Run Post installation Wizard.
  • Change Format for email usernames of domains.
  • Install Multiple PHP versions -Virtualmin
  • Creating a Virtual Server ( Hosting a Website) through Virutalmin Control panel.
  • Install Let’s Encrypt SSL Certificate Automatically in Virtualmin / Webmin
  • Request and install Let’s Encrypt SSL Certificate for Virtual domains.
  • How to Setup or Change Hostname through Virtualmin/Webmin
  • Issue SSL for server hostname
  • Installing Roundcube and PhpMyAdmin in Virtualmin
  • How to create an email account
  • How to create an FTP account
  • How to change PHP script execution mode as Apache mod_php, cgi, fcgid or FPM
  • How to edit PHP.INI Virtualmin
  • How to create MySQL database and associate a user in Virtualmin

Now lets get started.Download the desired Virtualmin installer.

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

Before proceeding with executing the install script, make sure packages like postfix, mariadb, mysql, httpd, dovecot, courier are not installed in the server. If its already installed, remove those.

Execute the installation script and that’s it.

Copy to Clipboard

We have noticed below error message in the installation screen. But we can ignore it and can Proceed with the Post installation Configuration.

Copy to Clipboard

Configuring Virtualmin Using The Post-Installion Wizard

Now access the Virtualmin using url like “https://SERVERIP:10000“.  Replace SERVERIP with your real server IP address and complete the Post-Installation Wizard. The logins used for Virtualmin panel is server root login details.

  1. The post installation wizard  is necessary to configure packages and elements of the Virtualmin. So click “Next”  to continue to post installation wizard.
  2. Continue to click “Next” button until post installation wizard window  for “MySQL Password ” appears.
  3. Put a desired MySQL password in the wizard and click “Next” and I got below error in next window.
Copy to Clipboard

But over SSH I can see the mariadb service is running fine. So I rerun the post-installation wizard from beginning by going to System Settings >> “Re-run install Wizard”  option from Virtualmin panel itself.

At this time We Haven’t got any error and click “Next” button and set primary, secondary name servers as you desired. Its better to tick “skip check for resolvability ” if name servers are not registered at registrar end. Complete  rest of the steps by just clicking Next button.

We can check for Configuration errors by clicking “Recheck Configuration” option Under “System Settings”

This Concludes the Virtualmin Post installation Wizard and we are Ready to move with next steps.

Change Format for email usernames of domains.

Now by default for email accounts created through virtualmin has a format of  “username.domain“. It means if we create and email account “info@example.com“, the login username will be “info.example.com“.  For using the regular practice like info@example.com, please follow below steps before creating an email account.

Log in to the Virtualmin Panel  >> switch to  virtualmin tab >> System Settings  >>  Server Template  >>  Default  Settings >> Choose “mail for Domain” from ” Edit template section” drop down menu >>  and change “Format for usernames that include domain” to “username@domain”. >> click “save” button.

Install Multiple PHP versions -Virtualmin

If we have multiple PHP versions installed, Virtualmin allows us to choose which version to use for a  domain, or even per-directory.

Installing PHP 5.6 and PHP 7.0 on Centos 7

Copy to Clipboard

After  the yum installation log in to the  Virtualmin   and clicking System Settings -> Re-Check Config.  we should see something like below.

Copy to Clipboard

Now we can configure which one is the default PHP version used on new Virtual Servers. The default is to use  the Highest available. You can change that default in System Settings -> Server Templates -> Default  Settings-> PHP Options, and on that screen you can set the default PHP version to use in the field Default PHP version.

Now follow below steps for creating a Virtual Server ( Hosting a Website)  through Virutalmin Control panel.

Log in to the Voirtualmin panel as root user >> Switch to Virtualmin Tab >> Click “Create Virtual Server”  >> In the “Domain name” and ” ” Administration password ” field gave website name and password accordingly >>  Leave rest of the settings as is >> Click “Create Server” button.

Install Let’s Encrypt SSL Certificate Automatically in Virtualmin / Webmin

The built-in Let’s Encrypt feature in Webmin and Virtualmin makes it very easy to request, authenticate the domain ownership, create, generate, install, apply and renew SSL certificates and private keys for various virtual servers (domains and websites).

Follow below steps for configure and set up Virtualmin and Webmin to handle and manage everything about Let’s Encrypt SSL certificates.

Issue below command for installing Let’s Encrypt Client.

Copy to Clipboard
  1. Login to Webmin / Virtualmin as root user.
  2. Go to Webmin tab.
  3. Go to Webmin -> Webmin Configuration.
  4. Click or tap on Module Config link or button on the top left corner.
  5. In the text box for Full path to Let’s Encrypt client command, enter the full path to the Let’s Encrypt
  6. client executable (/usr/bin/letsencrypt). Click or tap Save when done.

Request and install Let’s Encrypt SSL Certificate for Virtual domains.

  1. Go to Virtualmin tab.
  2. Select the virtual server / domain which you want to enable SSL protocol with SSL certificate from Let’s Encrypt from the drop-down list.
  3. Select Edit Virtual Server.
  4. Go to Enabled Features.
  5. Check the Apache SSL website enabled?. Hit Save Virtual server when done.
  6. Now go to server Configuration -> Manage SSL Certificate.
  7. Go to Let’s Encrypt tab.
  8. leave settings as is and Hit Request Certificate.

Now we can use the same SSL certificate for securing Webmin, Usermin, Postfix, Dovecot and ProFTPD of the domain name itself.  Let’s say if we secure Webmin, the  virtualmin can access using domain name without having any SSL warning. To do so, go to Server Configuration -> Manage SSL Certificate. In Current Certificate tab,
click or tap Copy to Webmin,Copy to Usermin, Copy to Dovecot, Copy to Postfix, and/or  Copy to ProFTPD for each application you want to use the Let’s Encrypt certificate.

How to Setup or Change Hostname through Virtualmin/Webmin

  1. Log in to Virtualmin Panel
  2. Click on the Webmin section
  3. Select the Networking option
  4. Click the Network Configuration module
  5. Select the Hostname and DNS Client module
  6. In the hostname filed put appropriate name and hit save button.

Now issue SSL for server hostname and access webmin/virtualmin using hostname without having SSL warning.

  1. Go to Webmin -> Webmin -> Webmin Configuration -> SSL Encryption. Then go to Let’s Encrypt tab.
  2. In Hostnames for certificate filed put serverhostname
  3. Choose A different Apache virtual host  option for Website root directory for validation file and
  4. select the main domain virtualhost.
  5. Choose yes for Copy new key and certificate to Webmin?
  6. Click “Request Certificate” button.

For installing Roundcube and PhpMyAdmin in Virtualmin, follow below steps.

Login to Virtulamin  >> Click install scripts >> Click “Available scripts” tab >> Chose “PhpMyAdmin >>  Click “Show install options ” >> Leave settings as is and click “Install Now” button.

Repeat same step for Roundcube install too.

By default PhpMyAdmin and Roundcube installed through virtualmin can be accessed using below url. Replace example.com with the real domain name of yours.

http://example.com/roundcube/

http://example.com/phpmyadmin/

How to create an email account

  1. Log in to the Virtualmin Panel
  2. Choose the domain you would like to add the email account to. You can do that by selecting the domain name from the drop-down box on the top-left.
  3. Click Edit Users.
  4. Click Add a user to this server.
  5. You can now enter the email address, full name, and password to use for this email account. Leave other settings as is.
  6. Click Create, and Virtualmin will add the email account to your server.

How to create an FTP account

  1. Log in to the Virtualmin Panel
  2. Choose the domain you would like to add the FTP account to. You can do that by selecting the domain name from the drop-down box on the top-left.
  3. Click Edit Users.
  4. Click Add a website FTP access user (on the far-right).
  5. In the Email Address, enter the name for the new FTP account.
  6. Enter the FTP user’s name in the Real Name field.
  7. You can enter a password in the Password field if you wish to override Virtualmin’s random password that it puts there by default.
  8. Leave other settings as is
  9. Click Create.

How to change PHP script execution mode  like run domain php scripts as Apache mod_php, cgi, fcgid or FPM

Log in to the Virtualmin panel >> Choose domain name from Virtualmin section >> Click “Server Configuration ” >> Click Website options >>   Select appropriate PHP script execution mode and hot “save” button.

How to edit PHP.INI Virtualmin

  1. Log in to the Virtualmin panel
  2. Choose the domain name from Virtualmin Section
  3. Click “Services ” >> Choose desired PHP version >> Click Resource Limits option.
  4. Here we we can set php limit like memory_limit etc.
  5. Instead of clicking “Resource limits” if we click “Edit Configuration Manually”, we are able to set all php parameters directly through php.ini file.

How to create MySQL database and associate a user in Virtualmin

  1. Log in to the Virtualmin panel
  2. Choose desired domain  >> Click Edit Database option >> Click Create new Database option
  3. Gave Desired Database name and Click Create button.

How to create New database user in virtualmin

  1. Log in to the virtualmin panel
  2. Switch to  Webmin  >>  Click “Servers” >> Click “MySQL Database Server” >> Click “User Permissions”
  3. Click “Create new user” under the table listing current users
  4. Enter a user name and password
  5. Select permissions (these are global privileges – you can set privileges for individual databases in another section). Means leave as is.
  6. Type Host as “localhost”
  7. Click “Create”

To change permissions for specific databases, follow these steps

  1. From the MySQL Database Server page, click “Database Permissions”
  2. Click the name of the database you want to manage
  3. For “Username” toggle the box to the right of the anonymous box and enter the user you want to have permissions for this database
  4. Select the permissions you want to grant. To select multiple permissions, hold the Control key and
  5. click them Click “Save”.

By default the domains document root are like cPanel and its under /home directory. For example like “/home/domainusername/public_html“.  Replace domainusername with real domain user name of yours. Also the default Apache virtual host for domains are created in the file /etc/httpd/conf/httpd.conf. Additionally a Sample Apache Virtualhost entry for domain will look like below.

Copy to Clipboard

From the above virtualhost entry we can see the the php handler for each domains are kept under domains home directory itself. Like in the folder “/home/domainuser/fcgi-bin“. Replace domainuser with your real domain username. If we delete anything from “fcgi-bin” folder, the php scripts won’t run under website.

This concludes the installation and configuration of Virtualmin server. Leave your thoughts at the comment box.