Install ConfigServer Firewall on AlamaLinux / Ubuntu OS
This article will guide you through the steps of configuring a free firewall script from ConfigServer which will be the first level of defense of a VPS on internet.
Updating the system
The first step for installing any package on any Linux system is to update the installed packages to the latest stable releases
For Alamalinux
dnf update -y
For CentOS
yum update -y
For Ubuntu
apt-get update && apt-get upgrade -y
Installing required dependencies
We will require perl libraries , wget , net utilities for supporting the csf firewall operations
CentOS/Alamalinux
yum install wget perl-libwww-perl net-tools perl-LWP-Protocol-https -y
OR
dnf install wget perl-libwww-perl net-tools perl-LWP-Protocol-https -y
Ubuntu
apt-get install wget perl-libwww-perl net-tools perl-LWP-Protocol-https -y
Installing CSF firewall
Download the source file and install the package using below steps
cd /opt
wget https://download.configserver.com/csf.tgz
tar -zxvf csf.tgz
cd csf
./install
This will install the firewall
Activating CSF firewall
By default the csf firewall run in TESTING mode which just simulates the configuration but does not process any rules .
To activate the firewall modify the configuration file as shown below .
vi /etc/csf/csf.conf
Search the string "TESTING = 1" and change it to "TESTING = 0"
After modification save the config file and exit and restart the firewall using the below command
csf -ra
Conclusion
Well you just saw how the CSF firewall is installed and activated to protect your systems on internet. But that's not all the configuration has to be customized for your environment which we will show in next article of CSF firewall.