Fail2ban is an intrusion detection system that scans the log files to find malicious attacks on your servers. Fail2ban updates firewall rules on its own to block the IP addresses which are trying to exploit the server. Below are the steps to install and configure fail2ban on Ubuntu 18.04 server.
Get the newest versions of the packages and their dependencies, run the command below:
sudo apt-get update
Now install Fail2ban using the below command