Let’s install cPanel

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

yum install wget screen -y

Once screen is installed, start a new session running:

screen

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

cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && 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:

Cntrl-a-d

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. https://12.34.45.678:2087) or domain (example.com:2087)

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. 

Fix:

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:
https://forums.cpanel.net/threads/mod_security-and-easyapache-4.501871/

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.

Resource: https://documentation.cpanel.net/display/CKB/How+to+Edit+Your+php.ini+File

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 domain.com”

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 domain.com 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 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 —

xcache.admin.pass=””
xcache.admin.user=”mOo”
xcache.cacher=”On”
xcache.coredump_directory=””
xcache.count=”1″
xcache.coveragedump_directory=”/tmp/pcov/”
xcache.coverager=”Off”
xcache.gc_interval=”300″
xcache.mmap_path=”/dev/zero”
xcache.optimizer=”On”
xcache.readonly_protection=”Off”
xcache.size=”50M”
xcache.slots=”8K”
xcache.test=”Off”
xcache.ttl=”3600″
xcache.var_count=”2″
xcache.var_gc_interval=”300″
xcache.var_maxttl=”7200″
xcache.var_size=”16M”
xcache.var_slots=”8K”
xcache.var_ttl=”3600″

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

# service http restart

The issue is that cpanel from the https://domain.com:2083 looks like its missing css or files…

Symptom:
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.

Cause:
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 https://www.cloudflare.com/ips

Resolution:
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:

https://support.cloudflare.com/hc/en-us/articles/200063289-My-cPanel-won-t-load-or-keeps-logging-me-out-after-enabling-CloudFlare

https://forums.cpanel.net/threads/cpanel-looks-stupid-when-i-log-in.266321/

https://support.cloudflare.com/hc/en-us/articles/200169276-How-do-I-use-cPanel-with-CloudFlare-

Here are a few articles that mention it:

https://documentation.cpanel.net/display/EA/Custom+Modules
https://forums.cpanel.net/threads/how-to-easy-php4-php5-side-by-side-after-removal-of-php4-from-easyapache.304942/
http://www.liquidweb.com/kb/the-end-of-php-4/
https://www.siteground.com/kb/how_to_have_different_php__mysql_versions/

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

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: libmysqlclient.so.18: cannot open shared object file: No such file or directory

From the Percona Server 5.5.36-34.0 Release Notes: https://my.fusioned.net/knowledgebase/10100/Percona-with-cPanel-libmysqlclientso18-cannot-open-shared-object-file.html

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/libperconaserverclient.so /usr/lib64/libmysqlclient.so
# ln -s /usr/lib64/libperconaserverclient.so.18 /usr/lib64/libmysqlclient.so.18

(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
Percona-Server-shared-56-5.6.16-rel64.0.el5
Percona-Server-client-56-5.6.16-rel64.0.el5
Percona-Server-devel-56-5.6.16-rel64.0.el5
Percona-Server-server-56-5.6.16-rel64.0.el5

I removed the symlinks and applied

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

Another resource:
https://documentation.cpanel.net/display/CKB/How+to+Replace+MySQL+with+Percona

Cpanel Documentation
https://documentation.cpanel.net/display/CKB/How+to+Update+a+Percona+Installation