How do I install fail2ban on a VPS?

Fail2ban is a simple tool to protect servers from bruteforce attacks, which automatically blocks IP addresses from which suspicious or unauthorised connection attempts are detected.

Installation

1. update system package list

sudo apt-get update


2. install fail2ban package

apt-get install -y fail2ban

Completed, the default configuration is configured to protect SSH, Apache login and FTP server. If you enter wrong login details 6 times, your IP address will be blocked for 10 minutes.