Share your love
Install and Configure CSF Firewall on AlmaLinux 9

In this article, you will learn to Install and Configure CSF Firewall on AlmaLinux 9. Config Server Firewall (CSF) is a Stateful Packet Inspection (SPI) firewall, Login/Intrusion Detection, and Security application for Linux servers.
It is a security tool that can protect your server against attacks, such as brute force, and improve server security. You can now proceed to the guide steps below on the Orcacore website to set up CSF on AlmaLinux 9.
Table of Contents
Steps To Install and Configure CSF Firewall on AlmaLinux 9
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on the Initial Server Setup with AlmaLinux 9.
1. Install CSF on AlmaLinux 9
First, you need to update your local package index with the command below:
sudo dnf update -y
Then, you need to install some dependencies on your AlmaLinux 9 with the following command:
sudo dnf install wget vim perl -y
Next, switch to your src directory:
cd /usr/src
At this point, use the wget command to download the CSF installer script on AlmaLinux 9:
sudo wget https://download.configserver.com/csf.tgz
Extract your downloaded file:
sudo tar xzf csf.tgz
Move to your CSF directory:
cd csf
Finally, run the CSF installer script with the following command:
sudo sh install.sh
When your installation is completed, test that you have the required iptables modules:
sudo perl /usr/local/csf/bin/csftest.pl
In your output, you will see:

2. Configure CSF on AlmaLinux 9
At this point, since you have CSF installed on your server, you need to edit the CSF configuration file. Open the file with your favorite text editor, here we use vi:
sudo vi /etc/csf/csf.conf
Find the Testing line and change its value to 0.
TESTING = "0"
When you are done, save and close the file.
Now use the following commands to start and enable the CSF and LFD on AlmaLinux 9:
# sudo systemctl restart csf && sudo systemctl restart lfd
# sudo systemctl enable csf && sudo systemctl enable lfd
Verify that your CSF and LFD are active and running on your server with the commands below:
sudo systemctl status csf && sudo systemctl status lfd


You can check your CSF firewall version on AlmaLinux 9 with the command below:
csf -v
Output
csf: v14.17 (generic)
If you want to allow the incoming connection from an IP address, you can use the following syntax:
csf -a [IP Address]
Otherwise, if you want to deny the incoming connection from an IP address, you can use the following syntax:
csf -d [IP Address]
3. Remove ConfigServer Firewall
Also, if you want to uninstall the CSF firewall from your AlmaLinux 9, you can use the following command:
# cd /etc/csf
# sh uninstall.sh
Conclusion
Installing and configuring CSF (ConfigServer Security & Firewall) on AlmaLinux 9 is an effective way to enhance server security. CSF provides an advanced, yet user-friendly interface for managing iptables and offers features like login tracking, IP blocking, and alerting. With a few simple steps, you can set up CSF to monitor and protect your server, making it a valuable tool for system administrators seeking better control over network traffic and security.
Hope you enjoy it. Please subscribe to us on Facebook and Twitter.
You may also like to read the following articles:
Secure Alpine Linux Using CSF Firewall
Fix CSF Error: Warning Binary Location for HOST Incorrect
I had a problem with installing CSF, but I saw a tip in your explanation that was really great.
And the problem of installing CSF on my Almalinux was solved.
Thankful
You’re welcome