October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Install Cacti Server Monitoring on Ubuntu (Complete Cacti 1.2.x Guide)

A complete Ubuntu guide to installing Cacti: verify branch requirements, install the PHP/MariaDB/SNMP stack, load the schema, configure permissions, schedule polling and finish the /cacti wizard.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Cacti on Ubuntu by assembling a compatible web, PHP, MariaDB/MySQL, RRDtool and Net-SNMP stack, then installing Cacti, loading its database schema, scheduling the poller and completing the browser wizard at /cacti. The exact package versions matter: Cacti 1.2.x and the 1.3.x development branch have different dependency floors.

This guide uses the current source-install workflow and shows where Ubuntu’s packaged build may be preferable. It also covers the database grants, filesystem permissions and poller checks that determine whether Cacti actually collects data after the login page appears.

As an Amazon Associate I earn from qualifying purchases.

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

What Cacti does and what the Ubuntu installation includes

Cacti is an open-source network monitoring and graphing platform built on RRDtool. It polls network devices, servers and applications, stores time-series data in RRD files and presents the results as graphs. Its feature set includes automated discovery, SNMP versions 1, 2 and 3, IPv6 support, role-based access control and plugins.

A working installation is a stack rather than a single package:

  • Web server: Apache2 in the documented Ubuntu example (another compatible web server can be used).
  • PHP: the web runtime, command-line interpreter and Cacti extensions.
  • Database: MariaDB or MySQL for configuration, device data and poller metadata.
  • RRDtool: the round-robin database engine that stores graph data.
  • Net-SNMP and SNMPD: SNMP utilities and, when needed, the local SNMP daemon.
  • Composer: required by the current source-tree installation workflow.
  • Poller: Cacti’s built-in PHP poller, or the optional cactid/Spine path where a separately supervised or higher-performance engine is required.

The final browser step does not replace these services. The wizard only initializes Cacti after the operating-system packages, database, permissions and polling schedule are ready.

Check Cacti and Ubuntu version compatibility first

Do not install packages until you know which Cacti branch you are deploying. The project’s stated minimums differ between the stable 1.2.x branch and the develop/1.3.x branch.

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 or newer 10.11 or newer
MySQL 8.0 or newer 8.4 or newer
PHP 8.2 or newer in the repository’s stated floor 8.3 or newer
RRDtool 1.7 or newer 1.8 or newer
Net-SNMP 5.9 or newer 5.9 or newer

The Ubuntu/Debian installation guide uses PHP 8.3 packages in its example and says that Cacti 1.2.31 requires PHP 8.1 plus Composer. PHP 8.1 reached end of life on 31 December 2025. Treat that example as a guide to the required extensions, not as a reason to deploy an unsupported interpreter: use a currently supported PHP package available for your Ubuntu release, and confirm that it satisfies the exact Cacti release you selected. If the repository floor and the guide’s example appear inconsistent, the release’s own requirements and your distribution’s package set take precedence over copying a version number blindly.

Choose Ubuntu packages or a source checkout

Ubuntu provides a distribution package, while the project documents installing the stable source branch. Decide before you create paths and service configuration.

Approach Advantages Trade-offs
Ubuntu package Uses Debian/Ubuntu dependency management and the distribution’s service and filesystem integration. The version follows Ubuntu’s packaging cycle. Ubuntu Jammy lists 1.2.19+ds1-2ubuntu1.1, which is older than later upstream releases.
Source checkout Lets you select the stable 1.2.x branch and follows the upstream layout; Composer dependencies are installed explicitly. You own the application directory, upgrades, permissions and web-server integration.

The steps below use the source layout /var/www/html/cacti. If you choose the Ubuntu package instead, keep its packaged paths and service definitions; do not mix files from both methods in one installation.

Step 1: Install the web, database, PHP, SNMP and RRDtool prerequisites

Update the package index and install the components used by the documented Ubuntu/Debian workflow. The example below uses PHP 8.3 package names; substitute the currently supported PHP version for your Ubuntu release while retaining the equivalent extensions.

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.
sudo apt update
sudo apt install -y apache2 mariadb-server rrdtool snmp snmpd git composer 
  php8.3 php8.3-cli php8.3-fpm 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

Ubuntu’s Cacti metadata separately identifies PHP CLI/modules, php-snmp, RRDtool, SNMP and Apache (or another web server) as dependencies or recommendations. The exact package suffixes vary by Ubuntu release, so verify availability with apt-cache policy before running the full command.

Verify the installed versions

Check each major dependency before downloading Cacti. A version below the selected branch’s floor is a deployment blocker, not a warning to ignore.

php -v
composer --version
rrdtool --version
snmpget --version
mariadb --version
apache2 -v

Enable and start the services you installed, then confirm they are active:

sudo systemctl enable --now apache2 mariadb php8.3-fpm snmpd
sudo systemctl --no-pager --full status apache2 mariadb php8.3-fpm snmpd

If your supported PHP package is not 8.3, replace php8.3-fpm in the service command with the matching daemon name.

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

Step 2: Download Cacti and install Composer dependencies

Clone the stable upstream branch into the web root, then install production Composer dependencies. The branch selector is deliberate: it keeps this procedure on the 1.2.x line rather than the develop branch with its higher requirements.

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

Composer must complete without dependency errors. If it refuses to resolve packages, stop and reconcile the PHP version, enabled extensions and Composer version with the Cacti release; do not bypass dependency checks by deleting the lock file.

Step 3: Create the MariaDB or MySQL database and grants

Cacti needs a dedicated database and login. It also needs permission to read the server’s time-zone names, which is easy to omit and can cause confusing date and graph behavior later.

Open a privileged MariaDB session:

sudo mariadb

Run SQL equivalent to the following. Replace the password value with a unique, randomly generated production secret before execution.

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.
CREATE DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY '<your-strong-password>';
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';
GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

The account is intentionally limited to the local host in this example. If the database is on another server, use the exact host restriction required by that topology and protect the connection with the appropriate network and TLS controls.

Import the Cacti schema

Load the SQL file shipped in the checkout. This creates Cacti’s tables before the web wizard writes installation-specific settings.

mariadb -u cactiuser -p cacti < /var/www/html/cacti/cacti.sql

Enter the same database password when prompted. A successful import returns to the shell without SQL errors. If authentication fails, test the account explicitly with mariadb -u cactiuser -p -e "SELECT 1" cacti and correct the user, host or password before continuing.

Step 4: Configure include/config.php

Copy the distribution configuration and edit the database connection values to match the account you just created.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd /var/www/html/cacti
sudo cp include/config.php.dist include/config.php
sudo editor include/config.php

Set these fields in include/config.php:

  • Database type: the MariaDB/MySQL driver expected by your Cacti release.
  • Database name: cacti.
  • Database host: localhost for the local database shown above.
  • Database user: cactiuser.
  • Database password: the unique secret used in the SQL command.
  • Database port: the port used by your MariaDB/MySQL service.
  • Retry count: a value appropriate to your database reliability and network path.
  • SSL setting: enable it when your database deployment requires encrypted connections and has the certificates configured.

Keep the file readable by the web process but not publicly downloadable. A web server must never serve the raw PHP source; test the virtual host and PHP handler before exposing the instance beyond a trusted network.

Step 5: Set ownership and writable directories

Cacti writes RRD files, logs, cached data and resource files while it polls. Make the web/poller account the owner of the directories that need writes:

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

Do not make the entire application tree world-writable. If the poller runs as a different service account in your design, grant that account the same required access instead of widening permissions indiscriminately.

Step 6: Restart PHP-FPM and handle AppArmor only when needed

Restart PHP-FPM before opening the wizard

Restart the PHP-FPM daemon after installing extensions and before setup. This rebuilds its process cache and avoids an otherwise opaque HTTP 500 caused by stale workers.

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

Use the daemon name matching your supported PHP version. If the page still returns 500, inspect the Apache error log and the PHP-FPM journal, then correct the reported extension, socket or permission issue before changing Cacti files.

Do not add an Apache AppArmor profile on a stock system

Ubuntu and Debian enable AppArmor, but a stock installation does not ship an Apache confinement profile. Apache therefore runs unconfined and requires no Cacti-specific AppArmor changes in that case. Add a local profile override only if an Apache profile has actually been installed and the AppArmor log shows denials involving Cacti, PHP-FPM, RRD files or logs. Editing profiles without a recorded denial can create a new failure rather than fix one.

Step 7: Schedule Cacti polling

Installation is incomplete until the poller runs repeatedly. Cacti supports the built-in PHP poller and, from 1.2.16 onward, either a cron entry or the optional cactid systemd service. The project also identifies Spine as a separate polling engine for deployments that need its performance characteristics.

Option A: PHP poller through cron

Cron is the simplest operational choice and is easy to audit. Install the documented five-minute schedule for the www-data account:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo crontab -u www-data -e

Add this line exactly:

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

Use one scheduler, not multiple overlapping cron entries. After the first interval, check Cacti’s log and the modification times of files under /var/www/html/cacti/rra to confirm that a poll completed.

Option B: The optional cactid systemd service

Choose the service-based approach when you want systemd supervision, explicit start/stop/restart operations and lifecycle visibility. Install and configure the optional cactid service according to the Cacti release’s files, then enable it with systemd. Do not run the cron PHP poller at the same time unless you have intentionally designed separate poller workloads; duplicate schedules can create overlapping runs and misleading data.

When Spine is appropriate

The repository lists the built-in PHP poller and Spine as Cacti’s two polling engines. Spine is the higher-performance path for larger polling workloads, but selecting it does not remove the need for the PHP/web stack, database grants, writable directories or a correctly scheduled service. Start with the PHP poller to validate the installation, then evaluate Spine against your device count and polling interval.

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

Step 8: Complete the browser initialization wizard

With the services running, schema imported, configuration saved and directories writable, open:

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

The Cacti initialization wizard checks prerequisites and asks for installation-specific values. Follow each warning rather than clicking through it:

  1. Confirm that the displayed PHP version and required extensions match the Cacti release you selected.
  2. Verify the paths to RRDtool, PHP and the poller components.
  3. Enter the database host, port, database name, user and password from include/config.php.
  4. Accept the detected writable paths only when the ownership checks pass for rra, log, cache and resource.
  5. Finish initialization and sign in, then inspect the poller status and log output before adding production devices.

The system is ready when the wizard completes at the /cacti path, the dashboard loads without PHP or database errors and a scheduled poll produces current timestamps and RRD files.

Diagnose the failures that most often stop polling

HTTP 500 immediately after installation

  • Restart the correct PHP-FPM daemon after enabling extensions.
  • Check Apache’s error log and the PHP-FPM journal for a missing module, bad socket path or syntax error in include/config.php.
  • Confirm that the web server is executing PHP rather than returning source code or a download.

The wizard reports a database connection error

  • Test the credentials from the shell with the mariadb client.
  • Ensure the database name is exactly cacti and the host matches the account’s host restriction.
  • Check that the schema import completed and that MariaDB is listening on the configured port.
  • Recheck the password in both SQL and include/config.php; a successful login with one account does not prove that the Cacti account is correct.

Time-zone or date checks fail

Verify that cactiuser has SELECT on mysql.time_zone_name. The database schema alone is not sufficient for this requirement.

No graphs or stale data appear

  • Confirm that exactly one poller is scheduled and that its command points to the actual installation path.
  • Check that www-data (or the chosen poller account) can write to rra, log, cache and resource.
  • Run the poller command manually as the service account to expose PHP errors hidden by cron redirection.
  • Inspect Cacti’s log for SNMP timeouts, authentication failures or unreachable targets.
  • Use AppArmor diagnostics only when a real Apache profile denial is present.

Composer installation fails

Check the PHP version and every required extension first. The source workflow requires Composer dependencies; deleting dependency metadata or using --ignore-platform-reqs can produce a page that installs but fails during polling.

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

Production checklist

  • Select the exact stable or development branch and meet its dependency floors.
  • Use a currently supported PHP package; PHP 8.1 reached end of life on 31 December 2025.
  • Keep the Cacti database account dedicated, local where practical and protected by a strong unique password.
  • Retain the mysql.time_zone_name read grant.
  • Keep only the RRD, log, cache and resource paths writable by the poller/web account.
  • Run one intentional polling schedule and monitor its logs.
  • Restrict access to the Cacti URL and database management interfaces according to your network policy.
  • Record whether you installed from Ubuntu’s package or from the upstream source tree so future upgrades use the same ownership and path conventions.

Which installation path should you use?

Use Ubuntu’s package when distribution integration and predictable operating-system maintenance matter more than selecting a newer upstream branch. Use the source checkout when you need the documented stable 1.2.x tree, are prepared to run Composer and will manage the application directory yourself. Whichever route you choose, the operational requirements are identical: compatible PHP and extensions, a populated database with the time-zone grant, writable data directories and a single healthy poller.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.