How To Install cPanel on a Virtual Server Running Rocky or Centos Linux

Disable SELinux. You must disable SELinux to make your system compatible with cPanel & WHM. To disable SELinux security features, edit the /etc/selinux/config file to set the SELINUX parameter to disabled, and then reboot the server. The contents of the /etc/selinux/config file should resemble the following example:

dnf install nano
nano /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.
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.

Hostname Setup

cPanel is very picky about making sure that server that it is installed on has a Fully Qualified Domain Name. To that effect, we need to provide it with a valid hostname. Skipping this step will inevitably get you the following, very common, error:

2012-11-01 16:00:54 461 (ERROR): Your hostname () is not set properly. 
Please 2012-11-01 16:00:54 462 (ERROR): change your hostname to a fully qualified domain name, 
2012-11-01 16:00:54 463 (ERROR): and re-run this installer.

To remedy, set the hostname.

hostnamectl set-hostname

Install Perl

Perl must exist on your server before the installation script for cPanel & WHM can run successfully. If Perl does not exist during installation, the cPanel & WHM installer attempts to install Perl via the yum -y install perl command. So let’s install it.

dnf install perl

Install cPanel

Let’s use screen to install. To start off, go ahead and install screen and wget:

dnf install epel-release -y
dnf install screen wget

Once screen is installed, start a new session running:


After opening screen, you can proceed to install cPanel. Use this this command to install cPanel with WHM:

cd /home && curl -o latest -L && sh latest

Then close out of screen. The script will continue running while in the background—even if you close out the of server.

In order to detach screen type:


To reattach to your screen you can use the command:

screen -r

Once cPanel finally installs, you can access the login by going to http://ipaddress:2087 (eg. or domain (

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.