Learn how to install CSF Firewall. I recommend using Putty in this tutorial.
Attention: It is important to know that you must not have any other iptables firewall when installing CSF, otherwise there could be a conflict between them.
In putty, connect to your server and type the following commands in the following order:
rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
Now test that you have the required iptables modules:
perl /etc/csf/csftest.pl
Don’t worry if you can’t use all the firewall’s features because CSF doesn’t report fatal errors.
You can configure CSF and LFD by editing the files directly in /etc/csf/*, or in the WHM panel if your server has one.
The CSF installation in cPanel is already pre-configured for cPanel servers with all the standard cPanel ports open
The CSF installation in DirectAdmin is already pre-configured for DirectAdmin servers
with all the standard DirectAdmin ports open.
CSF automatically configures the SSH ports on the installation running a non-standard portal.
Make sure that the kernel logging daemon (klogd) is enabled. Normally, VPS servers have it disabled. You should check /etc/init.d/syslog and make sure that the klogd lines are not commented out. If you change the file, remember to restart syslog.