How to Install cPanel & WHM on AWS EC2 Instance?

How to Install cPanel & WHM on AWS EC2 Instance?

Steps to install cPanel and WHM

  1. Go to AWS marketplace
  2. Search for Cpanel & WHM and subscribe to it
  3. Configure Cpanel & Launch it with EC2
  4. Configure EC2 & Security Group
  5. Set up Hostname on AWS
  6. Connect EC2 & Install cPanel
  7. Agree to Terms and Conditions
  8. Setup Email in WHM
  9. Activate cPanel

Install cPanel

Access your EC2 Instance with the PEM file you just downloaded.

Once you are connected to you instance enter the following commands one by one.

sudo -s
yum update
yum install perl
yum install wget

Then set the hostname with your domain name. Replace with your domain name.


Download latest cPanel and install it by running the following command.

cd /home && curl -o latest -L && sh latest

It will take around 30 – 40 min to complete the install. Don’t close the terminal until the setup is completed.

Once the setup is completed, you can set the root password by executing the following command.


Save your password safely, you will need that to login to your WHM.

Set up Hostname in AWS

AWS Instance won’t preserve the hostname ( you set and changes it to default hostname automatically, so this may result in a locked cPanel & WHM license. To preserve the hostname follow the below simple steps .

cd /etc/dhcp/dhclient-exit-hooks.d/
sudo nano

Paste the following contents and hit Ctrl+X followed by Y to save the file. Remember to replace with your domain name


Set correct permissions to the file you created

chmod 744

That’s all now your cPanel is installed and ready to finish the WHM setup

Setup WHM

Open your browser and navigate to .

At this point, some browsers show a warning message about HTTPS and don’t allow you to visit the WHM page.

In this case, you can use your IP Address instead of the domain name (https://PUBLIC_IP_ADDRESS:2087).

It will take some time for the SSL certificate to get issued by cPanel.

Enter username as root

Enter the password you created by running the command passwd

Now you will be logged into your WHM.

Click Agree to All.

Provide your email address.

Did you find this article useful?