Monday, April 29, 2013

How to Install Cacti on Linux


Install Cacti, and others for dependency. Furthermore, httpd and PHP and MySQL are also needed.
[root@www ~]# yum --enablerepo=dag -y install cacti* net-snmp* rrdtool

[root@www ~]# vi /etc/snmp/snmpd.conf

com2sec notConfigUser default public

com2sec local localhost private

com2sec mynetwork 192.168.0.0/24 public

group notConfigGroup v1 notConfigUser
#
group notConfigGroup v2c notConfigUser
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup v1 local
group MyROGroup v2c local

view systemview included .1.3.6.1.2.1.1
#
view systemview included .1.3.6.1.2.1.25.1.1
view all included .1 80

# line 66: make it comment and add lines next

#
access notConfigGroup "" any noauth exact systemview none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none


[root@www ~]# /etc/rc.d/init.d/snmpd start

Starting snmpd:                [  OK  ]

[root@www ~]# chkconfig snmpd on

[root@www ~]# mysqladmin -u root -p create cacti                  # create DB
Enter password:

[root@www ~]# mysql -p cacti < /var/www/cacti/cacti.sql   # import DB
Enter password:
[root@www ~]# mysql -u root –p      # login to MySQL

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
# set password for cactiuser

mysql> 
grant all on cacti.* to cactiuser@localhost identified by 'password';

Query OK, 0 rows affected (0.00 sec)

mysql> 
exit

Bye

[root@www ~]# vi /var/www/cacti/include/config.php# change cactiuser's password

$database_password = "
password
";

[root@www ~]# 
chown -R apache. /var/www/cacti

[root@www ~]# 
vi /etc/httpd/conf.d/cacti.conf
allow from 127.0.0.1 
192.168.0.0/24


[root@www ~]# /etc/rc.d/init.d/httpd reload

Reloading httpd:     [  OK  ]

Initial settings for Cacti

Access to 'http://(your hostname or IP address)/cacti/'. Following screen is shown, then Click 'Next'.