RedHat / CentOS Install and Configure Cacti Network Graphing Tool

Cacti is a popular network graphing tool that allows you to monitor and graph various metrics about your network devices. Here’s how to install and configure Cacti on RedHat and CentOS:

  1. Install the necessary packages using the yum package manager:
    sudo yum install cacti cacti-spine httpd mariadb-server php php-mysqlnd net-snmp net-snmp-utils php-snmp -y
  2. Start the mariadb service and configure it to start automatically on boot:
    sudo systemctl start mariadb
    sudo systemctl enable mariadb
  3. Run the mysql_secure_installation script to secure the MariaDB installation and set the root password:
    sudo mysql_secure_installation
  4. Create a new MySQL database for Cacti:
    mysql -u root -p
    CREATE DATABASE cacti;
    GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
    exit;

    Replace ‘password’ with a strong password of your choice.

  5. Import the default Cacti database schema into the new cacti database:
    sudo mysql -u cacti -p cacti < /usr/share/doc/cacti/cacti.sql

    Enter the password you set for the cacti MySQL user in step 4 when prompted.

  6. Edit the Cacti configuration file /etc/cacti/db.php and set the MySQL database credentials:
    sudo vi /etc/cacti/db.php
    $database_type = "mysql";
    $database_default = "cacti";
    $database_hostname = "localhost";
    $database_username = "cacti";
    $database_password = "password";

    Replace ‘password’ with the password you set for the cacti MySQL user in step 4.

  7. Edit the Apache configuration file /etc/httpd/conf.d/cacti.conf and add the following lines to allow access to the Cacti web interface from the local network:
    <Directory /usr/share/cacti/>
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from 192.168.0.0/24
    </Directory>

    Replace 192.168.0.0/24 with the IP address range of your local network.

  8. Edit the Cacti configuration file /etc/cacti/cacti.conf and set the timezone:
    sudo vi /etc/cacti/cacti.conf
    date_default_timezone = "Europe/London"

    Replace Europe/London with your timezone.

  9. Start the Cacti and Apache services and configure them to start automatically on boot:
    sudo systemctl start cacti
    sudo systemctl enable cacti
    sudo systemctl start httpd
    sudo systemctl enable httpd
  10. Open your web browser and go to http://<cacti-server>/cacti/ to access the Cacti web interface. The default login credentials are admin / admin.

That’s it! You should now be able to use Cacti to monitor and graph various metrics about your network devices.

Leave a Comment