How to: Install cPanel and WHM AMI instance in AWS

Disclaimer : Before deploying a WHM & cPanel server, its important to do some research to ensure you know what you’re doing! It can get tricky! This is a how-to for installing WHM & cPanel on AWS, for setting up WHM & cPanel, please refer to cPanel’s documentation.

WHM cPanel Installation

  1. Sign up for Amazon Web Services.
  2. 2. Once you are signed up, you’ll be presented with your dashboard. 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.
  3. Enter a VPC name, then hit, “Create VPC.” Once the VPC has been created, hit, “OK.”
  4. Now you’ll be presented with your VPC Dashboard, 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.”
  5. 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.”
  6. You will now be presented with a list of Amazon Machine Images (AMI’s) to select from. You’re going to want to select, “cPanel & WHM: The Hosting Platform of Choice” from the AWS Marketplace. To find this, you need to search for it under the AWS Marketplace tab. Once you have found the AMI, hit, “Select.”. I’ll show you how to replicate AMI’s later.
  7. 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.”
  8. 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.”
  9. For the Add Storage step, be sure to allocate enough storage for your needs. Normally, cPanel requires about 4 GB to run updates. Keep in mind that under Amazon’s Free Tier, you can get 30GB of EBS General Purpose (SSD). 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.”
  10. 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.”
  11. In 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.”
  12. Once you instance has been launched, select your instance to the left of the, “View launch log” link at the top of the screen. It is good to name your instance before moving forward.
  13. Navigate to the Network and Security heading and select, “Elastic IPs.”, then hit “Allocate New Address.”
  14. 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.”
  15. Navigate to the Network and Security heading and select, “Security Groups.”
  16. Select your security group and select the, “Inbound” tab. 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.”

Accessing your Amazon EC2 Server (MacOS or Linux)

Now we can connect to our brand new EC2 instance via SSH and install WHM & cPanel.

  1. Open Terminal.
  2. Enter “chmod 400 YOURKEYGOESHERE.pem”. (Notice that you have to write the route where your .pem file is located. Example: /home/username/Downloads/YOURKEYGOESHERE.pem)
  3. Enter “ssh -i “YOURKEYGOESHERE.pem” ec2-user@YOUREC2INSTANCE.amazonaws.com” (Notice that you have to write the route where your .pem file is located. Example: ssh -i “/home/username/Downloads/YOURKEYGOESHERE.pem” ec2-user@YOUREC2INSTANCE.amazonaws.com)
  4. Now enter this command:

Installing WHM & cPanel 

  1. 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.
  2. Once that is complete, type, “sudo yum install wget” and hit enter. Hit y and enter when prompted. This installs wget which we shall use later.
  3. Type, “cd /home.”
  4. Enter, “wget -N https://securedownloads.cpanel.net/latest
  5. 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.
  6. 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.”
  7. 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

  1. Go to https://youramazonip:2087 and just like that you have installed WHM and cPanel on your very own Amazon Web Server!
  2. Type in user’s field ‘root’ and the password that you choose before.

And that’s it. You now have a working WHM installation!