Installing Cacti on Fedora 32
Server Architecture: x86_64























Problem or Goal:
To install cacti monitoring tool on Fedora
Cause:
Cacti is a very important open source tool for network monitoring
Solution:
1. Install Apache
[root@localhost ~]# dnf install httpd httpd-devel
2. Install MariaDB (MariaDB is the default implementation of MySQL in RHEL/CentOS 8/7 and Fedora 19 onwards.)
[root@localhost ~]# dnf install mariadb-server -y
3. Install PHP
# dnf install php-mysqlnd php-pear php-common php-gd php-devel php php-mbstring php-cli
4. Install PHP-SNMP
[root@localhost ~]# dnf install php-snmp
5. Install NET-SNMP
[root@localhost ~]# dnf install net-snmp-utils net-snmp-libs
6. Install RRDTool
[root@localhost ~]# dnf install rrdtool
7. Start Apache, MariaDB and SNMP Services
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# systemctl start snmpd.service
8. Configure Apache, MariaDB and SNMP Services to start on boot.
[root@localhost ~]# systemctl enable httpd.service
[root@localhost ~]# systemctl enable mariadb.service
[root@localhost ~]# systemctl enable snmpd.service
9. Install Cacti
[root@localhost ~]# dnf install cacti
10. Configuring and Securing MySQL Server for Cacti Installation
# mysql_secure_installation
MariaDB root passwd: xxxxxx
username to cacti DB: cacti
passwd to cacti DB: xxxxxx
11. Create MySQL Cacti Database
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.3.17-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database cacti;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'xxxxx';
Query OK, 0 rows affected (0.010 sec)
MariaDB [(none)]> FLUSH privileges;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit;
Bye
12. Install Cacti Tables to MySQL
[root@localhost ~]# rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti/cacti.sql
(Now we’ve of the location of Cacti.sql file, type the following command to install tables,
here you need to type the Cacti user password)
[root@localhost ~]# mysql -u cacti -p cacti < /usr/share/doc/cacti/cacti.sql
NOTE: -u specifies the user 'cacti' and -p specifies the db 'cacti', you will have to enter the passwd to cacti db "xxxxxx"
13. Configure MySQL settings for Cacti
[root@localhost ~] # vi /etc/cacti/db.php
14. Configuring Firewall for Cacti
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=http
[root@localhost ~]# firewall-cmd --reload
15. Configure Apache Server for Cacti Installation
# vi /etc/httpd/conf.d/cacti.conf
Alias /cacti /usr/share/cacti
<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>
16. Restart the Apache service
[root@localhost ~]# systemctl restart httpd.service
17. Setting Cronjob for Cacti
[root@localhost ~]# vi /etc/cron.d/cacti
Uncomment the following line.
(The poller.php script runs every 5mins and collects data of known host which is used by Cacti application to display graphs)
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
18. Running Cacti Installer Setup in your browser
http://192.168.0.149/cacti/
Default login
User: admin
Password: admin
19. If you can't access the HTTP Service on your server, you might want to check your firewall and probably disable it for now.
[root@localhost ~]# service firewalld status
[root@localhost ~]# service firewalld stop
20. Accept the License agreement
21. Pre-installation Checks for Cacti installation
(please correct the suggested settings in your /etc/php.ini file as shown and restart Apache after making changes)
memory_limit = 800M
max_execution_time = 60
date.timezone = Africa/Juba
# timedatectl list-timezones
Africa/Juba
# timedatectl set-timezone Africa/Juba
22. Similarly, you also need to grant access to the MySQL TimeZone database for user Cacti,
so that the database is populated with global TimeZone information
mysql> use mysql;
mysql> GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;
mysql> flush privileges;
mysql> show variables like '%time_zone%';
23. To clear this ERROR: Your MySQL TimeZone database is not populated.
Please populate this database before proceeding.
Run the following command
# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Hit refresh and if the errors have cleared, you are good to proceed to next
24. Installation Type
25. Directory Permission Checks
Potential permission issues (ERROR! /usr/share/cacti/log/ Not Writable)
Run the following commands to clear the error above
[root@localhost ~]# chown -R apache.apache /usr/share/cacti/log/
[root@localhost ~]# setenforce 0
26. Critical Binary Locations and Versions
27. Confirm Installation
Problem Solved?
You are welcome to ask questions in the comments section