install CSF on a cPanel server
Imprimer- csf, cpanel/whm, cpanel, CloudFlare
- 0
install.cpanel.sh script located in the extracted directory. Since the official CSF website shut down in August 2025, you must download the package from GitHub and then configure the firewall through the WHM interface to enable it and disable testing mode.
- Log in via SSH: Access your server using the
rootuser. - Remove conflicting firewalls: If you have other firewalls like APF installed, remove them first by running
sh /etc/csf/remove_apf_bfd.sh.
- Navigate to the source directory: Use the
cdcommand to go to/usr/src, a common location for installing software. - Download the latest package: Get the latest version of CSF from GitHub:
wget https://raw.githubusercontent.com/waytotheweb/scripts/refs/heads/main/csf.tgz
tar -xzf csf.tgz
cd csf
- Run the cPanel install script: This script handles the installation for cPanel/WHM environments.
<<!nav>>./install.cpanel.sh<<!/nav>>
- Access WHM: Log in to your WebHost Manager (WHM).
- Find the CSF plugin: Navigate to the "ConfigServer Security & Firewall" option in the WHM interface.
- Configure ports: Use the "Firewall Configuration" button in the WHM interface to open necessary ports.
- Disable testing mode: In the main CSF interface, you will need to turn off the "Test Mode" to fully activate the firewall.
- Restart the firewall: After making configuration changes, restart CSF to apply them.
- Check CSF status: You can verify the installation and status through the WHM interface.
- Check for errors: Be aware of potential errors, especially concerning the Firewall LKM (Loadable Kernel Module), which may require enabling a monolithic kernel in
/etc/csf/csf.conf.
