How To Install libmodsecurity on CentOS 7

In this tutorial we learn how to install libmodsecurity on CentOS 7. libmodsecurity is A library that loads/interprets rules written in the ModSecurity

Introduction

In this tutorial we learn how to install libmodsecurity on CentOS 7.

What is libmodsecurity

Libmodsecurity is one component of the ModSecurity v3 project. The library codebase serves as an interface to ModSecurity Connectors taking in web traffic and applying traditional ModSecurity processing. In general, it provides the capability to load/interpret rules written in the ModSecurity SecRules format and apply them to HTTP content provided by your application via Connectors.

We can use yum or dnf to install libmodsecurity on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install libmodsecurity.

Install libmodsecurity on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install libmodsecurity using yum by running the following command:

sudo yum -y install libmodsecurity

Install libmodsecurity on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install libmodsecurity using dnf by running the following command:

sudo dnf -y install libmodsecurity

How To Uninstall libmodsecurity on CentOS 7

To uninstall only the libmodsecurity package we can use the following command:

sudo dnf remove libmodsecurity

References

Summary

In this tutorial we learn how to install libmodsecurity on CentOS 7 using yum and dnf.