Install WHM & cPanel on AWS EC2 for WordPress

First of all, select your region (I am using Singapore) and go to Services > EC2. 

Create EC2 Instance

Click Launch Instance.

You will be asked to choose an Amazon Machine Image (AMI). Click on AWS Marketplace on the left sidebar, then search for centOS. Find CentOS 7 (x86_64) – with Updates HVM. Then click Select.

You will be presented with the pricing. Click Continue.

On Step 2, you need to choose an instance type. You only can use t2.micro for the AWS free tier. Click Next: Configure Intance Details.

On Step 3, you only need to choose a Network and enable termination protection to protect against accidental termination. Click Next: Add Storage

On Step 4, you can add storage to your instance. You need to specify the Size and Volume Type to General Purpose SSD (GP2). Under Amazon’s Free Tier, you can get 30GB of EBS General Purpose (SSD) or Magnetic Storage. Then click Next: Add Tags

On Step 5, you don’t need to Add any tag. Just continue to step 6: Configure Security Group

On Step 6, you click on Select an existing security group and choose a Security Group ID. Click on Review and Launch.

Review your instance settings and click Launch.

You need to create a new key pair, give a key pair name and click Download Key Pair. Save your file and click Launch Instances.

Your instances are now launching. Click on View launch log to view your launch status. I personally will give this new instance a name just to be tidy. You can now view your instance on EC2.

Elastic IPs

Navigate to Network & Security > Elastic IPs. Click Allocate new address.

 

Click Allocate.

Go back to you Elastic IPs list, select an Elastic IP and click Actions > Associate address.

Choose your Instance and tick on Reassociation. Click Associate.

Security Group

Click on Security Groups from Network & Security tab. Choose you Security Group, click on Inbound and Edit.

You need to allow All traffic just from you IP, HTTP and HTTPS traffic from anywhere.

Installing WHM & cPanel

Open your terminal, if you are using mac, make sure your keypair file is not open to group or other user. You can use this command to make it private.

chmod o-r [yourawskeyfilename]
chmod g-r [yourawskeyfilename]

Now you can ssh to your instance using this command

ssh -i “[yourawskeyfilename]” [email protected][your.ec2.instance.public.dns.address]

After you are logged in, type this command to access as root

sudo su

Time to do some installing. First of all you need to install perl. Just type this command

yum install perl

You need to install wget to download file from other sources.

sudo yum install wget

Its time to install cPanel. Enter this line to download cpanel installer:

wget -N http://httpupdate.cpanel.net/latest

You need to set your hostname first using this command:

hostname host.yourdomainname.com

Now execute the installation files by entering

sh latest

It will run the installation for you. The installation process will need sometime to complete. Chill out and relax for a while. It may take up to 1 hour to complete.

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

The next thing you need to do is enter the command:

passwd root

This will prompt you to change the root password.

Accessing WHM

Using the IP Address assigned to you from Amazon, go to https://youramazonip:2087 and you have installed WHM and cPanel on your Amazon Web Server!

Leave A Comment

%d bloggers like this: