• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Sunday, June 15, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Install Fail2ban on Oracle Linux

in Linux OS, Oracle Linux, Red Hat Enterprise Linux
How to Install Fail2ban on Oracle Linux

Fail2ban is an essential security tool that helps protect your server from malicious attacks such as brute force, DDoS attacks, and other potential threats. It monitors log files for suspicious activity and updates your server’s firewall rules to block offending IP addresses. This article provides a step-by-step guide on how to install Fail2ban on Oracle Linux.

Prerequisites

Before you begin, ensure that you have:

  1. A server running Oracle Linux. (7 or 8)
  2. A user with root privileges or access to the sudo command.

How to Install Fail2ban on Oracle Linux

Update Your System

First, update your system to the latest available packages. Execute the following command:

sudo yum update -y

Install EPEL Repository

Fail2ban is available in the Extra Packages for Enterprise Linux (EPEL) repository. To install EPEL repository, run the following command:

sudo yum install epel-release -y

Installing Fail2ban on Oracle Linux

With the EPEL repository enabled, you can now install Fail2ban using the following command:

sudo yum install fail2ban -y

Configure Fail2ban on Oracle Linux

Fail2ban’s default configuration file is located at /etc/fail2ban/jail.conf. However, it is recommended to create a local configuration file instead, as it will not be overwritten during updates. To create a new configuration file, run:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Now, open the jail.local file with your preferred text editor, such as vim:

sudo vim /etc/fail2ban/jail.local

Modify the [DEFAULT] section as needed. For example, you can set the bantime, findtime, and maxretry values to customize how Fail2ban deals with suspicious activity:

[DEFAULT]
bantime  = 3600
findtime  = 600
maxretry = 3

The above configuration will ban an IP address for 3600 seconds (1 hour) if it fails to authenticate 3 times within 600 seconds (10 minutes).

Additionally, you can enable specific filters for various services such as SSH. To do so, locate the [sshd] section and set enabled to true:

[sshd]
enabled = true

Save the file and exit the text editor.

Start and Enable Fail2ban

To start the Fail2ban service, run the following command:

sudo systemctl start fail2ban

To enable Fail2ban to start on boot, execute:

sudo systemctl enable fail2ban

Check Fail2ban Status

To check the status of the Fail2ban service, use:

sudo systemctl status fail2ban

To view the list of banned IP addresses, run:

sudo fail2ban-client status sshd

Configure Firewall (Optional)

By default, Fail2ban uses IPtables to manage firewall rules. If you are using a different firewall, such as CSF, you will need to configure Fail2ban accordingly. Refer to the documentation for your chosen firewall to learn how to integrate it with Fail2ban.

Conclusion

You have successfully installed and configured Fail2ban on your Oracle Linux server. This powerful tool will now help protect your server from various attacks and provide a more secure environment for your applications and services. Remember to keep your server updated and routinely check Fail2ban logs to ensure optimal security.

For further security enhancements, consider changing the SSH port on your server, or setting up a VPN server to encrypt your network traffic. Additionally, explore other security tools, such as CSF or Let’s Encrypt for SSL/TLS certificates.

If you’re looking to expand your Oracle Linux knowledge further, check out our guides on how to install Ruby, install Python, set up a MySQL database server, or install Apache.

Stay informed about the latest Linux and security news by following our LinuxBoost blog. We cover a wide range of topics to help you get the most out of your Linux experience, from software installation to performance optimization and beyond.

ShareTweet
Previous Post

How to Install OpenVPN Server on Oracle Linux

Next Post

How to Use SSH Keys on Oracle Linux

Related Posts

How to Install Flask on Rocky Linux

How to Install Flask on Rocky Linux

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.