Installing the Cacti Server Monitor on Ubuntu 12.04 Cloud Server

Cacti is a network graphing solution that uses RRDTool to store and display time-series data. This guide will walk you through installing Cacti on an Ubuntu 12.04 cloud server.

1. Update Your System

Ensure your system is up-to-date:

sudo apt-get update
sudo apt-get upgrade

2. Install Required Packages

Install Apache, MySQL, PHP, and other required packages:

sudo apt-get install apache2 mysql-server php5 php5-mysql php5-gd php5-mcrypt rrdtool librrd8 snmp snmpd

3. Download and Install Cacti

Download the latest version of Cacti from the official website:

wget http://www.cacti.net/downloads/cacti-latest.tar.gz

Extract the downloaded file and move it to the Apache web directory:

tar xzf cacti-latest.tar.gz
sudo mv cacti-* /usr/share/cacti

4. Configure MySQL for Cacti

Log in to the MySQL shell:

sudo mysql -u root -p

Create a database and user for Cacti:

CREATE DATABASE cacti;
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost' IDENTIFIED BY 'cactipassword';
FLUSH PRIVILEGES;
EXIT;

Import the default Cacti database schema:

sudo mysql -u cactiuser -p cacti < /usr/share/cacti/cacti.sql

5. Configure Cacti

Edit the Cacti configuration file:

sudo nano /usr/share/cacti/include/config.php

Set the database connection details:

$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'cactipassword';

Save and close the file (press Ctrl+X, then Y, and Enter).

6. Configure Apache for Cacti

Create a new Apache configuration file for Cacti:

sudo nano /etc/apache2/sites-available/cacti.conf

Add the following configuration:

<VirtualHost *:80>
    DocumentRoot /usr/share/cacti
    <Directory /usr/share/cacti>
        AllowOverride All
        Require all granted
    </Directory>
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^/cacti/(.*)$ /usr/share/cacti/$1 [L]
    </IfModule>
</VirtualHost>

Enable the Cacti site and rewrite module:

sudo a2ensite cacti
sudo a2enmod rewrite

Restart Apache to apply the changes:

sudo service apache2 restart

7. Finalize Cacti Installation

Navigate to http://your_server_ip/cacti in your web browser to complete the Cacti setup through the web interface.

Follow the prompts to configure Cacti. Use admin as the username and admin as the password. Make sure to change the password after the initial login.

8. Configure Cron Job for Cacti

To ensure that Cacti updates its graphs, configure a cron job:

sudo crontab -e

Add the following line to the file:

* * * * * /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Save and close the file.

9. Troubleshooting

If you encounter issues, check the Apache and Cacti logs for errors:

sudo tail -f /var/log/apache2/error.log
sudo tail -f /usr/share/cacti/log/cacti.log

10. Further Configuration

For additional configuration and customization, refer to the Cacti Documentation.

Was this answer helpful? 0 Users Found This Useful (0 Votes)