วันศุกร์ที่ 8 เมษายน พ.ศ. 2559

Install Cacti On CentOS 6.5

Install Wget
yum install wget -y

Install required packages
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

Install Apache
yum install httpd httpd-devel -y

Install MySQL
yum install mysql mysql-server -y

Install PHP
yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql -y 

Install PHP-SNMP
yum install php-snmp -y

Install NET-SNMP
yum install net-snmp-utils net-snmp-libs php-pear-Net-SMTP -y

Install RRDtool
yum install rrdtool -y


/etc/init.d/httpd start
/etc/init.d/mysqld start
/etc/init.d/snmpd start


chkconfig httpd on
chkconfig mysqld on
chkconfig snmpd on


Installing Cacti Tool
yum install cacti -y


Configure MySQL
mysql -u root -p
mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'centos';
mysql> flush privileges;
mysql> exit




rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-0.8.8b/cacti.sql


mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql



vi /etc/cacti/db.php
$database_type = "mysql";
$database_default = "cacti"; ## Name of the Cacti Database ## 
$database_hostname = "localhost";
$database_username = "cacti"; ## Username for Cacti database ##
$database_password = "centos"; ## Database password ##$database_port = "3306";
$database_ssl = false;
:wq


Configure Apache server
vi /etc/httpd/conf.d/cacti.conf


<Directory /usr/share/cacti/>         
<IfModule mod_authz_core.c>                 
# httpd 2.4                 
Require host localhost     
    </IfModule>      
   <IfModule !mod_authz_core.c>         
        # httpd 2.2     
            Order deny,allow   
              Deny from all    
             Allow from 192.168.1.0/24   
      </IfModule> </Directory>

/etc/init.d/httpd restart

vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall 
# Manual customization of this file is not recommended. 
*filter 
:INPUT ACCEPT [0:0] 
:FORWARD ACCEPT [0:0] 
:OUTPUT ACCEPT [0:0] 
-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT 
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT 
-A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT 
-A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT 
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT

/etc/init.d/iptables restart

vi /etc/cron.d/cacti

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


Run Cacti installer
http://ip-address/cacti

Ex. http://localhost/cacti

ไม่มีความคิดเห็น:

แสดงความคิดเห็น