Virtualmin is a web hosting control panel for Linux and BSD systems like cPanel or Plesk. Virtualmin is the cost-effective and comprehensive solution to virtual web hosting management because two versions of Virtualmin exist, under separate licenses. In this blog post we are discussing about how to install virtualmin Control Panel on centos7
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.
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
Follow below steps to install free virtualmin version on Centos7 and proceeding with hosting a website through Virtualmin Panel.
Download the desired Virtualmin installer.
Now 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.
Now just need to execute the installation script and that’s it.
We have noticed below error message in the installation screen.
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.
- The post installation wizard is necessary to configure packages and elements of the Virtualmin. So click “Next” to continue to post installation wizard.
- Continue to click “Next” button until post installation wizard window for “MySQL Password ” appears.
- Put a desired MySQL password in the wizard and click “Next” and I got below error in next window.
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”
Now by default for email accounts created through virtualmin has a format of “username.domain“. It means if we create and email account “firstname.lastname@example.org“, the login username will be “info.example.com“. For using the regular practice like email@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
After the yum installation log in to the Virtualmin and clicking System Settings -> Re-Check Config. we should see something like below.
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.
- Login to Webmin / Virtualmin as root user.
- Go to Webmin tab.
- Go to Webmin -> Webmin Configuration.
- Click or tap on Module Config link or button on the top left corner.
- In the text box for Full path to Let’s Encrypt client command, enter the full path to the Let’s Encrypt
- client executable (/usr/bin/letsencrypt). Click or tap Save when done.
Request and install Let’s Encrypt SSL Certificate for Virtual domains.
- Go to Virtualmin tab.
- Select the virtual server / domain which you want to enable SSL protocol with SSL certificate from Let’s Encrypt from the drop-down list.
- Select Edit Virtual Server.
- Go to Enabled Features.
- Check the Apache SSL website enabled?. Hit Save Virtual server when done.
- Now go to server Configuration -> Manage SSL Certificate.
- Go to Let’s Encrypt tab.
- 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
- Log in to Virtualmin Panel
- Click on the Webmin section
- Select the Networking option
- Click the Network Configuration module
- Select the Hostname and DNS Client module
- 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.
- Go to Webmin -> Webmin -> Webmin Configuration -> SSL Encryption. Then go to Let’s Encrypt tab.
- In Hostnames for certificate filed put serverhostname
- Choose A different Apache virtual host option for Website root directory for validation file and
- select the main domain virtualhost.
- Choose yes for Copy new key and certificate to Webmin?
- 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.
How to create an email account
- Log in to the Virtualmin Panel
- 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.
- Click Edit Users.
- Click Add a user to this server.
- You can now enter the email address, full name, and password to use for this email account. Leave other settings as is.
- Click Create, and Virtualmin will add the email account to your server.
How to create an FTP account
- Log in to the Virtualmin Panel
- 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.
- Click Edit Users.
- Click Add a website FTP access user (on the far-right).
- In the Email Address, enter the name for the new FTP account.
- Enter the FTP user’s name in the Real Name field.
- You can enter a password in the Password field if you wish to override Virtualmin’s random password that it puts there by default.
- Leave other settings as is
- 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
- Log in to the Virtualmin panel
- Choose the domain name from Virtualmin Section
- Click “Services ” >> Choose desired PHP version >> Click Resource Limits option.
- Here we we can set php limit like memory_limit etc.
- 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
- Log in to the Virtualmin panel
- Choose desired domain >> Click Edit Database option >> Click Create new Database option
- Gave Desired Database name and Click Create button.
How to create New database user in virtualmin
- Log in to the virtualmin panel
- Switch to Webmin >> Click “Servers” >> Click “MySQL Database Server” >> Click “User Permissions”
- Click “Create new user” under the table listing current users
- Enter a user name and password
- Select permissions (these are global privileges – you can set privileges for individual databases in another section). Means leave as is.
- Type Host as “localhost”
- Click “Create”
To change permissions for specific databases, follow these steps
- From the MySQL Database Server page, click “Database Permissions”
- Click the name of the database you want to manage
- For “Username” toggle the box to the right of the anonymous box and enter the user you want to have permissions for this database
- Select the permissions you want to grant. To select multiple permissions, hold the Control key and
- 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.
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.