How to install and setup cPanel with a software firewall (CSF) on CentOS 7

Preparing your environment

Login to your virtual machine via SSH using Putty (Windows) or Terminal (Mac) using the root user provided in your welcome email.

It is always recommended to update the servers repositories using the following command.

yum update

Once the above command has finished we need to make sure we have set the hostname to a usable name. To check your current hostname run the command:

hostname

You should see an output to the screen with the current hostname. If this isn't correct you can change the hostname by using the following command:

hostname YOUR-NEW-HOSTNAME

We recommend a hostname format of: server.yourdomain.com uk.yourdomain.com web.yourdomain.com

Installing cPanel

Now that the environment is ready for cPanel/WHM we can run the following command to install the very latest

cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

It will take some time to complete the cPanel install but once completed you will be able to access WHM to complete the setup of cPanel.

Login to WHM by using your servers IP address and port 2086.

Example: http://0.0.0.0:2086/

You should now see the WHM login screen, enter your servers root login details and follow the on screen steps to complete your setup.

Installing ConfigServer Security & Firewall (csf)

The ConfigServer Security & Firewall (csf) service is very easy, once you have setup cPanel using the above steps access your virtual machine by SSH once again.

Copy and paste the block of commands into your SSH terminal to begin the setup.

cd /usr/src
rm -fv csf.tgz
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

You should see a installation successful message. To test that services are running run the below test (optionial):

perl /usr/local/csf/bin/csftest.pl

Now login into WHM and scroll down the menu on the left hand side of your screen, at the bottom you will now see a link to the ConfigServer Security & Firewall admin UI. Your IP will automatically be added to the firewalls whitelist.

Last updated