Cpanel & WHM is a graphical interface to manage and host websites on a single server. It is one of the popular web hosting control panel which supported on CentOS, RHEL and CloudLinux. Cpanel & WHM requires a license to work and available to download the trial version for 15 days.
Cpanel & WHM is officially supported on CentOS 7. In this article, I'm going to discuss how to install cPanel & WHM 11.52 on CentOS 7 OS version.
- The hostname should be a fully qualified domain name.
- Should have a valid IP address, subnet address, and default gateway
- Ethernet device with a static IP & hostname
- Disable OS Firewall
- Processor: 226 Mhz
- RAM: Minimum 1GB ( 2GB recommended for smooth functioning)
- Disk Space: Minimum 20 GB (40GB recommended for smooth functioning )
Before installation make sure the server meets all the pre-requisites.
Initial Pre checks
Check for the IP addr, subnet addr and gateway
The IP address allocated by the DHCP server cannot be used for Cpanel. So make sure we have a static IP with a proper subnet mask and default gateway.
Use ip or ifconfig command to check ip details.
# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 184.108.40.206 netmask 255.255.255.0 broadcast 220.127.116.11 inet6 fe80::f03c:91ff:fef1:78d9 prefixlen 64 scopeid 0x20<link> inet6 2600:3c03::f03c:91ff:fef1:78d9 prefixlen 64 scopeid 0x0<global> ether f2:3c:91:f1:78:d9 txqueuelen 1000 (Ethernet) RX packets 38095 bytes 13241381 (12.6 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 41505 bytes 45527241 (43.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Check the OS, disk usage and RAM usage for the server
Our server is installed with CentOS 7.2, having a disk space of 20GB and around 1GB RAM. Please see the results of the hardware checks below:
OS version check:
# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) root@server1 [~]#
Disk usage check:
# df-h Output Filesystem Size Used Avail Use% Mounted on /dev/root 20G 5.9G 14G 31% / devtmpfs 492M 0 492M 0% /dev tmpfs 494M 0 494M 0% /dev/shm tmpfs 494M 14M 480M 3% /run tmpfs 494M 0 494M 0% /sys/fs/cgroup /dev/loop0 662M 736K 627M 1% /tmp tmpfs 99M 0 99M 0% /run/user/0
RAM usage check:
# free -m or cat /proc/meminfo root@server1 [~]# free -m total used free shared buff/cache available Mem: 987 336 275 12 375 607 Swap: 511 1 510
Step 1: Set hostname to a fully qualified domain
This is how we set the hostname for the server to a fully qualified domain name "server1.centos7-test.com" and confirm the hostname status once it is done.
# hostnamectl set-hostname server1.centos7-test.com --static # hostnamectl status Static hostname: server1.centos7-test.com Icon name: computer-vm Chassis: vm Machine ID: 72863e389b584a4dab36fae7f3bffda2 Boot ID: 8bd4f714d7ba4ebf9d53f059d0a1fe8b Virtualization: xen Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 4.1.5-x86_64-linode61 Architecture: x86-64 root@server1 [~]#
Step 2: Disable Firewall
It is recommended to disable the OS firewalls before the cPanel & WHM installations. First of all, we need to save the firewall rules and then stop the firewalld service. And make sure the service is disabled.
iptables-save > ~/firewall.rules systemctl stop firewalld.service systemctl disable firewalld.service systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Jan 09 06:50:28 server1.centos7-test.com systemd: Stopped firewalld - dynamic firewall daemon.
Step 3: Disable Selinux
Modify the SELINUX parameter to disabled in /etc/selinux/config and reboot the server.
cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
Step 4: Install Perl
cPanel is programmed in Perl language. Hence, we need to install Perl prior to the cPanel installation if it isn't installed in the server before.
yum install -y perl
Step 5: Download and Install cPanel/WHM
We need to download the cPanel installation script into the /home directory and run the script from there.
cd /home curl -o latest -L https://securedownloads.cpanel.net/latest sh latest
This is how we download and install the cPanel installation script from our server's home directory.
The script can take half an hour or more to complete the installation procedures.
2016-01-07 07:15:51 227 ( INFO): cPanel install finished in 32 minutes and 14 seconds! 2016-01-07 07:15:51 964 ( INFO): Congratulations! Your installation of cPanel & WHM 11.52 is now complete. The next step is to configure your server. 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): Before you configure your server, ensure that your firewall allows access on port 2087. 2016-01-07 07:15:51 964 ( INFO): On RHEL, CentOS, and CloudLinux systems, execute /scripts/configure_firewall_for_cpanel to accomplish this. 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): After ensuring that your firewall allows access on port 2087, you can configure your server. 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): 1. Open your preferred browser 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): 2. Type https://18.104.22.168:2087 in the address bar 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): 3. Enter the word root in the Username text box 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): 4. Enter your root password in the Password text box 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): 5. Click the Login button 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): Visit http://go.cpanel.net/whminit for more information about first-time configuration of your server. 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): Visit http://support.cpanel.net or http://go.cpanel.net/whmfaq for additional support 2016-01-07 07:15:51 964 ( INFO): 2016-01-07 07:15:51 964 ( INFO): Thank you for installing cPanel & WHM 11.52! 2016-01-07 07:15:51 835 ( WARN): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Step 6: Allow ports on firewalld
After completing the installation procedures, we need to ensure that server allows the required service ports (2087/2086) in the firewall.
firewall-cmd --zone=public --add-port=2087/udp success firewall-cmd --zone=public --add-port=2086/udp success firewall-cmd --zone=public --add-port=2086/tcp success firewall-cmd --zone=public –add-port=2087/tcp firewall-cmd --reload
If your server has enough resources, then it is always advised to disable the OS firewall and configure CSF/APF to ensure better security and allow all required cPanel service ports by default. I would recommend to go with CSF for a cPanel server.
CSF Installation steps:
wget http://configserver.com/free/csf.tgz tar -xzf csf.tgz cd csf & ./install.cpanel.sh
Access the WHM via the URL
You can access WHM using the URL https://server-hostname:2087 or http://server-hostname:2086
After accessing the URL mentioned above, you can put your username as root and its password to login.
Read through the terms and conditions & accept the license agreement.
Now you can do your initial configuration steps one by one as below:
1. Setup Networking
2. Setup IP address
5. Setup quotas
Visit cpanel whm for more information about the first-time configuration of your server.
Now you will have your WHM ready to use!!!
I believe this article will be a great help for you guys! Thank you for referring to this. I would appreciate your valuable comments for further improvements.