Change server mail from postfix to sendmail virtualmin

Hi I have already install an ubuntu server with postfix and sendmail mail servers.Although postfix runs perfectly when I go to Virtualmin panel>Virtual Configuration>And choose sendmail mail server to configure >save and rebuild configuration file I get this : The Read User Mail module is not setup to use the Sendmail mail server. Either adjust its module configuration to match, or change the Virtualmin configuration. I do not know what to do.Any suggestion?

Virtualmin on Ubuntu mail

On my Ubuntu 18.04.2 server I got Virtualmin up and running after clean installation of Virtualmin GPL and Ubuntu

I also set up SSL certificate for Apache, dovecot, and postfix (using same cert). I set up the records from Virtualmin at cloudflare (the dmarc, spf, dkim, and a few A records)

However, connection from a mail client says the certificate is invalid and then after accepting that it says authentication failed

I tried sending mail through roundcube on the server and I got smtp error 250. Sending from the ‘mail’ command works but gets sent to spam

I can’t see if i can receive mail because as I said Roundcube isn’t working (I installed from script installer in Virtualmin) and the ‘mail’ command gives

Cannot open mailbox /var/mail/admin: Permission denied 

My setup is as follows:

  • Host is a dedicated server hosted in a Canada OVH datacenter

  • Actual server is a VirtualBox VM using KVM paravirtualization on said server

  • VM shares IP with host

  • Port forwarding set up for SSH, 443, 80, 465, 993, and 10000 (webmin). All ports allowed in firewall on host and VM

  • Virtualmin has LAMP stack installed and default packages (+Roundcube)

Is there some essential steps in setting up email I’m missing? If I am what did I do wrong? I really need to get this working soon

Migrate from Virtualmin to Plesk or cPanel (specifically the files and databases)

I have a dedicated CentOs 7 server with Virtualmin and quite a few domains on it. I would like to migrate them to an Ubuntu 17.04 server with Plesk. However, I may would be willing to migrate everything to cPanel as a halfway step to Plesk if there’s only a solution for cPanel. Does anyone have a script they could share they have used or have any real world tips?

Options I’ve considered…

  • Fully automated: Migrate all domains and db’s. Anyony have help on this?
  • Partially automated: Manually create the customers and domains in Plesk, then use a bash script to unzip the Virtualmin backup file and move files into appropriate locations and import databases using CLI. This could be a run once thing or manually once for each domain with prompts for specifics like customer info. Thoughts?

Configuring Virtualmin on CentOS 7 for Website Hosting: Part 2

In Part 1 of our tutorial, we installed Virtualmin on CentOS 7 and did some basic configuration. In this second half, we’re going to dive deep into the Linux configuration files to optimize our new server for a low memory footprint. We’re also going to make sure we have a modern version of PHP installed and get all the interfaces secured with a Let’s Encrypt SSL certificate.

Post Installation Work Continues

If you look at your browser’s SSL icon, you’ll notice that there’s no SSL certificate for Virtualmin. We can fix that in just a few steps! Firstly we need to install a virtual host (website) for your server’s FQDN. In our case, that was server.virtualmin-tutorial.tld. We’re going to host virtualmin-tutorial.tld on this server, so we’ll go to the top left of Virtualmin and click “Create Virtual Server”.


Fill in the Domain name (without the “server.” prefix)  and optionally the description field. Set the account password in the “Administration password” field and save it for later reference. You can leave the Administration username to be set Automatically, or you can manually type in your preferred username for this account. Click the arrow next to “Enabled features” to expand this section, and be sure to check the “Setup SSL website too?” box as shown below:

Uncheck the “DAV Login”. Since we’ve done a minimal install, also uncheck the “Accept mail for domain?” box. Now click the green “Create server” button.

When the new Virtual Server is created, you’ll see two options at the bottom of the page. Click on “Return to virtual server details” and then in the top left corner click on “Virtual Server Summary”.

To continue with configuring a Let’s Encrypt SSL certificate, we need to get the DNS pointed at the server. The IP address shown in the Virtual server details is what we need. Go to your DNS provider (CloudFlare for example) and add an A record for your domain that points the following names to your IP:

virtualmin-tutorial.tld www.virtualmin-tutorial.tld server.virtualmin-tutorial.tld 

Of course, substitute virtualmin-tutorial.tld with your actual domain name, and server for your chosen server name. These hostnames will need to point at your servers primary IP address. Once that’s done, and the DNS propagation has occurred, you should be able to view the site in a web browser. If you haven’t added any content, then it’ll simply show a 403 Forbidden error. That’s fine, and we can move on.

As shown below, click the Server Configuration drop down (1) , then SSL Certificate (2), then Let’s Encrypt (3). Click the the “Domain names listed here” box radio button, and paste in the three domain names above into the box. You can omit mail.virtualmin-tutorial.tld (4). Check the screenshot below.



Click the Request Certificate button (5) at the bottom. If your DNS is set up correctly, then this will work with Let’s Encrypt, the free certificate signing authority, and your site and server will receive a Let’s Encrypt SSL certificate- free! It’s every bit as secure as a paid certificate. Since we added “server.virtualmin-tutorial.tld” to the list, now our Virtualmin installation itself will be covered by this certificate! All we have to do is go back to the SSL Certificate menu and click “Copy to Webmin”. While you’re at it, click on the rest of the “Copy to …” buttons as shown below, with the exception of Postfix and Dovecot, since we’re not using email on this server:



When done, close your browser tab and re-open Virtualmin in a new tab. You’ll see that the SSL lock in Chrome is now green. What’s more, when you go to the domain name that you just added the SSL certificate for, you can view it using https:// also.

Finally we want to test and make sure that the server is 100% ready to go. We’re going to use SSH to create an index.php page at our newly created Virtual Server. Our test domain was virtualmin-tutorial.tld, and the automatically assigned user was virtualmin-tutorial. You’ll want to substitute your username below. Notice how we use “su” to Switch User to the user we just created, and then type “exit” to become root again:

[root@server ~]# su virtualmin-tutorial [virtualmin-tutorial@server root]$   cd ~/public_html [virtualmin-tutorial@server public_html]$   echo "<?php phpinfo() ?>" > index.php [virtualmin-tutorial@server public_html]$   exit [root@server ~]#  

Now visit your website in a browser and you’ll see a PHP test page:


Here we have PHP 7.0 installed. PHP 5.4 is also installed, although it is only there for legacy reasons- it should never be used. It is also desirable to use the newest version of PHP available to you, and the RedHat repository has up to PHP 7.2. We’ll install PHP 7.2 and make it the default PHP version for the command line, too. We’re going to install all available PHP modules as well to make sure we aren’t missing anything important.

Run the following command:

yum -y install rh-php72*

Now we can change the PHP version in Virtualmin for the Virtual Server we created. This can be done via Virtualmin’s web interface, but it’s easily done from the command line as well. Be sure to substitute your domain name and username in the following command:

virtualmin set-php-directory --version 7.2 --domain virtualmin-tutorial.tld --dir /home/virtualmin-tutorial/public_html

Let’s check our website. You may just need to refresh your browser page. You should see PHP 7.2 now being the active version:

The only problem now is that the command line still has PHP version 5.4:

[virtualmin-tutorial@server ~]$   php -v PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies  

To resolve this, we’re going to run a simple command that tells bash (the command line) to use a different version of PHP from a Software Collection. The command is called “scl” and if we run “scl -l” we’ll get a list of available Software Collections:

[root@server ~]# scl -l httpd24 rh-php70 rh-php72 

The collection we want to use is rh-php72. Run the following command to use the rh-php72 in bash:

scl enable rh-php72 bash 

Here’s how our output looked. Notice that the second time we ran “php -v” it shows PHP 7.2.0. Now, great utilities like wp-cli will work if you install them. 


Adjusting Apache

Now we’ll adjust settings in Apache so that it doesn’t consume too much memory. If Apache runs out of memory, it can stop working, and all hosted websites will go down. We’ll also make some edits to the PHP configuration. We’re going to use the editor called Nano, which we installed at the beginning of the tutorial. If you’re not sure how to use Nano, don’t worry- we’ll show you the basics.

First we will edit the php.ini file so that it has some more sane limits in it. If you’re going to host a WordPress site for example, you will need more than an 8MB post_max_size and upload_max_filesize. We’re going to use sed again to edit the default values. Run the following command:

sed -i 's/^upload_max_filesize.*/upload_max_filesize = 256M/' /etc/php.ini sed -i 's/^post_max_size.*/post_max_size = 256M/' /etc/php.ini

If you want to edit the test site we installed earlier, then run the same command on its php.ini by adjusting the paths to php.ini in the following commands:

sed -i 's/^upload_max_filesize.*/upload_max_filesize = 256M/'  /home/virtualmin-tutorial/etc/php7.2/php.ini sed -i 's/^post_max_size.*/post_max_size = 256M/' /home/virtualmin-tutorial/etc/php7.2/php.ini

Now we’re going to edit our Apache configuration file using Nano. Nano works a lot like Notepad on the PC, and we’re going to utilize it to add some limits to Apache so that it cannot overload the server easily. Run the following command to edit Apache’s configuration file, httpd.conf:

nano /etc/httpd/conf/httpd.conf

Use the arrows to move the cursor down until you see the following line:


Position the cursor at the end of the line and press Enter 2 or 3 times to create some extra space below it, and the copy/paste the following lines in:

<IfModule prefork.c> MinSpareServers 1 MaxSpareServers 2 </IfModule> <IfModule itk.c> MinSpareServers 1 MaxSpareServers 2 </IfModule> ServerLimit 64 MaxClients 64 MaxRequestsPerChild 1000 KeepAlive On KeepAliveTimeout 5 MaxKeepAliveRequests 128 

Note that these values are very conservative for a small VPS. If you have a larger server, you may increase the values for ServerLimit and MaxClients. If you run into problems and see the error

[error] server reached MaxClients setting, 

In a sites error_log file, then you will need to consider raising theMaxClients setting. These values will work in most cases, however. Here’s how that looked in our httpd.conf:



To exit and save, hold the Control key and press X. You’ll see the following confirmation at the bottom:

Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?

Press Y and then press Enter to confirm that you want to save the file. To confirm that we didn’t make any mistakes, we’ll ask Apache to test the configuration:

[root@server ~]# httpd -t Syntax OK [root@server ~]# 

Great! Now let’s restart Apache to get the new changes to take effect:

[root@server ~]# systemctl restart httpd [root@server ~]#

The Next Steps

From here, you can add several more Virtual Servers (Virtualmin’s name for a web hosting account) using the aforementioned steps, and each can have multiple MySQL databases. You can even install multiple sites per Virtual Server although for security reasons it’s safest to have just one each.

We hope that you’ll enjoy your new Virtualmin based web server and that you’ve found this tutorial informative. Be sure to check out the official Virtualmin documentation  so that you can really unleash the potential of your new server!


Configuring Virtualmin on CentOS 7 for Website Hosting: Part 1

In the professional Linux web hosting world, cPanel rules as king. That’s not necessarily a bad thing! cPanel is rich in features and is for the most part stable and reliable. But it’s also completely unsuitable for a small, inexpensive VPS that you’d find here at LowEndBox.  Most likely the cPanel license will cost significantly more than the VPS you’re using, and it will severely tax the resources of a smaller VPS. Does that mean that you’re out of the web hosting game altogether? Not by a long shot! We have an excellent number of open source control panel options. In this tutorial we’re going to focus on installing one such solution:

Enter Virtualmin. Virtualmin GPL (the Free Open Source version of the Virtualmin commercial product) is a fully featured open source web hosting control panel that allows you to run multiple websites on the same server. Virtualmin  consumes a small amount of disk space (less than 1GB) and supports CentOS, Debian, and Ubuntu without any extra complication. It’s got a friendly web based GUI for server and account management. Furthermore it respects the package manager of your chosen OS and allows you to make configuration changes outside of Virtualmin without overwriting them.

For this tutorial, we’re going to Virtualmin on a CentOS 7 VPS found right here on LowEndBox. Our KVM VPS has 15GB of disk, 1 cpu, and 512mb RAM. How is it possible to have a full web control panel on such a small server, you ask? Read on to find out!

Pre-Installation Preparation

You’re going to need to use SSH throughout this tutorial.  If you haven’t logged into your new VPS yet, then be sure to check our tutorial “Using SSH Keys to connect to your VPS.” It’ll help you to get logged in and configure your SSH keys. 

If you haven’t already chosen a hostname for your server, then we’ll need to do that now. It can be tempting to just use “” but for things to work properly, you need what’s called a Fully Qualified Domain Name. A FQDN uses a prefix like “server” ahead of “virtualmin-tutorial.tld”. The FQDN would be “server.virtualmin-tutorial.tld”. 

If you’ve already chosen a name for your VPS, your VPS provider will have set it for you. Otherwise, you need to set it manually. On CentOS 7 you can set the hostname with the following command, via SSH:

echo "server.virtualmin-tutorial.tld" > /etc/hostname

Next we’re going to turn off SELinux as its use is not supported for our purposes. We’re going to use ‘sed’ which is a Linux program that can perform file edits without even opening the file. The following command changes the current SELINUX= line in /etc/selinux/config to say “disabled”:

sed -i 's/SELINUX=.*$  /SELINUX=disabled/' /etc/selinux/config

Reboot your server to ensure that your hostname is set correctly and that SELinux gets disabled:


Log back into your VPS, and check its hostname to be sure it’s set correctly:

[root@server ~]# hostname server.virtualmin-tutorial.tld 

Let’s also check to make sure SELinux is disabled:

[root@server ~]# getenforce Disabled

Excellent! Now we will install some basic utilities, including a couple that will make our life easier when installing Virtualmin. Run the following command:

yum -y install perl lsof sysstat lsof traceroute whois wget ftp nano

Now we’re ready for the next step: Installation!

Installing Virtualmin

To get Virtualmin into our small VPS, we’re going to make use of the Virtualmin installer minimal install feature that essentially strips out the main memory hogging feature- the email server. While it is possible to install the mail server on 512mb RAM, it’s not advisable because the spam filtering will slow down the server significantly. If you want to enable the mail server features of Virtualmin, it’s advisable to get a VPS with at least 1GB of memory.

One of the luxuries of using Virtualmin is that it will install Apache, MySQL and PHP for you.  We’ll be using the Minimal install as previously noted. If you have a server with 1GB or more memory, you can omit the “–minimal” tag below.

wget sh --minimal

Here’s how the installation looked on our test VPS:


Press “y” to continue. Now, we just wait a few minutes for Virtualmin to install its Minimal stack. While we wait, let’s talk about what’s next. The minimal install skips many of the most memory intensive parts of the server, but it does install a full LAMP stack. In 10 minutes or less the install should be complete! You should see something similar to the following screen:


Down at the bottom right corner you can see a URL for your server’s new control panel. Copy that URL to your notes. Before we continue further, we need to set the root password for MySQL. MySQL has no root password set, and that’s not a secure configuration. Thankfully this is very easy to resolve. In the following few commands, replace “ROOTPASS” with a secure password. The password you choose does not need to be your actual root password. In any case, make sure you have a record of it as we’ll need it later.

First, type “mysql” to get a mysql prompt:

[root@server ~]# mysql Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MariaDB connection id is 25 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> 

Now you can paste in the following, after correcting the root password:

use mysql; update user set password=PASSWORD("ROOTPASS") where User='root'; flush privileges; exit

This is how the process looked on our VPS:


Logging in to Virtualmin

Log in at the Virtualmin control panel URL you previously took note of. Ours is https://server.virtualmin-tutorial.tld:10000. You’ll also note that you’ll receive a security warning when you visit it. The SSL is just a self-signed certificate at this point. Go to the URL in your browser, bypass the SSL certificate errors, and you should be greeted with a login screen for Webmin. Don’t be alarmed- Webmin is what Virtualmin is based on, and the actual server administration is still done with Webmin. Virtualmin handles the virtual hosting portion of the workload.


Log in with the username “root” and with your root password. The Post-Installation Wizard appears. If you get a connection error, try using a private browser- some browser extensions will interfere with Virtualmin.


The Post-Installation Wizard

Go ahead and click on Next and we’ll work through the different options. The first is asking if we want to preload the Virtualmin libraries. We’re going to select No for the sake of keeping memory usage low. If you’ve got a VPS with at least 1GB of memory, you can select Yes.


The format is the same for the rest of the questions.

Run a MariaDB/MySQL database server? Yes (almost everything uses this!)  Run PostgreSQL database server? No (unless you specifically need it) 

Click Next

Now you’ll be presented with the MySQL Password section of the wizard:


Put in the your root password for MySQL that you set earlier. If prompted, select “Yes” for removing the test database and anonymous user. Click Next.

For MariaDB/MySQL configuration size, select Medium System (512M). If you have a larger system, you can select the appropriate size. Click Next.

For the DNS configuration, you have some choices to make. Since our system is only 512M and the BIND DNS service can be a memory hog, we’re going to run our DNS externally. For that, you can just check the “Skip check for resolvability” box and click Next.

The next configuration option is for Password storage. Make a choice that makes sense for you. We chose “Only store hashed passwords” due to its higher security. Click Next, and you’re done with the Post-Installation Wizard. Click the “Re-check and refresh configuration” box and let it complete:


When the “Checking Configuration” screen is done, click on the Dashboard on the left column. You’ll be presented with the following screen:


This is the first screen you’ll see when you log in from now on. The work is not done yet however- we still have several things to complete! The next steps will involve setting up an SSL certificate for Virtualmin, configuring Apache so that it has a smaller memory footprint, and installing an updated PHP version and making some PHP configuration tweaks. All of these things are considered in the second half of this tutorial:

Configuring Virtualmin on CentOS for Website Hosting: Part 2