How To: Install WHM & cPanel using AWS EC2

How To: Install WHM & cPanel using AWS EC2

Let’s say you need to find hosting for 50 WordPress applications with unique cPanel backend access so clients cannot access each others backends. What can you do to create a secure hosting environment without paying for 50 separate hosting accounts?

Host it yourself!

Disclaimer: If you have one small to mid sized website, this probably isn’t the most cost effective route to go, however, if you are currently paying to host several websites and have some technical background, hosting a site yourself may be a great route to consider. Before deploying a WHM & cPanel server do some research to ensure you know what you’re doing! It can get tricky! Also, this is a how-to for installing WHM & cPanel on AWS, for setting up WHM & cPanel, please refer to cPanel’s documentation

Okay, now that we got that out of the way, let’s dive into the fun stuff. Before you can do anything, you’ll need to sign up for Amazon Web Services. The sign up process is pretty simple and with your new account you’ll get Amazon’s Free Tier which will let you try a lot of Amazon’s products for a year without paying a penny!
Once you are signed up, you’ll be presented with your dashboard. The first thing you’ll want to do is scroll down to the, “Networking” heading and select, “VPC.” Now select, “Start VPC Wizard.” The default selection is a VPC with a Single Public Subnet, this is what you want to select.

On the second step all you need to do is enter a VPC name, then hit, “Create VPC.” Once the VPC has been created, hit, “OK.”

Now you’ll be presented with your VPC Dashboard, what you will want to do is navigate to the, “Security” heading and select, “Security Groups.” From this page, select, “Create Security Group” and identify a name and description for the group. Then under VPC select your newly created instance and hit, “Yes, Create.”

Next, you’re going to want to navigate to your EC2 Dashboard. Go to your home page and under the Compute heading select, “EC2.” Once you are on the dashboard select, “Launch Instance.” 

You will now be presented with a list of Amazon Machine Images (AMI’s) to select from. You’re going to want to select, “CentOS 7 (x86_64) with Updates HVM” from the AWS Marketplace. To find this, you may need to search for it under the AWS Marketplace tab. Once you have found the AMI, hit, “Select.”

For the next step, you will want to choose an instance type. You will want to choose an instance that reflects your needs, however, the t2.micro is covered under Amazon’s Free Tier. It’s also worth noting that for the best experience, you should choose a t2.micro or higher. When you have selected the desired Instance Type, select, “Next: Configure Instance Details.”

Step 3 is where you will configure Instance Details, what’s important here is that you select the network you just created and tick the box to protect against accidental termination. Once you have done that, hit, “Next: Add Storage.”

For the Add Storage step, be sure to allocate enough storage for your needs. Keep in mind that under Amazon’s Free Tier, you can get 30GB of EBS General Purpose (SSD) or Magnetic Storage. Once you have set a size and changed the volume type to General Purpose SSD, select, “Next: Tag Instance.” Then select, “Next: Configure Security Group.”

In Step 6, you want to check the radio button for, “Select an existing security group.” Once you select that button, choose the Security Group you created earlier. Once selected, hit, “Review & Launch.”

Step 7 is where you can review what we just set and hit, “Launch.” When you hit, “Launch” a box will appear to select an existing key pair or create a new key pair.  You want to create a new key pair and download it. Once the Key Pair has been downloaded, hit, “Launch Instance.”

Once you instance has been launched, select your instance to the left of the, “View launch log” link at the top of the screen. I would personally recommend naming your instance before moving forward.

Now navigate to the Network and Security heading and select, “Elastic IPs.” Here is where you’re going to want to, “Allocate New Address.” Once you have selected it, confirm you want to allocate a new address and hit, “Actions” and “Associate Address.” Select your instance and tick the box for, “Reassociation” and click, “Associate.”

Now, you’re going to want to navigate to the Network and Security heading and select, “Security Groups.” Select your security group and select the, “Inbound” tab. Now hit, “edit.” Select for the type, “All Traffic” and the source, “My IP.” Then hit, “Add Rule” and add HTTP from the source, “Anywhere” and do the same with HTTPS as well. Once you are finished, hit, “Save.”

Installing WHM & cPanel

Congratulations! You’ve made it to the fun part! Now we can connect to our brand new EC2 instance via SSH and install WHM & cPanel.

If you’re using macOS or Linux, simply do the following:

  1. Open Terminal
  2. Enter this command into the application:

Now enter this command:

You are now accessing your Amazon EC2 Server!

Time to do some installing! First, to take root, type, “sudo su” and hit enter. Now to install Perl type, “yum install perl” and hit enter. It will ask if this is okay, hit y and hit enter. It will then ask to hit y again, do so and hit enter. Once that is complete, type, “sudo yum install wget” and hit enter. Hit y and enter when prompted and then type, “cd /home.”

Now it’s time to install cPanel, enter, “wget -N http://httpupdate.cpanel.net/latest.” Now let’s execute the installation files by entering, “sh latest.” If you get an error, enter, “hostname host.yourdomainname.com.” Now enter, “sh latest” once again and the installation should begin. Give this some time as it may take up to an hour.

Once the installation is finished, you should see a message that says the following: “Congratulations! Your installation of cPanel & WHM is now complete. The next step is to configure your server.”

The first thing you’re going to want to do is enter the command, “passwd root.” This will prompt you to change the root password which is very important.

Accessing WHM

You did it! Using the IP Address assigned to you from Amazon, go to https://youramazonip:2087 and just like that you have installed WHM and cPanel on your very own Amazon Web Server!

Questions? Let me know in the comments below! If you liked this article, please share it with others!

About the Author
Brandon Bernicky
Brandon Bernicky is the founder and President of Nextsulting LLC. He is passionate about digital marketing and helping small and mid-sized businesses grow.

2 thoughts on “How To: Install WHM & cPanel using AWS EC2

  1. Michael Guthrie - September 21, 2017 at 3:09 pm

    Hi Brandon,

    Good Article thanks for posting.
    Can the instance be resized if the requirements grow? or is the cpanel installation set once the volume is set?


    • Brandon Bernicky - October 9, 2017 at 10:09 pm

      Hi Michael,

      Absolutely! You can easily scale your instance with just a few clicks, however, when it comes to adding additional storage space, you can scale up, but not down.


Leave a Reply