Simple steps to install CloudFlare plugin on cPanel server

Why CloudFlare?

This is a free Content Delivery Network (CDN) for your domain. CloudFlare provides a better Internet security services and distributed domain name server services, sitting between the visitor and the Cloudflare user’s hosting provider, acting as a reverse proxy for websites. CloudFlare’s cPanel plugin is also available to manage the CloudFlare account simply through the cPanel itself.

The CloudFlare cPanel plugin installation is very simple and it can be achieved within 5 minutes. This plugin integrates CloudFlare with your cPanel server. Try this and enjoy!!!

Installation Steps

Step 1. SSH to the server in which you need to install CloudFlare plugin.

Step 2. Enter the cPanel basic directory:

cd /usr/local/cpanel

Step 3. Download the tar file to your server.

curl -k -L https://github.com/cloudflare/CloudFlare-CPanel/tarball/master > cloudflare.tar.gz

Step 4. Untar the file

tar -zxvf cloudflare.tar.gz

Step 5. This will extracts a directory which includes a UNIQUE_ID. The sample format of this will be as follows:

cloudflare-CloudFlare-CPanel-w40bbb3

Here w40bbb3 is the UNIQUE_ID.

cd cloudflare-CloudFlare-CPanel-UNIQUE_ID/cloudflare

Step 6. Execute the install script in the following format:

./install_cf API_HOST_KEY mod_cf "Your Company Name"

API_HOST_KEY – You will get this from your CloudFlare panel.
Your Company name – You can give your hostname here.

How to find the API_HOST_KEY?

You can copy the API_HOST_KEY from your CloudFlare account. Please do the following steps to find out the API_HOST_KEY.

Step 1. Log into your CloudFlare account.

Step 2. Go to “My Settings”.

Step 3. Scroll down to “Global API Key”.

Step 4. Click on the “View API Key” button to see your API identifier.

mod_cf is optional. If set, the installer will also try to install mod_cloudflare

That’s it!!! Now, you will be able to see an icon for “CloudFlare” in all your cPanel accounts.

cloudflare

Sample Output for a successful installation:

info [verify_api_spec_files] LoadFile
Done
Register Complete

==> mod_cloudflare: Installed successfully.
==> You may need to customize your EasyApache profile to include Mod CloudFlare

CloudFlare module installed successfully.

In some cases, if you see the output as :

Your HOST_KEY (d892a17e61de5caa062302d54714eb39e4d42) is invalid.

If you see this error, please contact CloudFlare support and ask for valid Host key.

That’s it 🙂

Updates….

I got a lot of comments with error as follows:

./install_cf: line 14: cd: ../CloudFlare-CPanel*: No such file or directory

This can be simply fix by editing the installation script install_cf. Please do the following steps:

Open the install_cf with your favorite text editor.

Change “../CloudFlare-CPanel*”  to its absolute path, /usr/local/cpanel/cloudflare-Cloudflare-CPanel*

Then Save and Exit. Try to install again with a valid API_HOST_KEY.

Related Links:
Easy way to install Memcached and memcache in a cPanel server
How to install Softaculous on cPanel server

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

11 thoughts on “Simple steps to install CloudFlare plugin on cPanel server

  1. ➜ cloudflare ./install_cf 9e57052495f206932347e089016659b9 “Name”
    ./install_cf: line 14: cd: ../CloudFlare-CPanel*: No such file or directory
    ➜ cloudflare pwd
    /usr/local/cpanel/Cloudflare-CPanel-5275007/cloudflare
    ➜ cloudflare

  2. [root@centos cloudflare]# ls -al
    total 12
    drwxrwxr-x 2 root root 4096 Apr 29 20:36 .
    drwxrwxr-x 10 root root 4096 Apr 25 21:41 ..
    -rwxrwxr-x 1 root root 543 Apr 25 21:41 install_cf
    [root@centos cloudflare]# ./install_cf -k c6798d0e7b145879d26011d8cd163e7c -n ‘centos’
    ./install_cf: line 14: cd: ../CloudFlare-CPanel*: No such file or directory

  3. Tried to install via 2 methods..
    #] ./cloudflare.install.sh -k ******************************** -n ‘*******’
    Starting CloudFlare CPanel Installation…
    ERROR: Could not find latest version. Please double check your HOST_KEY.

    #] ./install_cf ************************** ‘**********’
    ./install_cf: line 14: cd: ../CloudFlare-CPanel*: No such file or directory

    Both of them resulted in error. How do you fix these ? The script is directing to a place that does not exist.
    P.S: EA4 with Centos7

Leave a Reply

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