Tutorial: How to install Cacti 1.1.26 on CentOS7

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
dulebeograd
Posts: 14
Joined: Wed Mar 19, 2014 7:25 am

Tutorial: How to install Cacti 1.1.26 on CentOS7

Post by dulebeograd »

Hi all,

as I have lost 7-10 days trying to properly install newest version of Cacti onto CentOS 7.
Here I will document how to install Cacti 1.1.26 onto CentOS7 in less than 2 Hours :)

My biggest problem was trying to install Spine for Cacti with MariaDB 10.2 version.
There is a problem when you want to "make" install files.. there is always an error:
/usr/bin/ld: cannot find -lmysqlclient
or some other kind of library..

So lets get through the Installation process:
1. You need Installed machine with Centos 7

2. yum update/upgrade // we want to update the OS to the newest state

3. install wget - yum install wget

4. add epel repo:
wget http://dl.fedoraproject.org/pub/epel/7/ ... noarch.rpm
rpm -ivh epel-release-7-11.noarch.rpm

5. add mariaDB 10.1 repo // you can also install it from centos repository but you will end up with 5.xx version..
make a new file into directory /etc/yum.repos.d/ named MariaDB.repo, and write this info:
# MariaDB 10.1 CentOS repository list - created 2017-11-03 09:53 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

6. Install the following packages:
yum install -y httpd httpd-devel mariadb-server mariadb-client php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp net-snmp-utils net-snmp-libs rrdtool cacti

7. Start and enable starting of the services with Machine poweron:
systemctl start httpd.service
systemctl start mariadb.service
systemctl start snmpd.service
systemctl enable httpd.service
systemctl enable mariadb.service
systemctl enable snmpd.service

8. Setup MySQL Server for cacti:
mysqladmin -u root password 'your-desired-password-here' // my suggestion cacti
create database cacti;
GRANT ALL ON cacti.* cacti@localhost IDENTIFIED BY 'password-you-set-above';
FLUSH privileges;
quit;

9. Setup Cacti Tables in Mariadb
we need location info for cacti.sql
rpm -ql cacti | grep cacti.sql

mysql -u cacti -p cacti < ... here you should type output from the command above

10. Configure MySQL settings for Cacti:
vi /etc/cacti/db.php

/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "your-password-here";
$database_port = "3306";
$database_ssl = false;

11. Configure Apache Server for Cacti installation:
vi /etc/httpd/conf.d/cacti.conf

In the httpd 2.4 change the value to:
Require all granted

In the httpd 2.2 change the values to:
Deny from none
Allow from all

12. Allow http communication through CentOS firewall:
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

13. Restart Apache server:
systemctl restart httpd.service

14. Allow 5min poll on cacti:
vi /etc/cron.d/cacti
remove the # sign from the beginning of the line.

15. Start the webinstallation:
http://ip-address/cacti/

16. If you get the following error:
ERROR: Your Cacti database login account does not have access to the MySQL TimeZone database

you need to do the following:
[root@CBcacti]# mysql -u root -p
Enter password: YOUR-PASSWORD-HERE <--****replace with your own password, of course****
MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO cacti@localhost IDENTIFIED BY 'Password you already entered'; // try ’cacti’
MariaDB [(none)]> FLUSH privileges;
MariaDB [(none)]> quit;

systemctl restart mariadb.service
systemctl restart httpd.service
and try the installation once more.

17. If you get the following error:
ERROR: Your MySQL TimeZone database is not populated

You need to do the following:
mysql -u root -p mysql
mysql> GRANT ALL PRIVILEGES ON mysql.* TO 'cacti'@'localhost' WITH GRANT OPTION;
mysql> FLUSH privileges;
mysql> quit;

systemctl restart mariadb.service
systemctl restart httpd.service

18. Install SPINE on cacti:
Prerequired:
yum install -y dos2unix, help2man, libtool, openssl098e, openssl-devel, mariadb-devel, net-snmp-devel
wget https://www.cacti.net/downloads/spine/c ... .27.tar.gz
tar -xzvf cacti-spine-1.1.27.tar.gz
cd cacti-spine-1.1.27
./bootstrap
./configure
make
make install

There were some kind of warnings regarding Spine like it wasnt installed.. but eventually after few restarts it was fine..
there was some warning telling that some folders didnt have necessary right before installation, although i did gave necessary rights..
I guess this was some kind of bug with Cacti..
I proceeded and finished the web installation..

Thats it enjoy Cacti :)

Best regards from Belgrade, Serbia!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests