Create an AWS EC2 CentOS Instance:
- Go to AWS
- Go to EC2
- Click on Launch Instance
- Click AWS Marketplace on the left side.
- Type centos
- Choose CentOS 7 (x86_64) – With Updates HVM.
- Choose t2.micro then Next: Configure Instance Details
- Click Next: Add Tags
- Click Add Tag and type
Tag Value [any name] WebHosting
- Click Next: Configure Security Group
- Add The following protocols for inbound traffic
Type Protocol Port Range Source SSH TCP 22 Anywhere HTTP TCP 80 Anywhere HTTPS TCP 443 Anywhere Custom TCP Rule TCP 2087 Anywhere Custom TCP Rule TCP 2083 Anywhere
- Click Review and Launch
- Click Launch
- Choose Keypair
- It will take a few minutes to launch the instance.
Associate Elastic IP to EC2 Instance
The new instance will have a dynamic IP. You should assign a static IP to your instance to avoid losing your IP when rebooting. For that, do the following:
- Go to EC2.
- On the right-hand side menu, click Elastic IPs
- Create a new IP or choose one from the list that is not associated with any instance then click Action > Associate Elastic IP.
Associate Multiple IP Addresses to EC2
After assigning the primary IP address to your EC2, you can add additional IP (secondary IP) also.
- Go to EC2.
- Select the instance you want to add secondary IP to.
- Then Action > Networking > Manage IP Address
- Click Assign New IP and leave the option auto-assign.
- On the right-hand side menu, click Elastic IPs.
- Click on Allocate Elastic IP Address.
- Choose the new IP address and click Actions > Associate Elastic IP Address.
- Choose the server then the private IP that you have created.
- Now login to SSH and run the following command
sudo ip addr add [secondary private IP]/20 dev eth0
Install and Configure cPanel
- Open PuTTy.
- Enter IP address of the server
- Username is centos.
- Type the following to choose a password for the cPanel root admin
- Type in the password then confirm the password
- Type the following to login as root:
- Type in the following commands:
yum update yum install wget yum install perl yum install nano
- Now you need to set your hostname with the following command. Change [cpanel.yourdomain.com] with your hostname.
hostnamectl set-hostname cpanel.yourdomain.com
- Now install the cPanel with the following command
curl -o latest -L https://securedownloads.cpanel.net/latest
- Then type to install:
- After installation is done, copy your IP address the add to the browser. Should look like this : https://188.8.131.52:2087
- Login to cPanel as root
- Click Agree
- Enter your email and then your nameserver (NS1 and NS2).
- Now go to Server Configuration > Basic WebHost Manager.
- At the bottom of the page, under Nameservers, click Configure Address Records.
- Add the IPv4 A record (for all Nameservers). Should be your server IP address.