Cacti is a free and open-source network monitoring tool that uses RRDtool to store and display data for routers, switches, servers, and other networking equipment. This tutorial will show you how to install Cacti on a Debian Latest machine.
Before we start with the installation process, make sure that you have the following prerequisites:
Before starting the installation, update the packages on the system to the latest version.
sudo apt-get update
sudo apt-get upgrade
Cacti requires some additional packages to be installed on the system. Install the following packages using the following command:
sudo apt-get install apache2 php7.3 php7.3-mysql php7.3-snmp php7.3-gd mysql-server mysql-client rrdtool snmpd snmp graphviz
Create a MySQL user and a database for Cacti. Run the following commands to login to MySQL and create the user and database:
mysql -u root -p
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE cacti;
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';
FLUSH PRIVILEGES;
exit
Download the Cacti package from the official website using the following command:
wget https://www.cacti.net/downloads/cacti-latest.tar.gz
Extract the files using the following command:
tar -zxvf cacti-latest.tar.gz
Move the extracted files to the Apache default web directory using the following command:
sudo mv cacti* /var/www/html/cacti
Configure Apache for Cacti by editing the Apache configuration file. Open /etc/apache2/sites-available/000-default.conf using a text editor and add the following line at the end of the file:
Alias /cacti /var/www/html/cacti
Save and close the file.
Import the Cacti database to MySQL using the following command:
mysql -u cactiuser -p cacti < /var/www/html/cacti/cacti.sql
Configure SNMP and timezone settings for Cacti by editing the snmpd.conf file. Open the /etc/snmp/snmpd.conf using a text editor and add the following lines at the end of the file:
rocommunity public
syslocation "Location"
syscontact "Your Name <youremail@domain.com>"
Uncomment the line containing "agentAddress udp:127.0.0.1:161" to allow SNMP access from the localhost.
Then, edit the timezone setting in the PHP configuration file /etc/php/7.3/apache2/php.ini by changing the following parameter:
date.timezone = America/New_York
Save and close the file.
Set up the Cacti configuration by editing the Cacti configuration file /var/www/html/cacti/include/config.php. Change the following parameters as per the system's configuration:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "password";
$snmp_community = "public";
Save and close the file.
Spine is a faster and more efficient poller than the default poller, and is recommended for high traffic installations. Install the Spine poller using the following command:
sudo apt-get install spine
Start the Apache and SNMP services using the following commands:
sudo systemctl start apache2
sudo systemctl start snmpd
sudo systemctl enable apache2
sudo systemctl enable snmpd
Open a web browser and enter the URL http://SERVER_IP_ADDRESS/cacti. You will see the Cacti login page. Enter the default username admin and password admin to log in.
You have successfully installed Cacti on your Debian Latest machine. You can now use Cacti to monitor your network devices, servers, and other equipment.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!