×


Set up cPanel on an AWS instance - step by step guide ?

cPanel is a Linux based web hosting control panel that works through Graphical user interface(GUI). 

Are you trying to set up cPanel on an AWS instance? We can assist you.

Here at Ibmi Media, as part of our Server Management Services,  we regularly help our Customers to perform related cPanel queries.

In this context, we shall look into setting up cPanel in your Server.

With our expertise with AWS and cPanel we can also migrate your existing hosting environment to AWS with zero downtime.


Steps to set up cPanel on an AWS instance 

1. Set up VPC (Virtual Private Cloud)

  • To begin, log into your AWS web console and navigate to below location for creating VPC (Virtual Private Cloud) for your cPanel infrastructure (Services >> Networking >> VPC (VPC Dashboard)) .
  • Then, click on Start VPC Wizard button.
  • Next, select VPC with a Single Public Subnet.
  • Input your CIDR and Public Subnet.


2. Create EC2 Instance

Then, go to EC2 instances section of AWS console and start creating a new instance of your choice using the following steps.

Please note cPanel/WHM supports only CentOS, RedHat and CloudLinux operating systems.

  • To begin, select an Amazon Machine Image (AMI).
  • Then, select an Instance Type.
  • Configure Instance Details.
  • Add Storage of your preferred size.
  • Finally, tag your Instance Name.


3. Attach a static IP address to your cPanel & WHM instance

i. By default dynamic public IP address attached to your instance and it changes every time you stop and start the instance.

To avoid that create a static IP address, and attach it to your instance.

So that when you use your domain name with your instance, you don’t have to update your domain’s DNS records each time you stop and start the instance. Or if your instance fails, you can restore your instance from a backup and reassign your static IP to your new instance.

ii. You must specify the public IP address of your cPanel & WHM instance when purchasing a license from cPanel.

The license that you purchase is associated to the IP address of your instance.

iii. Specify your static IP when you purchase a license from cPanel, and keep your static IP for as long as you plan to use your cPanel & WHM license with a Lightsail instance.

If you need to transfer your license to another IP address later, you can submit a request to cPanel.

On your instance management page, under the Networking tab, choose Create static IP, then follow the instructions on the page.


4. Login to Server and Update

  • Login to Server as root user using pem file generated during instance creation: $ ssh -i server.pem root@IP_addres
  • Update all packages on your system using following commands: $ yum update
  • Reboot instance: $reboot


5. Configure Hostname

  • Use below command to set a hostname temporarily on you rsystem: # hostname cpanel.example.com
  • Now make changes permanent by the editing configuration file.
  • Edit /etc/sysconfig/network configuration file for RHEL & CentOS: HOSTNAME=cpanel.example.com
  • For Ubuntu and Debian systems edit /etc/hostname and enter hostname there: cpanel.example.com
  • Now edit /etc/hosts for binding hostname with local system ip: 10.0.0.100 cpanel.example.com


6. Install cPanel & WHM

Use the following commands to complete the 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


7. Configure NAT

Sometimes the system doesn't automatically detect NAT on your instance. Then you can run below command to do it manually:

$ /scripts/build_cpnat
[output]
info [build_cpnat] 172.32.121.55 => 54.6.169.157

Now Navigate to Home >> Server Configuration >> Basic cPanel & WHM Setup in your WHM and check for The IPv4 address to use to set up shared IPv4 virtual hosts should show your public ip address.


8. Open Ports in Security Group

Finally, open all inbound ports in the AWS security group used by the instance or open specific ports for inbound network.


[Need help with AWS configuration ? We'd be happy to help you. ]


Conclusion

This article covers how to set up cPanel on an AWS instance. In the setup to build cpanel & AWS on AWS EC2 instance, we need to setup a VPC,security group, instance,AWS Route 53 DNS and on AWS infrastructure after that cPanel/WHM installation on the EC2 instance .