Cacti is a free and open source web-based and network monitoring tool. It provides fast polling by creating sophisticated graphic templates and several data collection methods. Cacti is the complete front end for RRDTool, Cacti stores all necessary information about monitoring tools to create charts and fill them with data from the MySQL database.
In this tutorial, we will show you how to install Cacti on Debian Buster 10. We will install Cacti under the LAMP stack, Apache web server, PHP 7.3, and MariaDB server on Debian Buster 10 at this time.
For this tutorial we will install Cacti on a Debian system with 1 GB of RAM, 25 GB of free disk space and 2 CPUs. We will also use sudo root privileges to install packages and edit configurations on the system.
What we will do?
- Install Apache Webserver
- Install and Configure MariaDB Server
- Install and Configure PHP 7.3
- Install Additional Packages
- Install Cacti on Debian 10
Step 1 – Install Apache Webserver
First, we will install the Apache web server on Debian Server 10.
Update the repository al on the Debian system and install the Apache2 package using the apt command below.
sudo apt update sudo apt install apache2 apache2-utils
After all installation is complete, start the Apache2 service and add it to the system boot.
systemctl start apache2 systemctl enable apache2
The Apache2 web server is up and running, check using the systemctl command below.
systemctl status apache2
As a result, the installation of the Apache2 web server is complete.
Step 2 – Install MariaDB
In this step, we will install and configure the MariaDB database server.
Install the MariaDB database using the apt command below.
sudo apt install mariadb-server
After all installation is complete, start the MariaDB service and add it to the system boot.
systemctl start mariadb systemctl enable mariadb
MariaDB service is up and running.
Next, we will edit the MariaDB configuration for the Cacti installation.
Edit MariaDB ‘/etc/mysql/mariadb.conf.d/50-server.cnf’ configuration using the vim editor.
Paste the following configuration under the ‘[mysqld]’ section as below.
[mysqld] ... collation-server = utf8mb4_unicode_ci character-set-server = utf8mb4 innodb_flush_log_at_timeout = 4 innodb_read_io_threads = 34 innodb_write_io_threads = 17 max_heap_table_size = 70M tmp_table_size = 70M join_buffer_size = 130M innodb_buffer_pool_size = 250M innodb_io_capacity = 5000 innodb_io_capacity_max = 10000 innodb_file_format = Barracuda innodb_large_prefix = 1 ...
Save and close.
Now restart the MariaDB service and make sure there are no errors, then check the status of the MariaDB service.
systemctl restart mariadb systemctl status mariadb
Below are the results that you will get.
As a result, the installation and configuration of the MariaDB Server for the Cacti installation has been completed successfully.
Step 3 – Install PHP 7.3
In this step, we will install the PHP 7.3 package with additional packages needed for the Cacti installation.
Install the PHP 7.3 package using the apt command below.
sudo apt install php php-common php-mysql php-snmp php-xml php-mbstring php-json php-gd php-gmp php-zip php-ldap php-pear php-php-gettext php-phpseclib php-twig
After all installation is complete, open the ‘/etc/php/7.3’ directory.
Edit the ‘php.ini’ configuration for Apache2 and cli.
vim apache2/php.ini vim cli/php.ini
Cancel comments on the ‘date.timezone’ option and change the value with your time zone.
date.timezone = Asia/Singapore
Now uncomment the ‘cgi.fix_pathinfo’ option and change the value to ‘0’.
cgi.fix_pathinfo = 0
Save and close.
Next, restart the Apache2 service to implement the new configuration.
systemctl restart apache2
As a result, the installation and configuration of PHP 7.3 for the Cacti installation has been completed successfully.
Step 4 – Install SNMP and RRDTool
In this step, we will install the SNMP and rrdtool packages to the Debian 10 server.
SNMP or (Simple Network Management Protocol) is used to exchange management information between agents (servers) and clients. And rrdtool (Round Robin the Database tool) is used to store and display time-series data for system monitoring with graphical support.
Install the SNMP and rrdtool packages using the apt command below.
sudo apt install snmp php-snmp rrdtool librrds-perl
After all installation is complete, proceed to the next step to install the Cacti Monitoring Tool.
Step 5 – Install Cacti
By default, the Cacti Monitoring Tool is available in the Debian Buster 10 repository, can be installed using the apt command.
Show the cacti package in the Debian repository using the following command.
sudo apt search cacti sudo apt show cacti
Now install Cacti and Cacti-spine (Alternative collector based on C) using the apt command below.
sudo apt install cacti cacti-spine
During installation, you will be asked to configure the web server and dbconfig-common.
For web server configuration, select ‘apache2‘ and select ‘OK‘.
Next, you will be asked to configure the database via ‘dbconfig-common’, select ‘Yes’ to continue.
Now type your password for the cactus database configuration and cactus admin login.
Repeat the password and select ‘OK‘.
And the Cacti installation is complete, now it can be accessed from a web browser.
Step 6 – Testing
Open your web browser and type the server’s IP address with the ‘cacti’ path in the address bar.
http: // serverip / cacti /
Now you will get the Cacti login page as below.
Type ‘admin’ the default user with the password you just configured and click the ‘Login‘ button.
Now you will get the Cacti Admin Dashboard as below.
As a result, the installation and configuration of the Cacti Monitoring Tool with LAMP Stack on Debian Buster 10 has been completed successfully.