How To Install Cacti on Debian Latest
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.
Prerequisites
Before we start with the installation process, make sure that you have the following prerequisites:
- A Debian OS with root level access
- 512 MB of RAM
- An open port for the web server (for example port 80)
- SSH access to the server
- Apache web server and MySQL installed on the system
Step 1: Update the system
Before starting the installation, update the packages on the system to the latest version.
sudo apt-get update
sudo apt-get upgrade
Step 2: Install required packages
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
Step 3: Configure MySQL
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
Step 4: Download and extract Cacti files
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
Step 5: Configure Apache for 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.
Step 6: Import Cacti database
Import the Cacti database to MySQL using the following command:
mysql -u cactiuser -p cacti < /var/www/html/cacti/cacti.sql
Step 7: Configure SNMP and Timezone
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 <[email protected]>"
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.
Step 8: Configure Cacti
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.
Step 9: Install the Spine Poller
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
Step 10: Start Apache and SNMP services
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
Step 11: Access Cacti
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.
Conclusion
You have successfully installed Cacti on your Debian Latest machine. You can now use Cacti to monitor your network devices, servers, and other equipment.