{"id":13674,"date":"2024-11-15T08:18:45","date_gmt":"2024-11-15T08:18:45","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=13674"},"modified":"2026-02-26T14:02:09","modified_gmt":"2026-02-26T14:02:09","slug":"how-to-install-mod-security-on-a-centos-server","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/","title":{"rendered":"How to Install Mod_Security on a CentOS Server"},"content":{"rendered":"<p>Mod_Security is an application firewall designed to protect servers from various script exploits in <a href=\"https:\/\/www.bodhost.com\/kb\/tips-on-importing-your-web-applications-into-softaculous\/\" target=\"_blank\" rel=\"noopener\">web applications<\/a>. It enhances server security by providing additional protection beyond the network firewall, helping server administrators defend against attacks.<\/p>\n<p><strong>Steps to Install Mod_Security on a CentOS Dedicated Server:<\/strong><\/p>\n<ol>\n<li><strong>Add the ModSecurity Repository:<\/strong> Open the terminal and execute the following command to navigate to the repository directory:<br \/>\ncd \/etc\/yum.repos.d<\/li>\n<li><strong>Create a New Repository File:<\/strong> Next, create a new file for the repository:<br \/>\ntouch utter_ramblings.repo<\/li>\n<li><strong>Edit the Repository File:<\/strong> Open the file you just created with a text editor like vi or nano, and add the following content:<br \/>\n[utterramblings]<br \/>\nname=Jason\u2019s Utter Ramblings Repo<br \/>\nbaseurl=http:\/\/www.jasonlitka.com\/media\/EL$releasever\/$basearch\/<br \/>\nenabled=1<br \/>\ngpgcheck=1<br \/>\ngpgkey=http:\/\/www.jasonlitka.com\/media\/RPM-GPG-KEY-jlitka<\/li>\n<li><strong>Install Mod Security:<\/strong> After saving the file, run the following command to install the Mod_Security package:<br \/>\nyum install mod_security<br \/>\nThis will install a working version of Mod_Security on your server, which can be used with the Apache web server.<\/li>\n<li><strong>Configure Mod_Security:<\/strong> Once installed, you can configure Mod_Security to suit your specific needs.<\/li>\n<\/ol>\n<p>By installing Mod Security through the yum repository, you ensure that it will receive automatic updates along with other system updates.<\/p>\n<p>By now you will be able to install Mod Security on CentOS Server.<\/p>\n<p>Read Also: <a href=\"https:\/\/www.bodhost.com\/kb\/how-to-change-server-hostname-on-centos-dedicated-server\/\" target=\"_blank\" rel=\"noopener\">How to Change Server Hostname on CentOS Dedicated Server?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mod_Security is an application firewall designed to protect servers from various script exploits in web applications. It enhances server security by providing additional protection beyond the network firewall, helping server administrators defend against attacks. Steps to Install Mod_Security on a CentOS Dedicated Server: Add the ModSecurity Repository: Open the terminal and execute the following command [&hellip;]<\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[837],"tags":[1581],"class_list":["post-13674","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-install-mod_security-on-a-centos-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Mod_Security on Your CentOS Server<\/title>\n<meta name=\"description\" content=\"This guide shows how to install Mod_Security on CentOS. Mod_Security is a firewall that protects servers from web application exploits.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Mod_Security on Your CentOS Server\" \/>\n<meta property=\"og:description\" content=\"This guide shows how to install Mod_Security on CentOS. Mod_Security is a firewall that protects servers from web application exploits.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-15T08:18:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:09+00:00\" \/>\n<meta name=\"author\" content=\"Serena\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Serena\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/\"},\"author\":{\"name\":\"Serena\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\"},\"headline\":\"How to Install Mod_Security on a CentOS Server\",\"datePublished\":\"2024-11-15T08:18:45+00:00\",\"dateModified\":\"2026-02-26T14:02:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/\"},\"wordCount\":244,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"Install Mod_Security on a CentOS Server\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/\",\"name\":\"How to Install Mod_Security on Your CentOS Server\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2024-11-15T08:18:45+00:00\",\"dateModified\":\"2026-02-26T14:02:09+00:00\",\"description\":\"This guide shows how to install Mod_Security on CentOS. Mod_Security is a firewall that protects servers from web application exploits.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-install-mod-security-on-a-centos-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorial\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Mod_Security on a CentOS Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\",\"name\":\"Serena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"caption\":\"Serena\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/seema\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Mod_Security on Your CentOS Server","description":"This guide shows how to install Mod_Security on CentOS. Mod_Security is a firewall that protects servers from web application exploits.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Mod_Security on Your CentOS Server","og_description":"This guide shows how to install Mod_Security on CentOS. Mod_Security is a firewall that protects servers from web application exploits.","og_url":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2024-11-15T08:18:45+00:00","article_modified_time":"2026-02-26T14:02:09+00:00","author":"Serena","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Serena","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/"},"author":{"name":"Serena","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830"},"headline":"How to Install Mod_Security on a CentOS Server","datePublished":"2024-11-15T08:18:45+00:00","dateModified":"2026-02-26T14:02:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/"},"wordCount":244,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["Install Mod_Security on a CentOS Server"],"articleSection":["Tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/","url":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/","name":"How to Install Mod_Security on Your CentOS Server","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2024-11-15T08:18:45+00:00","dateModified":"2026-02-26T14:02:09+00:00","description":"This guide shows how to install Mod_Security on CentOS. Mod_Security is a firewall that protects servers from web application exploits.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/how-to-install-mod-security-on-a-centos-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Tutorial","item":"https:\/\/www.bodhost.com\/kb\/category\/tutorial\/"},{"@type":"ListItem","position":2,"name":"How to Install Mod_Security on a CentOS Server"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830","name":"Serena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","caption":"Serena"},"url":"https:\/\/www.bodhost.com\/kb\/author\/seema\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=13674"}],"version-history":[{"count":4,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13674\/revisions"}],"predecessor-version":[{"id":14514,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/13674\/revisions\/14514"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=13674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=13674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=13674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}