Skip to content

How to install fail2ban packages

Sergey G. Brester edited this page Jun 1, 2023 · 4 revisions

CentOS / CentOS Stream / RHEL Based Operating Systems

Ensure your system is up to date and install the EPEL repository:

yum update -y && yum install epel-release -y

Install Fail2Ban:

yum install fail2ban

Start and enable Fail2ban:

systemctl start fail2ban
systemctl enable fail2ban

If you encounter the error that there is no directory /var/run/fail2ban to contain the socket file /var/run/fail2ban/fail2ban.sock, create the directory manually:

mkdir /var/run/fail2ban

Debian / Ubuntu

Ensure your system is up to date:

apt update && apt upgrade

Install Fail2ban:

apt install fail2ban

The service automatically starts.

Fedora

Update your system:

dnf update

Install Fail2ban:

dnf install fail2ban

Start and enable Fail2ban:

systemctl start fail2ban
systemctl enable fail2ban

if your system is not listed

Try to find fail2ban packaged for your distribution using a package management of your OS.

You could also try to install it manually.