How to Setup WHM & cPanel on AWS Instances

Nidhin Manjaly
4 min readMay 28, 2023

--

Hi, all in this blog I would like to share about WHM and cPanel and how to set up in AWS EC2 instance. Before that let's understand what is WHM and cPanel

What is cPanel

cPanel is one of the most popular Linux-based control panels for web hosting accounts. It lets you conveniently manage all services in a single place. Currently, cPanel is the industry standard and most web developers are well acquainted with it. cPanel hosting is essentially Linux web hosting which includes the installation of cPanel. cPanel has its pros and cons, but it works pretty well in the majority of cases and makes for a sensible choice when you’re looking for a control panel solution

How to Setup

Step 1: Create an EC2 instance of your choice. Note Amazon Linux doesn't support this as now of now, so in my case, I’m using CentOS 7.

Step 2: Allow the following ports to be added on to the inbound port in the AWS security group. HTTP:80, HTTPS:443, FTP:21, cPanel:2082–2083, WHM:2086–2087, webmail:2095–2096

Step 3: Login to the server using any of the SSH tools you desired and install the cPanel using the below command

cd/home
wget –N http://httpupdate.cpanel.net/latest

if you are getting any error regarding wget to install the package using the below command

$ sudo yum install wget

cPanel installation will take time to complete once the downloading is completed run the screen command to run the process in the background then run the sh command

chmod +x latest 
sh latest

Step 4: Then set the hostname with your domain name. Replace yourdomainname.com with your domain name.

hostname cpanel.yourdomainname.com

Step 5: Before you log in to WHM for the first time, you will need to set the root password for the server since the AWS AMI does not automatically assign you one. Change the root password

sudo passwd root

Step 4: After installation completed, you can access your cPanel server through port 2083. In browser type https://<yourserverIP>:2083

Please note, you will need to accept the SSL warning the first time you log in

Setup WHM

Open your browser and navigate to (https://PUBLIC_IP_ADDRESS:2087) It will take some time for the SSL certificate to get issued by cPanel.

Once you click on proceed to IP xxx.xxx.xxx.xxx (unsafe), you will be seeing the below image

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.

Click Finish. Now you will be taken to the WHM home page.

To login to the cPanel, we need a user so that we create a New Account

Enter the details in the respective columns and click finish. Once that is completed we can log in to cPanel via https://ip address:2083.

Enter the user name and password which we create and click on Log In. You will be redirected to the Cpanel dashboard.

--

--