How to Install cPanel & WHM on CentOS 7 / RHEL
cPanel is the most popular Linux based web hosting control panel which provides a graphical interface and many automation tools designed to simplify the process of website hosting and management of a website. By using this control panel, all of the hosting tasks are automated and can be performed by anyone with very little knowledge of how the control panel works.
This post will help you to install and run cPanel with WHM on RHEL/CentOS server.
We will start by applying all the necessary CentOS 7 security updates and bug fixes. This step should be done regularly on your server to keep it running securely and efficiently.
Before installing cPanel on your server. you must ensure that Perl installed on your server because cPanel is written in Perl. To install Perl on your server, you need to log in as root and run the following command.
yum -y install perl
Before installing WHM/cPanel on your server, you need to ensure that a proper fully qualified hostname is set for your server.
Here host.example.com is your domain name. You must own the domain to which you are setting up the hostname.
This file also contains your hostname. Open the /etc/sysconfig/network file with your favorite text editors such as vi, vim or nano.
Change HOSTNAME=host.example.com to your desired hostname and save it
You can check your new hostname by using the command
The new hostname will be displayed in your ssh terminal.
Now make sure that SELinux is disabled on your server before starting cPanel and WHM installation because SELinux does not work well with services like cPanel which attempt to manage the underlying aspects of your system. To disable SELinux execute the following command.
This method above will only work until the next reboot, therefore, to disable SELinux permanently, use any text editor whichever one is your favorite and open the file /etc/sysconfig/selinux by using the following command:
Find the directive SELinux=enforcing and then, change it to SELinux=disabled
Then, save and exit the file by pressing “:wq”, you will need to reboot your system so that changes take effect and SELinux is disabled.
You can use sestatus command to check the status of SELinux.
Next, change your current directory to /home directory, then we will just have to download the file and run it. Use the following commands to do this.
cd /home This will move your current directory to /home curl -o latest -L https://securedownloads.cpanel.net/latest Above command will download the control panel to your server sh latest
Usually, installation processes take more time to install (Approximately 1 hour or more than that). It depends on your network and operating system speed. When the installation completes the installation process then you need to open your WHM management panel to continue. You can access that at https://your_ip:2087.
Activate cPanel & WHM License
You can activate or update your cPanel server license using the following command.