How To Install cPanel on a Virtual Server Running Centos

First we need to make sure that Perl is installed on the server

# sudo yum install perl

After installing perl we need to take one more preliminary step. 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.

Luckily this error has a very easy solution. If you have a FQDN, you can type it in with the command:

# hostname your FQDN

Otherwise, if you want to proceed with the cPanel installation but do still lack the hostname, you can input a temporary one. Once cPanel is installed, you will be able to change the hostname to the correct one on one of the first setup pages.

# hostname

Install cPanel

Although the cPanel installation only has several steps, the installation does take a long time. Although using program “screen” is not necessary in order to install cPanel, it can be a very helpful addition to the installation process. It can be especially useful if you know that you may have issues with intermittent internet or that you will need to pause the lengthy install process.

To start off, go ahead and install screen and wget:

# sudo yum install screen wget

Once screen is installed, start a new session running:

# screen

After opening screen, you can proceed to install cPanel with WHM or a DNS only version of cPanel.

Use this this command to install cPanel with WHM:

# wget -N

Use this command to install the DNS only version of cPanel:

# wget -N

With the requested package downloaded, we can go ahead and start the script running:

# sh latest

Then close out of screen. The script, which may take one to two hours to complete 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 your ip address:2087 (eg. or domain (

Your login will be:

username: your_server_user
password: your_password

From there, you can create your cpanel user and finally login in at ipaddress/cpanel or domain/cpanel

cPanel Error for Install for OWASP ModSecurity Core Rule Set V3.0

Recently encountered an error. going to Home >> Security Center >> ModSecurity >> Vendors and clicking Install. However I’m getting the following error messages:

Error:The system experienced the following error when it attempted to install the ?OWASP ModSecurity Core Rule Set V3.0? vendor: API failure: The system could not validate the new Apache configuration because httpd exited with a nonzero value. 


Backup the /var/cpanel/modsec_cpanel_conf_datastore file.

Manually edit /var/cpanel/modsec_cpanel_conf_datastore file with your favorite editor. Removed all active configs, active vendors, disabled rules, and updates. Just keep disabled rule. Save the file.

Login to WHM >> Home >> Security Center >> Modsecurity Vendors >> Manage Vendors >> OWASP ModSecurity Core Rule Set >> click +install

Modsecurity rules will should be installed without any issue.

Other links:

How to Edit Your php.ini File on cPanel

On systems that run EasyApache 3, the /usr/local/lib/ directory contains your server’s php.ini file.
On systems that run EasyApache 4, multiple php.ini and local.ini files manage your system’s PHP. Each version of PHP on your systems uses its own php.ini and local.ini file. You must make changes to each file separately.

On systems that run EasyApache 3, we strongly recommend that you only edit this file with WHM’s PHP Configuration Editor interface (Home >> Service Configuration >> PHP Configuration Editor).

On systems that run EasyApache 4, we strongly recommend that you only edit these files with WHM’s MultiPHP INI Editor interface (Home >> Software >> MultiPHP INI Editor). This ensures that an operable version of PHP exists on the system.


Warning: cPanel is unable to verify that this server is an authoritative nameserver

When trying to add DKIM and SPF records to my domain and I’m getting the error “Warning: cPanel is unable to verify that this server is an authoritative nameserver for”

Warning: cPanel is unable to verify that this server is an authoritative nameserver

That message typically indicates the use of external name servers for the domain name associated with the account. So since the domain is using outside server nameservers you would actually just need to copy the DKIM and SPF records and add them in the DNS zone where DNS is hosted.

How to enable Xcache in cPanel

How to enable Xcache in cPanel to speed up website?
Xcache can be enabled in cPanel by using Easy Apache.

Log into your cPanel server. After you login, search for “EasyApache” in left column and click on the link. Select “Previously Saved Config” and click on “start customizing”. For both Apache and PHP, click on “next step” button. Look for “xcache for php” and check the box. Click on “save and build”. Allow the build process to finish.

To enable xcache, you will need to make changes to php.ini before it can be used by your scripts.

# nano  /usr/local/lib/php.ini

Here is recommended settings for xcache in cPanel —


Make necessary changes and save. Aftererwards you will need to restart Apache in WHM for changes to take affect

# service http restart

Cpanel on Cloudflare looks weird

The issue is that cpanel from the looks like its missing css or files…

You try to access your cPanel behind CloudFlare and are finding that on the first page load that no images (or stylesheets or javascript) load – and, when trying to navigate to any link, you are immediately logged out. The experience is as if cPanel were broken in some way.

cPanel has an option called “Cookie IP Validation”. This setting checks that the IP address that the visitor originally came from matches their IP address on subsequent requests. With CloudFlare, the IP address for requests to your server can variably come from any IP address in the list at

To resolve this issue, in your WHM, navigate to “Tweak Settings” -> “Security” -> “Cookie IP Validation”. On this screen, set the value for “Cookie IP Validation” to “disabled”. After this, loading your cPanel WHM interface through CloudFlare should work as expected.

Other resources:

Php 4 on cpanel

Here are a few articles that mention it:

The End of PHP 4

You can set the handler for the site using a .htaccess file in the domains webroot with the following contents:
AddHandler application/x-httpd-php4 .php .php4 .php3

Percona with cPanel: cannot open shared object file

A recent Percona upgrade caused problems with PHP on some cPanel servers. The name of the libmysqlclient library was changed without keeping a symlink to the original name, which caused PHP to throw errors, and EasyApache not compiling successfully.

Running php -v will show it…

php -v
php: error while loading shared libraries: cannot open shared object file: No such file or directory

From the Percona Server 5.5.36-34.0 Release Notes:

In order to comply with Linux distribution packaging standards Percona‘s version of libmysqlclient has been renamed to libperconaserver. The old name was conflicting with the upstream libmysqlclient. Except for packaging, libmysqlclient and libperconaserverclient of the same version do not have any differences. Users wishing to continue using libmysqlclient will have to install the corresponding package of their distribution, such as mysql-lib for CentOS and libmysqlclient18 for Ubuntu/Debian. Users wishing to build software against libperconaserverclient should install libperconaserverclient-dev package. An old version of Percona-built libmysqlclient will be available for download.

You simply need to symlink libperconaserver to libmysqlclient, and here’s how it’s done:

# ln -s /usr/lib64/ /usr/lib64/
# ln -s /usr/lib64/ /usr/lib64/

(Note: for RHEL/CentoOS/CL 6 x86, replace /usr/lib64 with /usr/lib)

Finally, re-run EasyApache to compile PHP against the new libraries:

# /scripts/easyapache --build

Note: After running this, this error appeared on php sites…

ERROR: Database Error: The MySQL adapter "mysql" is not available.

Checked and the symlinks were not real as there were missing files.

Check perconal rpm’s

rpm -qa |grep PerconaPercona-Server-shared-compat-5.5.35-rel33.0.611.rhel5

I removed the symlinks and applied

Removed the symlinks and then followed this cpanel article symlink at the bottom to rebuild.

Another resource:

Cpanel Documentation