{"id":2097,"date":"2016-06-27T16:56:46","date_gmt":"2016-06-27T20:56:46","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2097"},"modified":"2017-11-24T14:59:17","modified_gmt":"2017-11-24T19:59:17","slug":"install-cacti-centos-7","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/","title":{"rendered":"How to Install Cacti on CentOS 7"},"content":{"rendered":"<h1>How to Install Cacti on CentOS 7<\/h1>\n<p>Cacti is a configurable, scalable network and resource monitoring system based on the RRDTool suite. It works on systems ranging from simple LAN installations, to multi data center LANs. Cacti provides user management, as well as acquisition of data from multiple sources in an easy-to-use interface. This guide sets up a Cacti installation on a CentOS 7 server.<\/p>\n<h2>Getting Started<\/h2>\n<p>To complete this guide, you will need the following:<br \/>\n\u2022 1 Node (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\"><b>Cloud Server<\/b><\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\"><b>Dedicated Server<\/b><\/a>) running CentOS 7.<\/p>\n<p>While good for learning how to set up Cacti on CentOS, it is better to install Cacti on a running server once you are familiar with the process, as monitoring is crucial for production-facing assets.<\/p>\n<h2>Tutorial<\/h2>\n<p>Let&#8217;s update all installed packages. Not only does this apply any known security fixes, but it also resolves issues in the base CentOS system.<\/p>\n<p><code>yum update -y<\/code><\/p>\n<p>Cacti depends on Apache, PHP, the MariaDB MySQL fork, and the associated modules needed to make PHP and Apache work together. We&#8217;ll install those next.<\/p>\n<p><code>yum install nano httpd httpd-devel mariadb-server php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli -y<\/code><\/p>\n<p>SNMP is also crucial to the Cacti stack. We&#8217;ll install net-snmp, the php-snmp module so PHP can retrieve SNMP data, and finally rrdtool.<\/p>\n<p><code>yum install php-snmp net-snmp-utils net-snmp-libs rrdtool -y<\/code><\/p>\n<p>Let&#8217;s start bringing up the various components Cacti needs. We&#8217;ll begin by launching Apache, MariaDB and SNMP.<\/p>\n<p><code>systemctl start httpd.service<br \/>\nsystemctl start snmpd.service<br \/>\nsystemctl start mariadb.service<\/code><\/p>\n<p>All of these should be configured to start at boot. Here we configure these components to launch when the server starts.<\/p>\n<p><code>systemctl enable httpd.service<br \/>\nsystemctl enable snmpd.service<br \/>\nsystemctl enable mariadb.service<\/code><\/p>\n<p>We must now secure access to Cacti. Leaving monitoring solutions open to public viewing is a security risk. This next step adds password authentication for Cacti.<\/p>\n<p><code>mysql_secure_installation<\/code><\/p>\n<p>Cacti needs a database, which will now be created. We&#8217;ll also create a cacti user and grant it all database privileges.<\/p>\n<p><code>mysql -u root -p<br \/>\nMariaDB&gt; CREATE DATABASE cactidb;<br \/>\nMariaDB&gt; CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactipassword';<br \/>\nMariaDB&gt; GRANT ALL PRIVILEGES ON cactidb.* TO 'cactiuser'@'localhost';<br \/>\nMariaDB&gt; FLUSH PRIVILEGES;<br \/>\nMariaDB&gt; exit<\/code><\/p>\n<p>It is finally time to install Cacti itself.<\/p>\n<p><code>yum install epel-release -y<br \/>\nyum install cacti -y<\/code><\/p>\n<p>Cacti ships with a cacti.sql database dump that should be imported into MySQL. We need to find where it was stored in order to perform the import.<\/p>\n<p><code>rpm -ql cacti|grep cacti.sql<br \/>\n\/usr\/share\/doc\/cacti-0.8.8h\/cacti.sql <\/code><\/p>\n<p>Now we&#8217;ll actually import the schema we&#8217;ve just found. This command loads the cacti.sql dump into the database we created previously.<\/p>\n<p><code>mysql -u cactiuser -p cactidb &lt; \/usr\/share\/doc\/cacti-0.8.8h\/cacti.sql<\/code><\/p>\n<p>Cacti needs to know how to connect to the database. We must add the database name and credentials to its database configuration file.<\/p>\n<p><code>nano \/etc\/cacti\/db.php<br \/>\n[...]<br \/>\ndatabase_default = \"cactidb\";<br \/>\ndatabase_hostname = \"localhost\";<br \/>\ndatabase_username = \"cactiuser\";<br \/>\ndatabase_password = \"cactipassword\";<br \/>\n[...]<\/code><\/p>\n<p>Apache must be accessible from the network so we can view Cacti&#8217;s statistics. Edit \/etc\/httpd\/conf.d\/cacti.conf.<\/p>\n<p><code>nano \/etc\/httpd\/conf.d\/cacti.conf<\/code><\/p>\n<p>Change these two lines:<\/p>\n<p><code class=\"gris\">&lt;Directory \/usr\/share\/cacti\/&gt;<br \/>\n&lt;IfModule mod_authz_core.c&gt;<br \/>\n# httpd 2.4<br \/>\nRequire host localhost &lt;---- This one<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;IfModule !mod_authz_core.c&gt;<br \/>\n# httpd 2.2<br \/>\nOrder deny,allow<br \/>\nDeny from all<br \/>\nAllow from localhost &lt;---- This one<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;\/Directory&gt;<\/code><\/p>\n<p>to:<\/p>\n<p><code class=\"gris\">&lt;Directory \/usr\/share\/cacti\/&gt;<br \/>\n&lt;IfModule mod_authz_core.c&gt;<br \/>\n# httpd 2.4<br \/>\nRequire all granted<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;IfModule !mod_authz_core.c&gt;<br \/>\n# httpd 2.2<br \/>\nOrder deny,allow<br \/>\nDeny from all<br \/>\nAllow from all<br \/>\n&lt;\/IfModule&gt;<br \/>\n&lt;\/Directory&gt;<\/code><\/p>\n<p>Restart Apache so it picks up the configuration changes we&#8217;ve just made.<\/p>\n<p><code>systemctl restart httpd.service<\/code><\/p>\n<p>There is a crontab entry for Cacti that must be activated in order for it to create its graphs. Uncomment the line in \/etc\/cron.d\/cacti.<\/p>\n<p><code>nano \/etc\/cron.d\/cacti<\/code><\/p>\n<p><code class=\"gris\">#*\/5 * * * * cacti \/usr\/bin\/php \/usr\/share\/cacti\/poller.php &gt; \/dev\/null 2&gt;&amp;1<\/code><\/p>\n<p>to:<\/p>\n<p><code class=\"gris\">*\/5 * * * * cacti \/usr\/bin\/php \/usr\/share\/cacti\/poller.php &gt; \/dev\/null 2&gt;&amp;1<\/code><\/p>\n<p>In order for Cacti to log its results, we&#8217;ll need to create an empty cacti.log.<\/p>\n<p><code>mkdir \/var\/log\/cacti<br \/>\ntouch \/var\/log\/cacti\/cacti.log<\/code><\/p>\n<p>The remaining installation steps are done via the web interface. Visit http:\/\/your_ip\/cacti to finish the process.<\/p>\n<p>When prompted for a username and password, enter &#8220;admin&#8221; for both. These should be changed as soon as possible.<\/p>\n<h2>Conclusion<\/h2>\n<p>This CentOS 7 server is now being monitored by Cacti. While the results of monitoring an empty server are not terribly interesting, the true utility of monitoring becomes quickly apparent when it is used on a production server managing actual workloads. If this guide was helpful to you, kindly share it with others who may also be interested. <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How to Install Cacti on CentOS 7 Cacti is a configurable, scalable network and resource monitoring system based on the RRDTool suite. It works on systems ranging from simple LAN installations, to multi data center LANs. Cacti provides user management, as well as acquisition of data from multiple sources in an easy-to-use interface. This guide<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[],"class_list":["post-2097","post","type-post","status-publish","format-standard","hentry","category-networking","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install Cacti on CentOS 7 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how to install Cacti on your CentOS 7 server. Read now &amp; start monitoring your network and ressources on the RRDTool suite.\" \/>\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.globo.tech\/learning-center\/install-cacti-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Cacti on CentOS 7 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how to install Cacti on your CentOS 7 server. Read now &amp; start monitoring your network and ressources on the RRDTool suite.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-27T20:56:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-24T19:59:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/\",\"name\":\"How to Install Cacti on CentOS 7 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\"},\"datePublished\":\"2016-06-27T20:56:46+00:00\",\"dateModified\":\"2017-11-24T19:59:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how to install Cacti on your CentOS 7 server. Read now & start monitoring your network and ressources on the RRDTool suite.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.globo.tech\/learning-center\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Cacti on CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\/\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Cacti on CentOS 7 - Globo.Tech","description":"This tutorial will show you how to install Cacti on your CentOS 7 server. Read now & start monitoring your network and ressources on the RRDTool suite.","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.globo.tech\/learning-center\/install-cacti-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Cacti on CentOS 7 - Globo.Tech","og_description":"This tutorial will show you how to install Cacti on your CentOS 7 server. Read now & start monitoring your network and ressources on the RRDTool suite.","og_url":"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/","og_site_name":"Globo.Tech","article_published_time":"2016-06-27T20:56:46+00:00","article_modified_time":"2017-11-24T19:59:17+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/","url":"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/","name":"How to Install Cacti on CentOS 7 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-06-27T20:56:46+00:00","dateModified":"2017-11-24T19:59:17+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how to install Cacti on your CentOS 7 server. Read now & start monitoring your network and ressources on the RRDTool suite.","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/install-cacti-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Install Cacti on CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2097"}],"version-history":[{"count":8,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2097\/revisions"}],"predecessor-version":[{"id":3846,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2097\/revisions\/3846"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}