WHM & cPanel is the web-based system management control panel widely used for Linux hosting environment. To use WHM/cPanel on AWS environment, we will face the problem with normal instances. So we prefer to use VPC ( Virtual Private Cloud) in aws for installing WHM & cPanel server. This article will help you step by step in brief details for configuration of WHM & cPanel hosting environment on AWS instances.
Follow below step by step details for configuring WHM & cPanel on AWS:-
1. Setup VPC (Virtual Private Cloud)
First login to your aws web console and navigate to below location for creating VPC (Virtual Private Cloud) for your cPanel infrastructure.
- Services >> Networking >> VPC (VPC Dashboard)
- Now click on Start VPC Wizard button.
- Select VPC with a Single Public Subnet
- Input your CIDR and Public Subnet
2. Create EC2 Instance
Now go to EC2 instances section of AWS console and start creating new instance of your choice using following steps. Remember that cPanel/WHM supports only CentOS, RedHat and CloudLinux operating systems only.
- Select an Amazon Machine Image (AMI)
- Select an Instance Type
- Configure Instance Details
- Add Storage of your preferred size
- Tag your Instance Name
3. Create Elastic IP
Basically Elastic IP are public ip which is required to access instance from public network. To allocate a new elastic ip.
- Go to VPC DashBoard
- Select Option Elastic IPs
- Click button Allocate New Address
- Now click “Yes, Allocate” to confirm
4. Bind Elastic IP with Instance
- Go to EC2 Dashboard
- Select Elastic IPs link under “NETWORK and SECURITY” Section in sidebar
- Select your elastic ip and Click “Associate Address”
- Select You newly created instance and click Associate
5. Login to Server and Update
- Login to Server as root user using pem file generated during instance creation.
# ssh -i server.pem [email protected]
- Update all packages on your system using following commands
# yum update
- Reboot instance.
6. Setup Hostname
Use below command to set a hostname temporarily on you rsystem.
# hostname cpanel.example.com
Now make changes permanent by editing configuration file.
- Edit /etc/sysconfig/network configuration file for RHEL & CentOS
- For Ubuntu and Debian systems edit /etc/hostname and enter hostname there
- Now edit /etc/hosts for binding hostname with local system ip.
7. Install cPanel & WHM
At this stage our system is prepared for installing cPanel. Use following commands to complete installation. This process will take time as per your network speed and system configuration.
# cd /home # yum install wget # wget -N http://httpupdate.cpanel.net/latest # sh latest
8. Setup NAT
Sometimes system doesn’t automatically detects NAT on your instance. Then you can run below command to do it manually
# /scripts/build_cpnat [output] info [build_cpnat] 220.127.116.11 => 18.104.22.168
Now to Navigate to Home >> Server Configuration >> Basic cPanel & WHM Setup in your WHM and check for The IPv4 address (only one address) to use to set up shared IPv4 virtual hosts shoud show your public ip address.
9. Open Ports in Security Group
Now open all inbound ports in AWS security group used in instance or open specific ports for inbound network listed in following article.
10. Access cPanel & WHM
Congratulation’s your WHM & cPanel setup has been completed successfully. You can access WHM and cPanel using following urls.
WHM :http://cpanel.example.com:2086 WHM with SSL :http://cpanel.example.com:2087 cPanel :http://cpanel.example.com:2082 cPanel with SSL :http://cpanel.example.com:2083
11. More Configurations
You may use following articles for more configuration for WHM & cPanel servers.
- Install CSF (ConfigServer & Security Firewall) on cPanel
- Install Services SSL Certificates in WHM & cPanel
- Enable Apache Gzip Compression Globally