Installation – Cacti

Cacti requires that the following software is installed on your system:

  • RRDTool 1.0.49 or 1.2.x or greater
  • MySQL 4.1.x or 5.x or greater
  • PHP 4.3.6 or greater, 5.x greater highly recommended for advanced features
  • A Web Server e.g. Apache, IIS, or Nginx

Please make sure, the following packages are installed according to your operating systems requirements. Verify, that web server and mysql are started at system startup.

Required Packages for RPM-based Operating Systems

• php
• php-mysql
• php-snmp
mysql
mysql-server
• net-snmp
nginx

Install the required packages:

[root@cacti ~]# yum install php php-mysql php-snmp php-ldap php-xml net-snmp php-mbstring php-gd php-dom

check php modlues and make sure that LDAP and GD was installed:

[root@cacti ~]# php -m
[PHP Modules]
bz2
calendar
Core
gd
ldap
pdo
xml

edit file php.ini

[root@cacti ~]# vim /etc/php.ini
memory_limit = 128M
date.timezone = Asia/Jakarta
extension_dir = "/usr/lib64/php/modules/"
file_uploads = On

Don’t forget to install php-fpm when we use nginx!!!

download cacti from here and extact, or we can wget it.

[root@cacti ~]# cd /tmp
[root@cacti tmp]# wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
[root@cacti tmp]# tar xzvf cacti-0.8.8b.tar.gz

move or copy cacti’s diractory to /usr/share/nginx/html/. At this time I used rsync, you can use cp or anything else.

[root@cacti tmp]# rsync -avz /tmp/cacti-0.8.8b /usr/share/nginx/html/

rename cacti-0.8.8b into cacti

[root@cacti tmp]# cd /usr/share/nginx/html/
[root@cacti html]# mv cacti-0.8.8b cacti

create the MySQL database:

[root@cacti html]# mysqladmin --user=root create cacti

import the default cacti’s database:

[root@cacti html]# mysql cacti < cacti/cacti.sql

Optional: Create a MySQL username and password for Cacti.

[root@cacti html]# mysql --user=root mysql -p 
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;

edit file config.php, specify the database type, name, host, user and password for your Cacti configuration.

[root@cacti html]# vim include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "somepassword";

set the appropriate permissions on cacti’s directories for graph/log generation

[root@cacti html]# /usr/sbin/useradd cactiuser
[root@cacti html]# /usr/sbin/groupadd cactiuser
[root@cacti html]# cd cacti
[root@cacti cacti]# chown -R cactiuser:cactiuser rra/ log/

add a line to your /etc/crontab file similar to:

[root@cacti cacti]# vim /etc/crontab
*/1 * * * * cactiuser php /usr/share/nginx/html/cacti/poller.php > /dev/null 2>&1

I want my poller refresh every one minute.

Now open the browser and install it
localhost

Tips:
By default the poller type using cmd.php. But sometimes people using spine.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>