Do you want to know How to install Virtualmin on Ubuntu 18.04 Server? You have made the right choice! Since Virtualmin is one the best Open Source VPS Control Panel, managing your LAMP stack will be super easy. For this tutorial, I will assume that you already have a VPS running Ubuntu 18.04 and you have SSH root access to your VPS.
If you are using Google Cloud Platform then you can follow this tutorial to connect your Cloud Instance through SSH.
In this tutorial, you will learn
- Prepare Your VPS to Install Virtualmin
- Adding Ondřej Surý’s PHP & Ondřej Surý’s Apache Repository For Latest Version of PHP & Apache
- Tutorial: How to Install Virtualmin On Ubuntu 18.04 & Complete Initial Setup
- Virtualmin Post Installation Process
1. Preparing Ubuntu 18.04 to Install Virutalmin
In the first step, we will prepare our Ubuntu 18.04 VPS to Install Virtualmin. Once we are done with this step then, we can move on to How to install Virtualmin on Ubuntu 18.04 Server.
We will start by configuring the hostname for your VPS. For that, you will first need to choose an FQDN (Fully Qualified Domain Name) such as test.thetechpro.in. Once you have decided on a hostname for your VPS, we can now change the hostname of your VPS to your desired hostname. Once we are done with the basic nitty-gritty we will proceed further on How to Install Virtualmin on Ubuntu 18.04 Follow the steps mentioned below to change your hostname.
i. Run the following command to check the current hostname of your VPS.
root@test:~# hostname -f
ii. Now to change the hostname you will need to use the hostnamectl command. In the following command replace test.thetechpro.in with your desired hostname.
root@test:~# hostnamectl set-hostname test.thetechpro.in
iii. Once you execute the command given below, you can now confirm your new hostname by running the hostnamectl command. You should get an output like this.
root@test:~# hostnamectl set-hostname test.thetechpro.in root@test:~# hostnamectl Static hostname: test.thetechpro.in Icon name: computer-vm Chassis: vm Machine ID: e2e2e8dbad39728dd018a4fbfc338164 Boot ID: 227f3d3761344482b76da24b5d6b5c1c Virtualization: kvm Operating System: Ubuntu 18.04.4 LTS Kernel: Linux 5.3.0-1030-gcp Architecture: x86-64
Once you have finished setting up the hostname of you Ubuntu 18.04 Server you should now reboot your system and then you are ready to proceed to the next step in this tutorial on How to Install Virtualmin on Ubuntu 18.04.
You can also check Install cURL 7.71.0 on Ubuntu 18.04 Server From Scratch
2. Adding Ondřej Surý’s PHP & Ondřej Surý’s Apache Repository For Latest Version of PHP & Apache
Ubuntu 18.04 ships with PHP 7.0 by default which is quite old and slow. The latest version of PHP is 7.4.7 which can be installed using the Ondřej Surý’s PHP repository. So before we proceed further in the tutorial on How to install Virtualmin on Ubuntu 18.04 we are going to make sure we use the latest packages.
To make sure that the Virtualmin LAMP stack we install has the latest versions of PHP and Apache use the commands given below and add the Ondřej Surý’s PHP repository to get the latest version of PHP. Then before we proceed further in the tutorial on How to install Virtualmin on Ubuntu 18.04 we will also add the Ondřej Surý’s Apache Repository which will provide us with the latest version of Apache.
i. Firstly you will need to install a package names software-properties-common which can be installed using the following command.
root@test:~# apt install software-properties-common
ii. Once you install the above mentioned package update apt cache.
root@test:~# apt update
iii. Now use the following command to add the Ondřej Surý’s PHP repository.
root@test:~# add-apt-repository ppa:ondrej/php
iv. Once you enter the command to add Ondřej Surý’s PHP repository you will get a prompt screen shown below. Now you can press ENTER to confirm adding Ondřej Surý’s PHP repository.
root@test:~# add-apt-repository ppa:ondrej/php Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided. Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa You can get more information about the packages at https://deb.sury.org BUGS&FEATURES: This PPA now has a issue tracker: https://deb.sury.org/#bug-reporting CAVEATS: 1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman 2. If you are using apache2, you are advised to add ppa:ondrej/apache2 3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline or ppa:ondrej/nginx PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/ WARNING: add-apt-repository is broken with non-UTF-8 locales, see https://github.com/oerdnj/deb.sury.org/issues/56 for workaround: # LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php More info: https://launchpad.net/~ondrej/+archive/ubuntu/php Press [ENTER] to continue or Ctrl-c to cancel adding it.
v. Now once you have added the repository for installing the latest version of PHP you can add the Ondřej Surý’s Apache Repository to install the latest version of Apache. Press ENTER once you get the prompt screen for adding Ondřej Surý’s Apache Repository.
root@test:~# add-apt-repository ppa:ondrej/apache2 This branch follows latest Apache2 packages as maintained by the Debian Apache2 team with couple of compatibility patches on top. It also includes some widely used Apache 2 modules (if you need some other feel free to send me a request). BUGS&FEATURES: This PPA now has a issue tracker: https://deb.sury.org/#bug-reporting PLEASE READ: If you like my work and want to give me a little motivation, please consider donating: https://deb.sury.org/#donate More info: https://launchpad.net/~ondrej/+archive/ubuntu/apache2 Press [ENTER] to continue or Ctrl-c to cancel adding it.
NOTE: We have only added the repositories for the latest versions of PHP and Apache. Once the repositories are added the latest versions of PHP and Apache will automatically install when we proceed on How to install Virtualmin on Ubuntu 18.04.
Now you are ready to install Virtualmin LAMP Stack on Ubuntu 18.04 LTS and you can proceed to the next section of the tutorial.
Tutorial: How to Install Virtualmin On Ubuntu 18.04 & Complete Initial Setup
Once all things are in place we are now ready to install Virtualmin LAMP Stack on our Ubuntu 18.04 Server. In this section, we will now proceed to download the Virtualmin Install script. Follow these commands to proceed with the tutorial on How to Install Virtualmin on Ubuntu 18.04.
i. Firstly download the Virtualmin install script using wget.
root@test:~# wget http://software.virtualmin.com/gpl/scripts/install.sh root@test:~# sudo /bin/sh install.sh
ii. Once you execute the above command the script will start the installation process for Virtualmin with default options. Once it checks the system it will show a warning message showing the list of supported OS. Enter y and then the installation will proceed.
root@test:~# sudo /bin/sh install.sh 2020-07-23 02:59:03 URL:https://software.virtualmin.com/lib/slib.sh [22148/22148] -> "slib.sh"  Welcome to the Virtualmin GPL installer, version 6.2.0 This script must be run on a freshly installed supported OS. It does not perform updates or upgrades (use your system package manager) or license changes (use the "virtualmin change-license" command). The systems currently supported by install.sh are: CentOS/RHEL Linux 6, 7, and 8 on x86_64 Debian 8, 9, and 10 on i386 and amd64 Ubuntu 16.04 LTS, 18.04 LTS, and 20.04 LTS on i386 and amd64 If your OS/version/arch is not listed, installation will fail. More details about the systems supported by the script can be found here: https://www.virtualmin.com/os-support The selected package bundle is LAMP and the size of install is full. It will require up to 650 MB of disk space. Exit and re-run this script with --help flag to see available options. Continue? (y/n) y
iii. After the installation is complete you will get an output like this which confirms that you have successfully installed Virtualmin LAMP stack on your VPS.
[INFO] Started installation log in /root/virtualmin-install.log ▣□□ Phase 1 of 3: Setup Downloading RPM-GPG-KEY-virtualmin-6 [ ✔ ] Downloading RPM-GPG-KEY-webmin [ ✔ ] Installing Virtualmin 6 key [ ✔ ] Installing Webmin key [ ✔ ] Updating apt metadata [ ✔ ] Downloading repository metadata [ ✔ ] Enabling universe repositories, if not already available [ ✔ ] Disabling cdrom: repositories [ ✔ ] Cleaning out old metadata [ ✔ ] ▣▣□ Phase 2 of 3: Installation Installing Webmin [ ✔ ] Installing Usermin [ ✔ ] Installing fail2ban [ ✔ ] Removing nginx (if installed) before LAMP installation. [ ✔ ] Removing unneeded packages that could confict with LAMP stack. [ ✔ ] Installing postfix [ ✔ ] Installing virtualmin-lamp-stack [ ✔ ] Installing Virtualmin and plugins [ ✔ ] 23 Jul 03:06:59 ntpdate: adjust time server 188.8.131.52 offset -0.000510 sec Installing updates to Virtualmin-related packages [ ✔ ] ▣▣▣ Phase 3 of 3: Configuration [1/23] Configuring AWStats [ ✔ ] [2/23] Configuring Apache [ ✔ ] [3/23] Configuring Bind [ ✔ ] [4/23] Configuring ClamAV [ ✔ ] [5/23] Configuring Dovecot [ ✔ ] [6/23] Configuring Firewalld [ ✔ ] [7/23] Configuring MySQL [ ✔ ] [8/23] Configuring NTP [ ✔ ] [9/23] Configuring Net [ ✔ ] [10/23] Configuring ProFTPd [ ✔ ] [11/23] Configuring Procmail [ ✔ ] [12/23] Configuring Quotas [ ✔ ] [13/23] Configuring SASL [ ✔ ] [14/23] Configuring Shells [ ✔ ] [15/23] Configuring SpamAssassin [ ✔ ] [16/23] Configuring Status [ ✔ ] [17/23] Configuring Upgrade [ ✔ ] [18/23] Configuring Usermin [ ✔ ] [19/23] Configuring Webalizer [ ✔ ] [20/23] Configuring Webmin [ ✔ ] [21/23] Configuring Fail2banFirewalld [ ✔ ] [22/23] Configuring Postfix [ ✔ ] [23/23] Configuring Virtualmin [ ✔ ] ▣▣▣ Cleaning up [SUCCESS] Installation Complete! [SUCCESS] If there were no errors above, Virtualmin should be ready [SUCCESS] to configure at https://test.thetechpro.in:10000 (or https://10.128.0.29:10000). [SUCCESS] You'll receive a security warning in your browser on your first visit.
The above screen confirms that we have successfully installed Virutalmin LAMP Stack on Ubuntu 18.04 Server. Now we can move to the browser to complete the Virtualmin Post Installation Process.
Now before proceeding further if you haven’t already set up your root password you need to do it now. If you have already set a password for your root account then you can surely skip this step. Otherwise, follow along to set the password for your root account.
You can access Virtualmin over port 10000 on the External IP Address of your VPS or your domain. Since we want access Virtualmin Control Panel over our domain which we also selected as our hostname, we will need to add some DNS records for our domain.
You can visit your domain registrar and add the following record to the DNS configuration of your domain.
Once the DNS records are in place you will be able to access the Virtualmin Control Panel over your domain at port 10000.
Complete Virtualmin Post Installation Process
Now you are at the final step of completing this tutorial on How to Install Virtualmin on Ubuntu 18.04. Once you are able to access the Virtualmin Control Panel over your domain at port 10000 we are now ready to proceed with the Virtualmin Post Installation process.
In my case, the URL to access Virtualmin Control Pannel will be https://test.thechpro.in:10000 Make sure you use HTTPS instead of HTTP while accessing the Virtualmin Control Panel.
Once you enter the URL in your browser you will receive a security warning saying your connection isn’t secure. For the time being, we complete the Virtualmin Post Installation process you can ignore this warning and still proceed to the Webmin Login page.
Once you have logged in we can now proceed withe the Virutalmin Post Installation Process. You can leave most of these settings at default but I prefer to make the changes mentioned below.
1. You can say Yes to Preload Virtualmin Libraries which will make the Virtualmin UI load faster and say No to Run email domain lookup server which will save CPU and RAM if you will not be hosting an email server on your VPS. In case you plan to host an email server then you can leave the second option unchanged and press Next.
2. Since I will not be hosting an Email server, I don’t need the ClamAV Virus Scanning feature so its better turn of ClamAV for smoother performance. In case you are hosting an Email Server, you can leave the option unchanged and press Next.
3. On the next page leave both options Run MariaDB/MySQL database server and Run PostgreSQL database server unchanged and click on the Next button.
4. On the next page set your MySQL password for root user.
On the MariaDB/MySQL Database Size configuration page choose the MariaDB/MySQL Database Size according to the amount of RAM available on your VPS.
6. Although Virtualmin offers the functionality to use the server as a name-server, I recommend using the nameservers of your Domain Provider or use Cloudflare due to a lot of its advantages over setting up your own vanity nameservers using Virtualmin.
On the DNS Configuration page check Skip check for resolvability check box and proceed by clicking the next button.
7. On the next page check the Only Store Hashed Passwords Option for better security and click next.
Once the Virtualmin Post Installation process is complete click the Recheck and refresh Configuration button to complete the initial setup and start using Virtualmin.
On the completion of the Recheck Virtualmin Configuration process, you will get a page like this.
In case you have any kind of errors on this page then you can comment them below. I will try to reply and solve your queries ASAP.
Now you have successfully Installed and Configured your Virutalmin LAMP Stack and you have successfully finished this tutorial on How to Install Virtualmin on Ubuntu 18.04.
You can now set up a new Virutalsever in Virtualmin and add your domains and host multiple websites on your Ubuntu 18.04 Server.
If you have any kind of questions, doubts, or comments about How to Install Virtualmin on Ubuntu 18.04, make sure you post them below. I will try to reply to them ASAP ❤