You can support us by downloading this article as PDF from the Link below. Download the guide as PDF


In this guide, you’ll learn to Install Cacti on Debian 10 (Buster) with Nginx reverse proxy. Cacti is a complete network graphing solution designed to harness the power of RRDTool’s data storage and graphing functionality. Cacti offer fast polling, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with thousands of devices.

Follow the following steps to get Cacti running in Debian 10 (Buster).

Step 1: Install Required Packages

There are dependency packages required for the installation. Ensure they are installed.

sudo apt update
sudo apt install software-properties-common
sudo apt install nginx
sudo apt install curl vim acl composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full python-memcache python-mysqldb snmp snmpd whois php-snmp rrdtool librrds-perl

Step 2: Install PHP

Run the following commands on your Debian 10 terminal to install PHP 7.3.

sudo apt -y install php php-common

Add PHP Extensions

sudo apt -y install php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd  php-mbstring php-curl php-xml php-pear php-bcmath php-gmp php-ldap

Step 3: Database Configuration

We installed MariaDB in step 1. Let us proceed to create a database for Cacti.

Login to your DataBase

sudo systemctl enable mysql
sudo systemctl restart mysql
sudo mysql -u root -p

Create Database and cacti user

The default Cacti database data we will import later uses a database named cacti. So it will be prudent to create a database with that name to make your work easier.

 CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'SafePassWord'; ## Make it strong
 GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';

Grant database user access to the MySQL TimeZone database and select permission

Cacti database login account (cactiuser in this example) must have access to the MySQL TimeZone database. Provide the Cacti database account “select” access to the “time_zone_name” table in the “mysql” database, and populate MySQL’s TimeZone information before proceeding.

sudo mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql

After that, log in to MariaDB.

sudo mysql -u root -p

Grant the permission to your user e.g cactiuser in this example

GRANT SELECT ON mysql.time_zone_name TO [email protected];
ALTER DATABASE cacti CHARACTER SET = 'utf8mb4'  COLLATE = 'utf8mb4_unicode_ci'
flush privileges;

Open MariaDB file and add the lines below under [mysqld] section for an optimized database

sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf

Add the following under [mysqld]

collation-server = utf8mb4_unicode_ci
character-set-server  = utf8mb4
max_heap_table_size = 128M
tmp_table_size = 64M
join_buffer_size = 64M
innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_buffer_pool_size = 1GB
innodb_buffer_pool_instances = 10
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000

Restart MariaDB

sudo systemctl restart mysql

Step 4: Configure PHP-FPM

Let us ensure date.timezone is set in php.ini to a preferred time zone.

sudo vim /etc/php/7.3/fpm/php.ini

Under [Date] uncoment the date.timezone line and add your timezone.

 ; Defines the default timezone used by the date functions
 date.timezone = Africa/Nairobi ## Input your Time zone
 max_execution_time = 70        ## Increase max_execution_time
sudo vim /etc/php/7.3/cli/php.ini

Like above, under [Date] uncoment the date.timezone line and add your timezone.

; Defines the default timezone used by the date functions
date.timezone = Africa/Nairobi ## Input your Time zone
memory_limit = 512M            ## Increase memory_limit

Restart PHP-FPM

sudo systemctl restart php7.3-fpm

Step 5: Configure Nginx Webserver

Since we chose Nginx as our preferred web server, it is time to add configurations so that we can serve our Cacti pages.

Delete the default page that loads up after fresh installation of Nginx

sudo rm /etc/nginx/sites-enabled/default

Create a file as shown and add the following in it

sudo vim /etc/nginx/conf.d/cacticonfig.conf

Paste and modify below data.

server {
 listen      80;
 root        /var/www/html;
 index       index.php;
 access_log  /var/www/html/log/cactiacess.log;
 error_log   /var/www/html/log/cacti.log;
 charset utf-8;
 gzip on;
 gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 location / {
   try_files $uri $uri/ /index.php?$query_string;
  location /api/v0 {
   try_files $uri $uri/ /api_v0.php?$query_string;
  location ~ .php {
   include fastcgi.conf;
   fastcgi_split_path_info ^(.+.php)(/.+)$;
   fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  location ~ /.ht {
   deny all;

Restart Nginx

sudo systemctl restart nginx

Step 6: Install Cacti

We will now need to download the latest version of Cacti package.

curl -O

After it is done downloading, extract the Cacti archive

tar -zxvf cacti-latest.tar.gz

Move the files to our web root directory and change the name of the directory

sudo mv cacti-1* /var/www/html/
sudo mv /var/www/html/cacti-*/ /var/www/html/cacti

Change ownership for the cacti files

sudo chown -R www-data:www-data /var/www/html/

Import the default Cacti database data to the Cacti database.

sudo mysql -u root -p cacti < /var/www/html/cacti/cacti.sql

Open the Cacti configuration file to input database information.

sudo vim /var/www/html/cacti/include/config.php
 $database_type = "mysql";
 $database_default = "cacti";
 $database_hostname = "localhost";
 $database_username = "cactiuser";
 $database_password = "SafePassWord"; 
 $database_port = "3306";
 $database_ssl = false;

Restart Nginx

After you are done with the configuration, restart the webserver.

sudo systemctl restart nginx

Step 7: Edit the crontab file.

In order for Cacti to poll every few minutes, you may need to add the following in your crontab

$ sudo vim /etc/cron.d/cacti

*/5 * * * * www-data php /var/www/html/cacti/poller.php > /dev/null 2>&1

That will cause Cacti to poll every five minutes.

Step 8: Web installer

Now head to the web installer and follow the on-screen instructions.

http:// IP or FQDN /cacti

That should load the installer similar to the one below. Enter default username and password which is admin and admin

Change the default password. Input a long password with mixed characters with one upper and lower case as well as special characters.

Accept License Agreement and click “Begin

cacti accept license 3

I prefer dark mode by all means, so I had to change the default theme. You do not have to do the same if you prefer the default one. Click “Begin” to start the installation.

cacti accept license change to dark 3

It is going to check if the PHP and MySQL configurations we made meet the requirements it needs. Click “Next” if everything gives a green thumbs up.

cacti pre installation check 4

Choose the installation type you want. Primary server it is for this example. Click “Next” thereafter.

cacti installation type 5

Directory permission checks. Click “Next

cacti directory permissions 6

It will suggest the directories where its critical binary files will be placed. Simply click on “Next

cacti binary checks 7

Read the statement carefully and check the radio button after you have understood it. This is important because it touches on the security of your server. Click “Next” thereafter.

cacti whitelist protection statement 8

Choose default profile for poller and network details

cacti default profile 9

Setup the templates you need and click “Next” to proceed forward

cacti template setup 10

The wizard will do configuration checks. After it is done, click “Next

cacti server collation 11

Confirm installation by checking the radio button then click “Install” to begin the installation process.

cacti confirm installation 12

Give it time to complete installing

cacti final installation 13

After it is done, refresh your page and you should be presented with the login page. Input adimin and the new password you created.

cacti login 14

And here we are!


It is now time to add your devices and configure Cacti to start monitoring them. There is much more do after you have your server running. Some of them is provided in How to Import templates on Cacti. We hope the guide was informative and helpful. Thank you for visiting.

More guides for you :

How To Install Cacti on RHEL 8 / CentOS 8

How to Install and Configure Cacti on Ubuntu 18.04

Install and Configure Nagios 4 on RHEL 8 / CentOS 8

How To Install Zabbix Server on CentOS 8 / RHEL 8

Install and configure LibreNMS on Debian 10 with Nginx

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF