First you would need to login as root via ssh, then as root issue the following commands:
wget https://www.configserver.com/free/csf.tgz
tar zxfv csf.tgz
cd csf
./install.cPanel.sh
At this point the CSF installation is complete and the configuration file should suit your needs, to edit the CSF configuration issue this command:
pico /etc/csf/csf.conf
Set the TESTING variable to 1 instead of and make sure that the MONOLITHIC_KERNEL variable is set to 1 this is important for OpenVZ VPS servers You may open/filter incoming and outgoing ports by editing the TCP_IN and TCP_OUT variables. Save your configuration by pressing CTRL + x, when asked press “y” then press the enter key
Now start CSF by issuing:
/etc/init.d/csf start