This is done with Ubuntu 12.04 Precise, but, it may be done with othe distros too.
First install the required packages:
1 |
sudo apt-get install snmp snmpd apache2 mysql-server mysql-client rrdtool |
Go to /var/www/ download cacti, unpack it and rename it:
1 |
cd /var/www/ && sudo wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz && sudo tar zxvf cacti-0.8.8a.tar.gz && sudo mv cacti-0.8.8a cacti |
Create a database for cacti, a user for the database and insert the cacti tables in it:
1 |
mysqladmin -u root -p create cactidb |
1 |
mysql -u root -p -e "GRANT ALL ON cactidb.* TO 'cacti-admin'@'localhost' IDENTIFIED BY 'yourpassword';" |
1 |
mysql -u root -p cactidb < /var/www/cacti/cacti.sql |
Edit /var/www/cacti/include/config.php .
Change the fields of the file accordingly:
$database_default = “cacti”; <–(Change it!)
$database_username = “cactiuser”; <–(Change it!)
$database_password = “cactiuser”; <–(Change it!)
A unix user is required for cacti:
1 |
sudo useradd cacti -d /var/www/cacti -s /bin/false |
Add the cronjob for the poller and enable it:
1 |
sudo echo "*/5 * * * * php5 /var/www/cacti/poller.php > /dev/null 2>&1" > /var/www/cacti/cacti-cron && sudo crontab -u cacti /var/www/cacti/cacti-cron |
Give the right permissions to the cacti folder:
1 |
sudo chown -R cacti /var/www/cacti |
1 |
sudo chmod 777 -R /var/www/cacti/log/ /var/www/cacti/rra/ |
Restart apache:
1 |
sudo /etc/init.d/apache2 restart |
That’s all there is to it! Go ahead and visit cacti with your browser http://server-ip/cacti and the second part of the installation will start.