How to install CSF

At EZP, we’re huge fans of CSF. We love it for the ease it gives in managing the firewall. We suspect you’ll love it to, so we wrote up a quick install walkthrough for you!

First you will need to ssh as root to your server:


ssh root@yourserver.com

You need to run the following commands:


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

If there was ever a file called csf.tgz, this will ensure you install the latest version of CSF.

Next, were going to untar the file, and proceed with the install:


tar -xzf csf.tgz
cd csf
sh install.sh

Once installed, we want to ensure that the required modules are installed on the server by running:


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

You want to ensure that there are no FATAL error. As long as no FATAL errors are reported, you can proceed with the installation.

Next, you want to make sure that you remove APF in case it is installed to prevent any conflicts with CSF:


sh /usr/local/csf/bin/remove_apf_bfd.sh

You will then want to configure CSF and LFD. CSF provides a ReadMe file which can be found at /etc/csf/readme.txt and to configure the way it runs, you can make the changes in /etc/csf/csf.conf or within WHM if you run cPanel by going to the ConfigServer Security & Firewall and clicking on the Firewall Configuration.

Once that is all setup, you will want to start the service and ensure that they are running.

Enter the following commands in Command Line:


service csf start
service lfd start

This will start both CSF and LFD services on your server.