Home >> Linux >> How to install Cacti on Ubuntu

How to install Cacti on Ubuntu

Cacti is a web based PHP/MySql graphing solution using the RRDtool engine. Classically, it can graphcacti network bandwidthes with SNMP. But in fact, a lot of different graphs can be done with snmp, shell or perl scripts.

Some of the advantages of RRDtool over MRTG are the following:

  • it is much quicker..
  • it can use negative values.
  • it can use more than one data source in a graph.
  • the generated graphes are very customizable.
  • it can be used by a wide variety of front-ends such as Cacti.
  • the RRDtool records stored in .rrd files keep the same size and do not increase.

The following programs are needed to run cacti:

  • apache2 for the web server
  • mysql-server for the database
  • php5 for the server-based script
  • php5-common
  • php5-cgi
  • php5-cli
  • php5-mysql
  • snmp – snmp tools used to collect data to the remote hosts
  • rrdtool – a perl script to format collected data to rrdtool files
  • php5-gd – the graphical library used by a Cacti plugin named php weathermap


Use apt-get to install the programs

# apt-get install apache2
# apt-get install mysql-server
# apt-get install php5
# apt-get install php5-common
# apt-get install php5-cgi
# apt-get install php5-cli
# apt-get install php5-mysql
# apt-get install snmp
# apt-get install rrdtool


# apt-get install cacti

You will have to configure the mysql settings through a little wizard.
At the end of the tutorial, a mysql database and user named cacti will be automatically created.

MySql root user password

cacti package1

New MySql cacti user password

cacti package2

Confirm MySql cacti user password

cacti package3

Web server used by cacti

cacti package4

Now Cacti is ready to be used via: http://localhost/cacti The default login and password are admin.
Cacti will check if all the required tools are correctly installed.

cacti install1

Select “upgrade” or “new install”

cacti install2

Check if the required tools are correcty seen by cacti

cacti install3

Note that the poller.php script which send the requests to the remote hosts is lauched by the apache2 user, it means www-data.

To reconfigure cacti, use the following command:
#dpkg-reconfigure cacti

If you want to activate the poller manually:
#/usr/share/cacti/site/php5 poller.php

Sometime you need to activate it the first time, then it runs automatically every 5 minutes by default.

For more details about how to use Cacti, a very good Cacti Manual.

Leave a Reply

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