Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Install Cacti on Ubuntu by preparing a compatible Apache/PHP, MariaDB or MySQL, RRDtool and Net-SNMP stack; deploying Cacti and its Composer dependencies; creating the database and time-zone grant; configuring include/config.php; scheduling the poller; and completing the web initialization wizard at /cacti. The exact PHP and database versions must match the Cacti branch you deploy.

This guide uses the current source-install workflow and explains the distribution-package alternative, polling choices, permissions, and the failures that most often prevent graphs from updating.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Cacti does and what this installation provides

Cacti is an open-source network monitoring and graphing platform built on RRDtool. It polls network devices, servers and applications, stores measurements as time-series data, and renders graphs. Features include automated discovery, SNMP versions 1, 2 and 3, IPv6, role-based access control and plugins.

A working installation has five cooperating layers:

  • A web server that serves the Cacti interface.
  • PHP and its extensions, including the SNMP and database modules.
  • MariaDB or MySQL for configuration, users, devices and poller metadata.
  • RRDtool for storing and graphing time-series values.
  • Net-SNMP and a scheduled poller for collecting values.

Installing only the web files is not enough. The database schema, writable runtime directories and a poller schedule are all required before graphs can populate.

Check versions before installing

Cacti’s dependency floor depends on the branch. The project’s stable 1.2.x repository lists the following minimums, while the develop 1.3.x branch raises several of them:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Component Stable 1.2.x minimum Develop 1.3.x minimum
MariaDB 10.5+ 10.11+
MySQL 8.0+ 8.4+
PHP 8.2+ 8.3+
RRDtool 1.7+ 1.8+
Net-SNMP 5.9+ 5.9+

The Cacti project released version 1.2.30 on March 23, 2025. The Ubuntu/Debian guide also contains a note that PHP 8.1 is required as of Cacti 1.2.31, but PHP 8.1 reached end of life on December 31, 2025. In 2026, do not deliberately install an unsupported PHP release: confirm the requirements of the exact Cacti release and use a currently supported PHP package offered for your Ubuntu version. The repository’s 1.2.x floor is PHP 8.2+.

Ubuntu and Debian are described as well supported by the project. Check the package versions available on your particular Ubuntu release before choosing a branch, especially if you are deploying the develop/1.3.x code.

Choose a distribution package or a source checkout

Ubuntu package

Ubuntu supplies a Cacti package integrated with the distribution’s dependency and service management. Ubuntu Jammy’s package page identifies 1.2.19+ds1-2ubuntu1.1. This route is convenient for standard upgrades and for administrators who want Ubuntu to manage file locations and dependencies, but the packaged version can be older than the current upstream release and does not let you select any upstream branch.

Source installation

A source checkout gives you control over the stable branch and follows the current Composer-based layout. It requires Git and Composer, and you are responsible for applying upstream updates, preserving include/config.php, and checking compatibility each time you change branches.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The procedure below uses source installation because it makes the branch and dependency steps explicit. If your change-control policy requires Ubuntu packages, use the package route instead and follow the same database, poller, permissions and browser-wizard concepts.

1. Install the web, database, PHP, SNMP and RRDtool stack

Update package metadata first, then install the services and PHP modules used by Cacti. The Ubuntu/Debian example uses PHP 8.3 packages; substitute the supported PHP version that matches your Cacti release and Ubuntu repository.

sudo apt update
sudo apt install -y apache2 rrdtool mariadb-server snmp snmpd 
  php8.3 php8.3-cli php8.3-mysql php8.3-snmp php8.3-xml 
  php8.3-mbstring php8.3-gd php8.3-gmp php8.3-zip 
  php8.3-ldap php8.3-intl php8.3-curl php8.3-fpm composer git

Ubuntu’s packaged Cacti metadata separately identifies PHP CLI/modules, php-snmp, RRDtool, SNMP and Apache (or another web server) as dependencies or recommendations. If your repository names the modules without a version suffix, install those names instead of forcing an unavailable php8.3-* package.

Enable and start the services your deployment uses. Apache and MariaDB are required for the usual setup; PHP-FPM is required when Apache is configured to pass PHP requests to FPM.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl enable --now apache2
sudo systemctl enable --now mariadb
sudo systemctl enable --now php8.3-fpm

Replace php8.3-fpm with the installed FPM service name. If you use Apache’s module-based PHP integration rather than FPM, omit that service and use the matching Apache PHP configuration.

2. Download Cacti and install Composer dependencies

Clone the stable upstream branch, place it under Apache’s document root, and install production Composer dependencies. The clone URL and branch below are the project’s documented source layout.

cd /tmp
git clone -b 1.2.x https://github.com/Cacti/cacti.git
sudo mv cacti /var/www/html/cacti
cd /var/www/html/cacti
sudo composer install --no-dev

Run Composer as the account that owns the checkout where possible; if you run it with sudo, verify that the resulting files are readable by the web server. Keep the checkout on the branch you selected and do not mix files from a distribution package with this source tree.

3. Create the Cacti database and required grants

Create a dedicated database and account rather than using MariaDB’s administrative account. The database must use utf8mb4. Cacti also needs a read grant on MariaDB/MySQL’s time-zone names table.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo mariadb
CREATE DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'YOUR_STRONG_UNIQUE_PASSWORD';
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';
GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace YOUR_STRONG_UNIQUE_PASSWORD with a long, unique secret and record it in your password-management system. If the database runs on another host, use the appropriate host value in both the account and Cacti configuration, and restrict network access with your firewall; do not broaden the account to every host unless that is intentional.

The explicit SELECT grant is easy to miss. Without it, time-zone-dependent operations can fail even when the main database credentials are correct.

4. Load the schema and configure include/config.php

Import the schema

From the Cacti directory, import the supplied SQL schema into the new database:

cd /var/www/html/cacti
sudo mariadb cacti < cacti.sql

If you use a remote database or a different client, supply the same database name, host, user and password that you will place in the configuration file.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create the configuration file

Copy the distribution template and edit it:

sudo cp include/config.php.dist include/config.php
sudo editor include/config.php

Set the database type, database name, host, username, password, port, retry count and SSL setting to match your database. A typical local MariaDB configuration has values equivalent to these (keep the syntax used by the template):

$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'YOUR_STRONG_UNIQUE_PASSWORD';
$database_port     = '3306';
$database_retries  = 5;
$database_ssl      = false;

Use the actual variable names and comments in the version of config.php.dist you cloned. Do not commit the file containing the database password to a public repository, and use the SSL option required by your database policy when the server is remote.

5. Set ownership for runtime directories

The web process and poller must be able to write Cacti’s runtime data. Make the web account the owner of the four directories called out by the Ubuntu/Debian procedure:

sudo chown -R www-data:www-data 
  /var/www/html/cacti/rra 
  /var/www/html/cacti/log 
  /var/www/html/cacti/cache 
  /var/www/html/cacti/resource

Do not make the entire application tree world-writable. If you update the source checkout as another user later, recheck that these directories still belong to www-data and that the web server can read the rest of the tree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

6. Restart PHP-FPM before opening the wizard

Restart the installed PHP-FPM daemon before the first browser setup. The guide recommends this to rebuild its cache and avoid an HTTP 500 caused by stale PHP-FPM state after modules or configuration have changed.

sudo systemctl restart php8.3-fpm

Use your installed PHP-FPM service name. If the browser still returns 500, inspect the Apache and PHP-FPM logs before changing Cacti files; a missing PHP extension, incompatible PHP version or FPM socket mismatch is more likely than an application-level graphing problem at this stage.

7. Schedule the Cacti poller

The interface can load before any data is collected. Polling must be scheduled separately. Cacti 1.2.16 and later support the PHP poller through cron and also offer an optional cactid systemd service. The project identifies the built-in PHP poller and Spine as its two polling engines.

PHP poller with cron

The documented cron entry runs every five minutes as the web account:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo crontab -u www-data -e
*/5 * * * * www-data php /var/www/html/cacti/poller.php >/dev/null 2>&1

Install the line in the system crontab format that your distribution uses. If you edit www-data‘s personal crontab with crontab -u www-data -e, omit the username field because that format already supplies it; if you edit /etc/crontab or a file under /etc/cron.d, keep the www-data field as shown. This distinction prevents a silently malformed cron entry.

Optional systemd service and Spine

The optional cactid systemd service provides service supervision and lifecycle control instead of relying on cron. Spine is the project’s higher-performance polling engine; it is the alternative to the built-in PHP poller when your deployment needs that engine. Choose one polling path deliberately rather than running overlapping schedules that collect the same devices twice.

Choice Operational characteristics Use when
PHP poller via cron Few moving parts and simple scheduling You want the easiest standard deployment
cactid systemd service Service supervision and explicit start/stop lifecycle You manage polling as a continuously supervised service
Spine Project-provided higher-performance polling engine Your scale or polling workload warrants it and you have validated the engine for your release

After selecting an engine, confirm in Cacti’s settings that the configured poller matches the process you actually schedule. A cron job invoking poller.php will not exercise Spine.

8. Open the initialization wizard

With the web server, database, schema, permissions and poller in place, browse to:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
http://serverip/cacti

Replace serverip with the server’s address or DNS name. The initialization wizard checks prerequisites and completes the initial setup. Accept only paths and binaries that match your installation, including the RRDtool and PHP locations detected on your host.

Create the initial administrative account with a unique password, then sign in and add devices, SNMP credentials, data sources and graph templates. For production, prefer SNMPv3 where devices support it; Cacti supports SNMP v1, v2 and v3, but the security properties differ by version.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

9. Verify collection before troubleshooting graphs

Use this order of checks after the wizard:

  1. Confirm that the poller schedule exists under the intended user and runs at the expected five-minute interval.
  2. Check that rra, log, cache and resource are writable by www-data.
  3. Review Cacti’s poller and application logs for database, SNMP, RRDtool or permission errors.
  4. Verify that the configured SNMP version, credentials and target address match the device.
  5. Allow at least one successful polling cycle before judging whether a graph is empty.

If the poller runs but no data source updates, test the network path and SNMP response from the Ubuntu host. If the poller does not run at all, focus first on cron/systemd status, the PHP executable path and the PHP-FPM or CLI version selected for Cacti.

Common installation failures and precise fixes

Package installation selects an incompatible PHP version

Symptoms include unavailable package names, Composer dependency errors or a blank/500 response. Compare the installed PHP version with the exact Cacti release requirements. The stable 1.2.x repository floor is PHP 8.2+, while the develop 1.3.x branch requires PHP 8.3+; do not solve the problem by deploying end-of-life PHP 8.1 simply because an older guide mentions it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Composer reports missing extensions or dependencies

Run Composer from /var/www/html/cacti and confirm that the CLI PHP binary has the MySQL, SNMP, XML, mbstring, GD, GMP, ZIP, LDAP, Intl and cURL modules installed. Installing an extension for FPM alone does not guarantee that the CLI binary used by Composer has it.

Database login succeeds but setup reports time-zone errors

Check the account’s grants and ensure it has SELECT on mysql.time_zone_name, in addition to all privileges on cacti.*. Re-run FLUSH PRIVILEGES after correcting grants and make sure the username and host in config.php are the same account you altered.

HTTP 500 immediately after installation

Restart PHP-FPM after installing modules or changing PHP configuration. Then inspect Apache and PHP-FPM logs for the first error. Typical causes are an unsupported PHP release, a missing extension, an incorrect FPM socket, unreadable application files or a malformed configuration file.

Poller runs but files cannot be written

Recheck ownership of rra, log, cache and resource. The account executing the poller must be able to write them; running the web interface as one user and cron as another commonly creates intermittent permission failures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

AppArmor blocks Apache

Stock Ubuntu and Debian enable AppArmor but do not ship an Apache confinement profile by default, so no Cacti-specific AppArmor change is needed on an unmodified installation. If you installed an Apache profile yourself, change only a local override after logs show an actual denial. Do not weaken AppArmor preemptively.

Operating and updating the installation safely

  • Track the Cacti branch and the PHP, database, RRDtool and Net-SNMP floors together; upgrading one component can invalidate the combination.
  • Back up the MariaDB/MySQL cacti database and the Cacti configuration before changing versions.
  • Preserve include/config.php when replacing the source tree, then re-run composer install --no-dev for the new checkout.
  • After updates, verify directory ownership, restart PHP-FPM when PHP modules or settings changed, and run a poller cycle before declaring the upgrade complete.
  • Keep the database account dedicated to Cacti and limit remote database access to the hosts that require it.

Installation checklist

  • Compatible PHP, MariaDB/MySQL, RRDtool and Net-SNMP versions selected for the Cacti branch.
  • Apache (or another supported web server), PHP extensions and Composer installed.
  • Cacti source checked out to /var/www/html/cacti and Composer dependencies installed.
  • cacti database created with utf8mb4.
  • Dedicated database user granted all privileges on cacti.* and SELECT on mysql.time_zone_name.
  • cacti.sql imported and include/config.php populated.
  • rra, log, cache and resource owned by www-data.
  • PHP-FPM restarted when applicable.
  • Exactly one intended poller scheduled and aligned with the selected engine.
  • Initialization completed at http://serverip/cacti.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.