Gentoo Wiki



Getting Started

Before installing cacti check for net-snmp package.

Cacti/SNMP host setup

You will probably need the following USE flags set:

USE = mysql xml sockets vhosts

For php to work correctly

You will probably need the following USE flags set:

USE = apache2 snmp vhosts

For cacti.

To install Cacti run the following command:

emerge cacti

This will install cacti onto your system.

If you already installed php, but without xml flag set, you should re-emerge php with USE="xml" first of all! The same applies for the sockets flag.

NOTE: You have to run the command

webapp-config -I -h localhost -d cacti cacti <version  #> 

after you run the emerge.


After installation you will need to edit the config file and insert the proper data to fit your installation

File: <path to cacti>include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipass";
$database_port = "3306";

Install the database

First you need to create a database named 'cacti' with a user named cactiuser

mysql -u root -p
mysql> create database cacti;
mysql> grant all on cacti.* to cactiuser@localhost;
mysql> set password for cactiuser@localhost=password('cactipass');
mysql> exit

If this is a fresh installation of mysql you might get a message like "Can't connect to local MySQL server through Can't connect to local MySQL server through socket /var/run/mysqld/mysqld.sock (2)" . Just run mysql_install_db

While in the cacti folder run this command to insert the default database

mysql -u cactiuser -p cacti < cacti.sql

Finish the configuration by accessing the cacti web page


Configure the required file paths. If you're going to login for the first time, the password-username pair is admin-admin by default.

Set the permissions on the cacti directories to be able to generate the graph/log. Execute this command in the cacti folder.

chown -R apache:apache rra/ log/


as your cacti user add the following to the cron file

*/5 * * * * apache php <cacti path>/cacti/poller.php > /dev/null 2>&1


If no graphs are generated and you receieve the following message in your cron logs, this indicates that an entry can not be found for the apache user in /etc/shadow.

su: Authentication service cannot retrieve authentication info.

This can be fixed by adding it with the following command:



Retrieved from ""

Last modified: Sun, 21 Sep 2008 00:16:00 +0000 Hits: 20,904