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:
- Install the necessary packages using the
yumpackage manager:sudo yum install cacti cacti-spine httpd mariadb-server php php-mysqlnd net-snmp net-snmp-utils php-snmp -y - Start the
mariadbservice and configure it to start automatically on boot:sudo systemctl start mariadbrnsudo systemctl enable mariadb - Run the
mysql_secure_installationscript to secure the MariaDB installation and set the root password:sudo mysql_secure_installation - 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.
- Import the default Cacti database schema into the new
cactidatabase:sudo mysql -u cacti -p cacti < /usr/share/doc/cacti/cacti.sqlEnter the password you set for the
cactiMySQL user in step 4 when prompted. - Edit the Cacti configuration file
/etc/cacti/db.phpand set the MySQL database credentials:sudo vi /etc/cacti/db.phprn$database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "password";Replace 'password' with the password you set for the
cactiMySQL user in step 4. - Edit the Apache configuration file
/etc/httpd/conf.d/cacti.confand add the following lines to allow access to the Cacti web interface from the local network:<Directory /usr/share/cacti/> Options +FollowSymLinksrn AllowOverride None Order allow,denyrn Allow from 192.168.0.0/24 </Directory>Replace
192.168.0.0/24with the IP address range of your local network. - Edit the Cacti configuration file
/etc/cacti/cacti.confand set the timezone:sudo vi /etc/cacti/cacti.conf date_default_timezone = "Europe/London"Replace
Europe/Londonwith your timezone. - Start the Cacti and Apache services and configure them to start automatically on boot:
sudo systemctl start cactirnsudo systemctl enable cactirnsudo systemctl start httpdrnsudo systemctl enable httpd - Open your web browser and go to
http://<cacti-server>/cacti/to access the Cacti web interface. The default login credentials areadmin/admin.
