vivion34 发表于 2015-11-22 13:02:11

Cacti安装配置的详细步骤

目录(?)[+]
[*]需要的软件
[*]安装步骤
[*]安装mysql数据库
[*]安装apache服务
[*]安装PHP
[*]安装rrdtool
[*]安装net-snmp
[*]配置MYSQL数据库
[*]安装 配置cacti

需要的软件:
MySQL、php、apache、rrdtool、snmp、cacti

  
安装步骤:
  
1安装mysql数据库 view plaincopyprint?

[*]# groupadd mysql
[*]# useradd -g mysql mysql
[*]# cd /usr/local
[*]# tar zxvf mysql-5.1.41.tar.gz
[*]# mv mysql-5.1.41 mysql
[*]# cd mysql
[*]# ./configure –prefix=/usr/local/mysql
[*]# make && make install
[*]# /usr/local/mysql/bin/mysql_install_db –user=mysql
[*]# chown -R root .
[*]# chown -R mysql data
[*]# chgrp -R mysql .
[*]# ./bin/mysqld_safe –user=mysql &
[*]# /usr/local/mysql/bin/mysqld_safe –user=mysql &
# groupadd mysql# useradd -g mysql mysql# cd /usr/local# tar zxvf mysql-5.1.41.tar.gz# mv mysql-5.1.41 mysql# cd mysql# ./configure –prefix=/usr/local/mysql# make && make install# /usr/local/mysql/bin/mysql_install_db –user=mysql# chown -R root .# chown -R mysql data# chgrp -R mysql.# ./bin/mysqld_safe –user=mysql &# /usr/local/mysql/bin/mysqld_safe –user=mysql &



  
2安装apache服务 view plaincopyprint?

[*]# tar -zxvfhttpd-2.2.14.tar.gz
[*]# cd httpd-2.2.14
[*]# ./configure –prefix=/www –enable-so
[*]# make && make install
[*]# cp /www/bin/apachectl /etc/init.d/httpd
[*]# cd /etc/rc3.d
[*]# ln -s /etc/init.d/httpd S85httpd
[*]# ln -s /etc/init.d/httpd K85httpd
[*]# /www/bin/apachectl start
# tar -zxvf httpd-2.2.14.tar.gz# cd httpd-2.2.14# ./configure –prefix=/www –enable-so# make && make install# cp /www/bin/apachectl/etc/init.d/httpd# cd /etc/rc3.d# ln -s /etc/init.d/httpd S85httpd# ln -s /etc/init.d/httpd K85httpd# /www/bin/apachectl start
Apache 安装完毕

  
3安装PHP view plaincopyprint?

[*]# tar -zxvf php-5.2.12.tar.gz
[*]# cd php-5.2.12
[*]# ./configure –prefix=/www/php \
[*]> –with-apxs2=/www/bin/apxs \
[*]> –with-config-file-path=/www/php \
[*]> –enable-sockets \
[*]> –with-mysql=/usr/local/mysql \
[*]> –with-zlib-dir=/usr/include \
[*]> –with-gd
[*]# make && make install
[*]# cp php.ini-dist /www/php/php.ini
[*]# vi /www/conf/httpd.conf
[*]按 I 键 添加 AddType application/x-tar .tgz
[*]AddType application/x-httpd-php .php
[*]AddType image/x-icon .ico
[*]DirectoryIndex index.php index.htmlindex.html.var
[*]保存退出 :wq
[*]# /www/bin/apachectl restart
# tar -zxvf php-5.2.12.tar.gz# cd php-5.2.12# ./configure –prefix=/www/php \> –with-apxs2=/www/bin/apxs \> –with-config-file-path=/www/php \> –enable-sockets \> –with-mysql=/usr/local/mysql\> –with-zlib-dir=/usr/include \> –with-gd# make && make install# cp php.ini-dist /www/php/php.ini# vi /www/conf/httpd.conf按 I 键 添加 AddType application/x-tar .tgzAddType application/x-httpd-php.phpAddType image/x-icon .icoDirectoryIndex index.php index.html index.html.var保存退出 :wq# /www/bin/apachectl restart
Php安装完毕

  
4安装rrdtool view plaincopyprint?

[*]# tar zxvf rrdtool-1.3.8.tar.gz
[*]# cd rrdtool-1.3.8
[*]# ./configure
[*]# make && make install
# tar zxvf rrdtool-1.3.8.tar.gz# cd rrdtool-1.3.8# ./configure# make && make install
Rrdtool安装完毕

  
5安装net-snmp需要
view plaincopyprint?

[*]net-snmp-5.0.9-2.30E.15
[*]net-snmp-devel-5.0.9-2.30E.15
[*]net-snmp-libs-5.0.9-2.30E.15
[*]net-snmp-utils-5.0.9-2.30E.15 四个安装包,可以在系统盘中找到相应的RPM包进行安装,也可以用yum install net-snmp*进行安装。
[*]安装完成后修改配置文件:
[*]# vi /etc/snmp/snmpd.conf
[*]更改 1、com2sec notConfigUserdefault      public
[*]改为:com2sec notConfigUser   127.0.0.1       public
[*]2、accessnotConfigGroup “”      any       noauth    exactsystemviewnone none
[*]改为:accessnotConfigGroup “”      any       noauth    exact allnonenone
[*]3、#view all    included.1         80
[*]将前面的 # 注释 去掉。
[*]保存退出 :wq
[*]# service snmpd restart
net-snmp-5.0.9-2.30E.15net-snmp-devel-5.0.9-2.30E.15net-snmp-libs-5.0.9-2.30E.15net-snmp-utils-5.0.9-2.30E.15 四个安装包,可以在系统盘中找到相应的RPM包进行安装,也可以用yum install net-snmp*进行安装。安装完成后修改配置文件:# vi /etc/snmp/snmpd.conf更改1、com2sec notConfigUser default public改为:com2sec notConfigUser 127.0.0.1 public2、access notConfigGroup “” any noauth exact systemview none none改为:access notConfigGroup “” any noauth exact all none none3、#view all included .1 80将前面的 # 注释 去掉。保存退出 :wq# service snmpd restart



  
6配置MYSQL数据库 view plaincopyprint?

[*]mysql> createdatabase cactidb;
[*]mysql> grant SUPER,REPLICATION CLIENT,processon *.* to cactiuser@localhost identifiedby ‘cactipw’;
mysql> create database cactidb;mysql> grant SUPER,REPLICATION CLIENT,process on *.* to cactiuser@localhost identified by ‘cactipw’;



  
7安装/ 配置cacti view plaincopyprint?

[*]# useradd cactiuser -g users
[*]# passwd cactiuser (pwd:cactipw)
[*]# cp cacti-0.8.7b.tar.gz /www/htdocs/
[*]# cd /www/htdocs/
[*]# tar zxvf cacti-0.8.7b.tar.gz
[*]# mv cacti-0.8.7b cacti
[*]# cd cacti
[*]# /usr/local/mysql/bin/mysql -u root -pmysql cactidb < cacti.sql
[*]# chown -R cactiuser rra/ log/
[*]# cd scripts
[*]# chown cactiuser:users *
[*]# vi /www/htdocs/cacti/include/config.php
[*]$database_type = “mysql”;
[*]$database_default = “cactidb”;
[*]$database_hostname = “localhost”;
[*]$database_username = “cactiuser”;
[*]$database_password = “cactipw”;
[*]更改用户、密码 等项 与上面给出的对应 保存退出
[*]# crontab -u cactiuser -e
[*]加入
[*]*/5 * * * * /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1
[*]保存退出:wq
[*]
[*]全部设置完毕。
[*]打开浏览器 http://localhost/cacti 进入cacti的初始设置页面
[*]
[*]第一次默认登陆账号:admin 密码 admin J
[*]
[*]登陆后在新改个密码就OK
[*]
[*]需要说明的还有路径
[*]
[*]snmpwalk Binary Path : /usr/bin/snmpwalk
[*]snmpget Binary Path: /usr/bin/snmpget
[*]RRDTool Binary Path: /usr/rrdtool-1.3.8/src/rrdtool
[*]PHP Binary Path: /www/php/bin/php
[*]Cacti Log File Path: /www/htdocs/cacti/log/cacti.log
[*]Cactid Poller File Path: /www/htdocs/cacti/poller.php
# useradd cactiuser -g users# passwd cactiuser (pwd:cactipw)# cp cacti-0.8.7b.tar.gz /www/htdocs/# cd /www/htdocs/# tar zxvf cacti-0.8.7b.tar.gz# mv cacti-0.8.7b cacti# cd cacti# /usr/local/mysql/bin/mysql -u root -pmysql cactidb < cacti.sql# chown -R cactiuser rra/ log/# cd scripts# chown cactiuser:users*# vi /www/htdocs/cacti/include/config.php$database_type = “mysql”;$database_default = “cactidb”;$database_hostname = “localhost”;$database_username = “cactiuser”;$database_password = “cactipw”;更改用户、密码 等项 与上面给出的对应 保存退出#crontab -u cactiuser -e加入*/5 * * * * /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1保存退出:wq全部设置完毕。打开浏览器 http://localhost/cacti 进入cacti的初始设置页面第一次默认登陆账号:admin 密码 admin J登陆后在新改个密码就OK需要说明的还有路径snmpwalk Binary Path : /usr/bin/snmpwalksnmpget BinaryPath: /usr/bin/snmpgetRRDTool Binary Path: /usr/rrdtool-1.3.8/src/rrdtoolPHP Binary Path: /www/php/bin/phpCacti Log File Path: /www/htdocs/cacti/log/cacti.logCactid Poller File Path: /www/htdocs/cacti/poller.php


注:此时graphs还不能显示图形,需要将服务重新启动一下

view plaincopyprint?

[*]# service snmpd restart
[*]# service mysql restart
[*]# service httpd restart
# service snmpd restart# service mysql restart# service httpd restart


OK,现在打开http://localhost/cacti进入graphs查看localhost就会有图形了。

要添加自定义图形,请阅读《CACTI使用文档》。
  
  转自:http://www.zhdba.com/mysqlops/2011/06/08/cacti-install-setting/
页: [1]
查看完整版本: Cacti安装配置的详细步骤