Virtualmin is a free control panel with powerful features to manage VPS and dedicated servers. It has all the features that cPanel offer. It is more powerful than cPanel in my opinion. It’s the best tool to configure and manage web servers on Amazon Web Services. I’m going to show you how to install Virtualmin on AWS EC2 instance with LEMP stack in this post.
LEMP stands for Linux, Nginx, MySQL and PHP. We’ll be installing Ubuntu 16.04, Nginx v1.10.3, MySQL v5.7.23 and PHP v7.0.30 on Amazon Web Services to host websites.
Virtualmin comes with an installation script that can install Nginx, PHP 7, MySQL and other useful software on your server. We’re going to use this script to build our web server on AWS EC2 Instance. Although it may sound simple, it requires a bit of work from our side. But don’t worry, I’ve got you covered. You can follow step-by-step instructions on this page to install Virtualmin on AWS EC2 instance with LEMP stack.
Step #1 – Launch an EC2 Instance with Ubuntu as OS
Ubuntu is my favorite OS for web servers. All my tutorials will be for Ubuntu. So you should also go with Ubuntu to take advantage of my tutorials.
In this step, we’ll create an EC2 instance and security group which will allow traffic on port 22, 80, 443 and 10000. These are the most important ports on our setup. And there are few more important tasks in this step. Complete the tutorial below and come back here for the next step.
Tutorial: Launch an Amazon EC2 Instance
Step #2 – Attach an Elastic IP to EC2 Instance
EC2 instances come with a dynamic public IP address by default. This will be a problem for Virtualmin as it hardcodes servers IP address to most its services. Although there is an option to change IP address in such cases, we should avoid such sensible tasks. We can do it by allocating an Elastic IP address for our instance. Elastic IPs are static IPs and you are able to control which EC2 instance it’s pointing to from your EC2 dashboard. Complete the steps on following tutorial.
Tutorial: Attach an Elastic IP EC2 Instance
Step #3 – Login to Amazon EC2 Instance
Now that you have an EC2 instance with static IP address, it’s time to login to it. Remember that PEM keyfile you downloaded during step #1? It’s time to use it.
Mac users can use this file directly with Terminal to login to EC2 instance. I can’t help with that since I’m not on a Mac. Sorry Mac users!!
But on Windows, you should convert this file to use with Putty application. Putty is a SSH client for WIndows. it supports PPK keyfiles. Putty also have an application called PuttyGen that enables users to convert PEM files to PPK file format. Follow below tutorial to convert your PEM keyfile.
Tutorial: Using Key Pairs with EC2 Instances
Step #4 – Install Virtualmin on EC2 Instance
If you’ve done everything above, you’re ready to install Virtualmin on AWS EC2 instance with LEMP Stack. Your EC2 instance is now a regular VPS behind solid firewall and Amazon magic. Executing Virtualmin installation script with a special argument will build the LEMP stack for you. Then we will install few PHP 7 modules that are commonly used by PHP applications. Finally we will secure MySQL installation.
That concludes the instructions to install Virtualmin on AWS EC2 instance with LEMP Stack. Your EC2 instance is now fully capable of hosting multiple websites. If you have faced with errors, please create a topic on our server administration forum. I’ll try my best to help.