How To Install mod_security.x86_64 on Amazon Linux 2

In this tutorial we learn how to install mod_security.x86_64 in Amazon Linux 2. mod_security.x86_64 is Security module for the Apache HTTP Server

Introduction

In this tutorial we learn how to install mod_security.x86_64 on Amazon Linux 2.

What is mod_security.x86_64

ModSecurity is an open source intrusion detection and prevention engine for web applications. It operates embedded into the web server, acting as a powerful umbrella - shielding web applications from attacks.

We can use yum to install mod_security.x86_64 on Amazon Linux 2. In this tutorial we discuss both methods but you only need to choose one of method to install mod_security.x86_64.

Install mod_security.x86_64 on Amazon Linux 2 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install mod_security.x86_64 using yum by running the following command:

sudo yum -y install mod_security.x86_64

How To Uninstall mod_security.x86_64 on Amazon Linux 2

To uninstall only the mod_security.x86_64 package we can use the following command:

sudo yum remove mod_security.x86_64

mod_security.x86_64 Package Contents on Amazon Linux 2

/etc/httpd/conf.d/mod_security.conf
/etc/httpd/conf.modules.d/10-mod_security.conf
/etc/httpd/modsecurity.d
/etc/httpd/modsecurity.d/activated_rules
/usr/lib64/httpd/modules/mod_security2.so
/usr/share/doc/mod_security-2.9.3
/usr/share/doc/mod_security-2.9.3/CHANGES
/usr/share/doc/mod_security-2.9.3/LICENSE
/usr/share/doc/mod_security-2.9.3/NOTICE
/var/lib/mod_security

References

Summary

In this tutorial we learn how to install mod_security.x86_64 on Amazon Linux 2 using yum.