FedoraRHEL Based

How To Install Cacti on Fedora 41

Install Cacti on Fedora 41

Cacti is a powerful and flexible network monitoring tool that allows system administrators to visualize network performance through graphs and charts. It is particularly useful for tracking bandwidth usage, server performance, and other critical metrics. In this guide, we will walk you through the process of installing Cacti on Fedora 41, ensuring you have a robust monitoring solution for your IT infrastructure.

Prerequisites

Before diving into the installation process, it’s essential to ensure that your system meets the necessary requirements. Here’s what you need:

  • Fedora 41 installed on your server.
  • Root or sudo access to install packages.
  • Basic knowledge of command-line operations.

Additionally, you will need to install several packages that Cacti depends on:

  • Apache HTTP Server: The web server that will host the Cacti interface.
  • MariaDB or MySQL: The database server to store Cacti data.
  • PHP: The scripting language used by Cacti, along with necessary extensions.
  • SNMP tools: For network monitoring capabilities.
  • RRDtool: A data logging and graphing system for time series data.

Step 1: Update Your System

The first step in preparing your Fedora system for Cacti is to ensure all existing packages are up to date. This helps prevent compatibility issues during installation. Open your terminal and run the following command:

sudo dnf update -y

This command updates all installed packages to their latest versions. After the update is complete, it’s advisable to reboot your system to apply any kernel updates:

sudo reboot

Step 2: Install Required Packages

With your system updated, you can now install the required packages. Execute the following command in your terminal:

sudo dnf install httpd mariadb-server php php-mysqlnd php-snmp rrdtool net-snmp-utils -y

This command installs Apache, MariaDB, PHP along with its necessary extensions (like MySQL and SNMP), RRDtool, and SNMP utilities. Each of these components plays a crucial role in the functionality of Cacti.

Step 3: Start and Enable Services

Cacti requires both Apache and MariaDB services to be running. Start these services and enable them to start automatically on boot with the following commands:

sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb

This ensures that your web server and database server are always running when your system starts, making Cacti accessible at all times.

Step 4: Secure MariaDB Installation

A secure database is vital for protecting your Cacti installation. Run the following command to secure your MariaDB installation:

sudo mysql_secure_installation

This script will prompt you through several security options:

  • You will be asked to set a root password if not already set.
  • You can remove anonymous users for better security.
  • You should disallow root login remotely.
  • You can remove test databases that are accessible by default.
  • Finally, reload privilege tables to ensure all changes take effect.

Step 5: Create Cacti Database and User

The next step involves creating a dedicated database for Cacti. Access the MariaDB shell using the following command:

sudo mysql -u root -p

You will be prompted for the root password you set earlier. Once logged in, execute the following SQL commands to create a database and user for Cacti:

CREATE DATABASE cacti;
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';
FLUSH PRIVILEGES;

This creates a database named `cacti` and a user `cactiuser` with full privileges on that database. Remember to replace `’your_password_here‘` with a strong password of your choice.

Step 6: Install Cacti

Cacti can now be installed from the Fedora repositories. Run the following command:

sudo dnf install cacti -y

This command downloads and installs Cacti along with its dependencies. During installation, some configuration files may be created automatically.

Step 7: Configure Apache for Cacti

Cacti needs proper configuration in Apache to function correctly. Edit the configuration file by running:

sudo nano /etc/httpd/conf.d/cacti.conf

Add or modify the following lines within this file to ensure proper access control:

<Directory /usr/share/cacti/>
    Options None
    AllowOverride None
    Require all granted
</Directory>

This configuration allows access to the Cacti directory from any IP address. Save and exit the editor (in vi, press `Esc`, type `:wq`, and hit `Enter`). Then restart Apache for changes to take effect:

sudo systemctl restart httpd

Step 8: Import Default Database Schema

Cacti comes with a default database schema that needs to be imported into your newly created database. Use the following command:

sudo mysql -u cactiuser -p cacti < /usr/share/doc/cacti/cacti.sql

This imports the default schema into your `cacti` database. You will again need to provide the password for `cactiuser`. This step sets up necessary tables and initial data required by Cacti.

Step 9: Configure Cron Job for Polling

Cacti relies on cron jobs for polling data at regular intervals. To set this up, open the crontab editor with:

sudo crontab -e

Add the following line at the end of the file to schedule polling every five minutes:

* * * * * /usr/bin/php /usr/bin/cactid > /dev/null 2>&1

This cron job ensures that Cacti collects data consistently without manual intervention. Save and exit once again (using `Esc`, then `:wq` in vi).

Step 10: Accessing the Cacti Web Interface

Your installation of Cacti is now complete! You can access it via your web browser by navigating to:

http://<your_server_ip>/cacti/

The default login credentials are as follows:

  • User: admin
  • Password: admin

You should change these credentials immediately after logging in for security purposes. Follow any prompts provided by Cacti during first-time setup, including configuring settings specific to your environment.

Install Cacti on Fedora 41

Troubleshooting Common Issues

If you encounter issues during installation or while accessing Cacti, here are some common problems and their solutions:

  • Cron job not executing:
    – Ensure that cron service is running:

    sudo systemctl status crond

    – Check logs in `/var/log/cron` for errors.

  • Error connecting to database:
    – Verify that you have entered correct credentials in `/etc/cacti/db.php`.
    – Ensure that MariaDB is running:

    sudo systemctl status mariadb
  • No graphs displayed on dashboard:
    – Check if polling is working correctly by inspecting logs in `/var/log/cacti/cactid.log`.
    – Ensure SNMP is properly configured on monitored devices.
  • Cacti interface not loading:
    – Check Apache error logs:

    /var/log/httpd/error_log

    – Ensure SELinux is not blocking access:

    sestatus

    If SELinux is enforcing, consider setting it to permissive mode temporarily:

    sudoo setenforce 0 

Congratulations! You have successfully installed Cacti. Thanks for using this tutorial for installing the Cacti on your Fedora 41 system. For additional help or useful information, we recommend you check the official Cacti website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button