Simple guide to installing CPanel (WHM) on an Amazon EC2 instance.

Add and configure a VPC

  1. Networking & Content Delivery > VPC
  2. Start VPC Wizard > Select
  3. Set CIDR to range of your choosing
  4. Give a relevant name
  5. Create VPC

Add and configure a Security Group:

  1. Networking & Content Delivery > VPC > Security > Security Groups
  2. Create Security Group
    1. Give relevant name, group and description
    2. Select previously created VPC
    3. Yes, Create
  3. Highlight the newly created Group
    1. Inbound Rules (scroll down) > Edit
    2. Add rules for the following ports:
  • 80
  • 22
  • 2083 – for CPanel
  • 2087 – for WHM

*I would suggest setting the Source to ‘My IP’ until testing is complete

EC2 – Create Instance

  1. Choose AMI- Amazon Linux AMI for this tutorial
  2. Select Instance Type – consult the AWS calculator before choosing – http://calculator.s3.amazonaws.com/index.html
  3. Configure Instance Details – Instances: 1, Network: select previously created VPC, Protect against accidental termination, Everything else default
  4. Add Storage – enter size – consult the calculator confirm costs
  5. Add Tags – Key e.g. Customer Name, Value e.g. Web Server
  6. Configure Security Group – select previously configured Security Group
  7. Review and Launch – Launch

Assign Elastic IP

  1. EC2 > Network and Security
  2. Elastics IPs
  3. Allocate New Address
  4. Select IP > Associate Address
  5. Select the newly created EC2 instance

Set EC2 hostname

  1. SSH to newly created EC2 instance – use keys downloaded when creating the VPC, use elastic IP as host
  2. Run the following command:

hostname mynew.cpanelserver.com

*This must be a valid DNS record

Install CPanel and WHM with the following command:

cd /home && curl -o latest -L http://securedownloads.cpanel.net/latest && sh latest

Complete the Initial Setup

  1. Browse to the WHM to complete setup e.g. http://mynew.cpanelserver.com:2087
    1. Accept EULA
    2. Networking – Enter relevant contact info, hostname = mynew.cpanelserver.com, Resolvers – 8.8.8.8, 8.8.4.4 (Google), Ethernet eth0
    3. IP – make sure Public IP (Elastic IP setup previously)
    4. Nameservers – as I am using Amazons Route 53 I entered them here
    5. Services – leave as default
    6. Quotas – Enable
    7. Save and Finish
  2. Within WHM
    1. Networking Setup
    2. Confirm Hostname is correct e.g. mynew.cpanelserver.com
Written by Matt Cooper
Hi, I'm Matt Cooper. I started this blog to pretty much act as a brain dump area for things I learn from day to day. You can contact me at: matt@linuxtutorial.co.uk.