How to install Cacti on CentOS 7

banner dedicated


In this tutorials, we will show you how to install Cacti on CentOS 7.


Requirements :


Install the PHP Modules for Cacti

yum install php-gd php-pear php-common php-cli php-devel php-snmp net-snmp-utils net-snmp-libs rrdtool -y


Create Cacti Database and User

Where the database will be cactidatabase, the user will be cacti and the password, cactipass.

mysql -u root -p
MariaDB> CREATE DATABASE cactidatabase;
MariaDB> GRANT ALL PRIVILEGES ON cactidatabase.* TO 'cacti'@'localhost' IDENTIFIED BY 'cactipass';
MariaDB> FLUSH PRIVILEGES;
MariaDB> exit


Installation of Cacti

yum install epel-release -y
yum install cacti -y


Import Cacti database in your Database Server

Locate Cacti database to import.

rpm -ql cacti|grep cacti.sql
/usr/share/doc/cacti-0.8.8h/cacti.sql

Import the Database in your Database Server

mysql -u cacti -p cactidatabase < /usr/share/doc/cacti-0.8.8h/cacti.sql


Insert the Database informations in the config file

nano /etc/cacti/db.php
...
database_default = "cactidatabase";
database_hostname = "localhost";
database_username = "cacti";
database_password = "cactipass";


Configure Apache for Cacti

Edit the cacti confg and change the following block to reflect this one.

nano /etc/httpd/conf.d/cacti.conf
<Directory /usr/share/cacti/>
<IfModule mod_authz_core.c>
# httpd 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# httpd 2.2
Order deny,allow
Deny from all
Allow from all
</IfModule>
</Directory>


Restart your Webserver

systemctl restart httpd.service


Uncomment the crontab line

nano /etc/cron.d/cacti

*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1


Create the empty cacti log file

mkdir /var/log/cacti
touch /var/log/cacti/cacti.log


Finish your installation online

http://your_main_ip/cacti/


banner dedicated


Colo-Serv Communications has written 32 articles

Premium Dedicated Hosting Services