Part 1 – Low box

In the professional world of Linux web hosting, cPanel is king. This is not necessarily a bad thing! cPanel is rich in features and is mostly stable and reliable. But it's also totally inappropriate for a small inexpensive VPS that you'll find here at LowEndBox. Most likely The cPanel license will cost a lot more than the VPS you use, and it will put a lot of strain on the resources of a smaller VPS. Does this mean that you are totally out of the web hosting game? Not far! We have an excellent number of open source control panel options. In this tutorial, we will focus on installing one of these solutions:

Enter Virtualmin. Virtualmin GPL (the free open source version of the Virtualmin commercial product) is a complete open source web hosting control panel that allows you to run multiple websites on the same server. Virtualmin consumes little disk space (less than 1GB) and supports CentOS, Debian, and Ubuntu without any additional complication. It has a user-friendly, web-based graphical interface for managing servers and accounts. In addition, it respects the package manager of your chosen operating system and allows you to change the configuration outside of Virtualmin without overwriting them.

For this tutorial, we will use Virtualmin on a CentOS VPS 7 found here even on LowEndBox. Our VPS KVM has 15 GB of disk, 1 CPU and 512 MB of RAM. How is it possible to have a complete web control panel on such a small server, ask yourself? Keep reading to find out!

You will need to use SSH throughout this tutorial. If you have not connected to your new VPS yet, be sure to check out our tutorial "Using SSH keys to connect to your VPS. "This will help you connect and configure your SSH keys.

If you have not yet chosen a hostname for your server, we need to do it now. It may be tempting to simply use "yourawesomevps.com", but for everything to work properly, you need what's called a fully qualified domain name. A fully qualified domain name uses a prefix such as "server" in front of "virtualmin-tutorial.tld". The fully qualified domain name would be "server.virtualmin-tutorial.tld".

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

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

We will now disable SELinux because its use is not supported for our purposes. We will use 'sed', a Linux program that can edit files without even opening the file. The following command modifies the current SELINUX = line in / etc / selinux / config to indicate "disabled":

sed -i / # 39; s / SELINUX =. * $ / SELINUX = disabled / / / / selinux / config

Restart your server to make sure your hostname is set correctly and that SELinux is disabled:

to restart

Reconnect to your VPS and check its host name to make sure it is properly configured:

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

Let's also check that SELinux is disabled:

[root@server ~]# getenforce
disabled

Excellent! We will now install some basic utilities, including some utilities that will make our life easier when installing Virtualmin. Run the following command:

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

We are now ready for the next step: installation!

To install Virtualmin in our small VPS, we will use the Virtualmin installer. minimal installation feature that basically removes the main functionality of memory hogging, the mail server. Although it is possible to install the mail server on 512 MB of RAM, it is not recommended because spam filtering will significantly slow down the server. If you want to enable Virtualmin's mail server features, it is advisable to get a VPS with at least 1GB of memory.

One of the advantages of using Virtualmin is that it will install Apache, MySQL and PHP for you. We will use the minimal installation as previously stated. If you have a server with 1 GB or more of memory, you can omit the "-minimal" tag below.

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

Here is what the installation looked like on our VPS test:

Press "y" to continue. We are now waiting a few minutes for Virtualmin to install its minimal stack. As we wait, let's talk about the next step. The minimal installation ignores most of the server parts that use the most memory, but installs a full LAMP stack. In 10 minutes or less, the installation should be complete! You should see something similar to the following screen:

In the lower right corner, you can see a URL for your server's new control panel. Copy this URL into your notes. Before continuing, we need to set the root password for MySQL. MySQL has not set a root password, which is not a secure configuration. Fortunately, it is very easy to solve. In the following few commands, replace "ROOTPASS" with a secure password. The password you choose does not have to be your root password. In any case, make sure you have a record of it because we will need it later.

First, type "mysql" to get a mysql prompt:

[root@server ~]# mysql
Welcome to the MariaDB monitor. Orders end with; or  g.
Your MariaDB login is 25
Server Version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Ab Corporation and others.
Type 'help'; or & # 39;  h & # 39;  h & # 39; to get help. Type & # 39;  c & # 39; to clear the current entry statement.
MariaDB [(none)]>

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

use mysql;
update the user defined password = PASSWORD ("ROOTPASS") where User = "root";
hunting privileges;
exit

Here is what the process looked like on our VPS:

Log in to the Virtualmin Control Panel URL that you noted earlier. Ours is https: //server.virtualmin-tutorial.tld: 10000. You will also notice that you will receive a security warning when you visit it. SSL is just a self-signed certificate at this point. Navigate to your browser's URL, work around SSL certificate errors, and receive a login screen for Webmin. Do not worry – Webmin is the foundation of Virtualmin and server administration is always done with Webmin. Virtualmin manages the virtual hosting part of the workload.

Log in with the user name "root" and with your root password. The post-installation wizard appears. If you experience a connection error, try using a private browser. Some browser extensions will interfere with Virtualmin.

Go ahead and click Next to go to the different options. The first is to ask if we want to preload the Virtualmin libraries. We will select No to not use the memory too much. If you have a VPS with at least 1 GB 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 that!) 
Run the PostgreSQL database server? No (unless you specifically need it)

Click Next

The "MySQL Password" section of the wizard will now be presented to you:

Enter your MySQL root password that you defined earlier. If prompted, select "Yes" to delete the test database and the anonymous user. Click Next.

For the size of the MariaDB / MySQL configuration, select Medium System (512 MB). 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 512 million euros and the BIND DNS service can be a real memory machine, we will run our DNS externally. For this, you can simply check the box "Ignore the resolvability check" and click Next.

The following configuration option is for storing passwords. Make a choice that makes sense to you. We chose "Store only hashed passwords" because of its increased security. Click Next. The post-installation wizard is complete. Click on the "Check Again and Update Configuration" box and let it finish:

When the "Configuration Check" screen is complete, click on the dashboard in the left column. The following screen will be presented to you:

This is the first screen you will see when you log in from now. The work is not over yet, however, we still have several things to do! The next steps will be to configure an SSL certificate for Virtualmin, configure Apache to reduce memory clutter, install an updated version of PHP, and change the configuration of PHP. All of these things are considered in the second half of this tutorial:

Configuring Virtualmin on CentOS for Web Hosting: Part 2