This article will teach you How to Install Cacti on Fedora 34. Among the monitoring tools, Cacti is in a higher position due to its Open-Source and availability of resources. Cacti has made the monitoring process easy and powerful by having a web-based management environment and various templates for different operating systems and devices.
What is Cacti?
Cacti is an application for graphing the system by which SNMP services can be easily graphed from repositories. Cacti is based on the lamp and is a web-based network monitoring and monitoring solution for IT businesses. Cacti enables users to poll services at regular intervals to create graphs on the resulting data using RRDtool.
Cacti is a complete frontend to RRD tool and can maintain and handle Graphs, Data Sources, and Round Robin Archives in a database. Cacti is used to graph time-series data of metrics such as network bandwidth utilization, CPU load, running processes, and disk space.
Prerequisites to Install Cacti on Fedora 34
- Apache webserver to display network diagrams created by PHP and RRDTool
- MySQL Database Server to store cacti information
- PHP script module to create charts using RRDTool
- A PHP plugin for SNMP for data access
- NET-SNMP for network management
- An RRDTool database tool for managing and retrieving time series data such as CPU load, network bandwidth, etc.
How to Install Cacti on Fedora 34
First, you should buy Linux VPS to start the fedora. Then, you should install Apache by entering the following command:
dnf install httpd httpd-level
MariaDB offers an alternative to MySQL and is a community-developed fork of the MySQL database project. To install MariaDB, just run the following command:
dnf install mariadb-server -y
Now install PHP by entering the following command:
dnf install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli
Now you should install the PHP-SNMP prerequisites for data access. To do this use the following command:
dnf install php-snmp
Also, you should install NET-SNMP for network management with the following command:
dnf install net-snmp-utils net-snmp-libs
Finally, install RRDTool by executing the following command:
dnf install rrdtool
After completing the installation of prerequisites for installing Cacti, you should start them using the following commands:
systemctl start httpd.service systemctl start mariadb.service systemctl start snmpd.service
In this step, you need to configure the system startup links. Configure Apache, MySQL, and SNMP Services to start on boot. Use the following commands to do this:
systemctl enable httpd.service systemctl enable mariadb.service systemctl enable snmpd.service
Now it’s time to install Cacti on your Fedora 34 system. In the first step, you need to install and enable the EPEL Repository. Then you can install the Cacti application by entering the following command:
dnf install cacti
How to Configure MySQL Server for Cacti Installation
First, you should secure the MySQL Server by executing the following command:
Now you are going to create the MySQL Cacti database. You should log in to the MySQL Server with the newly created password and create the Cacti database with the Cacti user and then set a password for it. To do this enter the following command:
mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.5.41-MariaDB MariaDB Server Copyright (c) 2000, 2014, 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.00sec) MariaDB [(none)]> GRANT ALL ON cacti.* TO [email protected] IDENTIFIED BY 'neuronvm'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> FLUSH privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> quit; Bye
Next, you should install Cacti tables in MySQL. The first step to install cacti tables in MySQL is to find the path to the database file using the RPM command, then enter the following command to install the cacti tables in the new Cacti database:
rpm -ql cacti | grep cacti.sql
The output sample is as follows:
After having the location of the Cacti.sql file, you can install the tables by running the following command. Remember to enter the Cacti user password.
mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql Enter password:
In this step, you will configure the MySQL settings for Cacti. Open the /etc/cacti/db.php file with any editor:
You should make the following changes and then save the file:
/* 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;
Now configure the Firewall for Cacti by executing the following command:
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --reload
How to Configure Apache Server for Cacti Installation
First, open the /etc/httpd/conf.d/cacti.conf file in your desired editor:
You should have access to the Cacti application on your local network or at any IP level. So you have to enable it. For example, this article enables LAN network 22.214.171.124/01 access.
Alias /cacti /usr/share/cacti <Directory /usr/share/cacti/> Order Deny,Allow Deny from all Allow from 126.96.36.199/01 </Directory>
Then remember to change the settings in the latest version of Apache as follows:
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>
In the end, you must restart the Apache service by entering the following command:
systemctl restart httpd.service
You should open the /etc/cron.d/cacti file to set Cron for Cacti:
Be careful to Uncomment the following line. The poller.php script runs every 5 minutes and collects known host data used by the Cacti application to display graphs.
#*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
How to Run Cacti Installer on Fedora 34
Go to http://YOUR-IP-HERE/cacti/ and follow the installer instructions through the following pages. Then you must enter the default login details and press the Enter key.
User: admin Password: admin
Now you need to change the default Cacti password:
Check the Cacti License Agreement box:
In this step, the screen shows Pre-install Checks for Cacti installation. Then you should correct the suggested settings in your /etc/php.ini file as shown in the image, and restart Apache after making the changes:
memory_limit = 800M max_execution_time = 60 date.timezone = Asia/Kolkata
Now you should give the Cacti user access to the MySQL TimeZone database so that the database is filled with TimeZone global information. To do this, run the following command:
mysql> use mysql; mysql> GRANT SELECT ON mysql.time_zone_name TO [email protected]; mysql> flush privileges;
In the installation type, you must select “New Install“:
Make sure all permissions in the following directory are correct:
Then you need to know that all of this Critical Binary Locations and Versions values are correct:
In this step, you should select the default Data Source Profile to use in the polling sources:
Now you need to select the Device Templates that you want to use after installing Cacti:
Next, you should set the Server Collation in your MySQL /etc/my.cnf configuration file under the [mysqld] section:
[mysqld] character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci
Then check the Confirm Installation box and wait until the end of the process:
This article taught you how to install Cacti on Fedora 34. Also, with the help of this tutorial, you got acquainted with Cacti step by step and learned how to install its prerequisites. I hope this article was useful to you.