设为首页 收藏本站
查看: 1181|回复: 0

[经验分享] Cacti安装配置的详细步骤

[复制链接]

尚未签到

发表于 2015-11-22 13:02:11 | 显示全部楼层 |阅读模式
目录(?)[+]

  • 需要的软件
  • 安装步骤

    • 安装mysql数据库
    • 安装apache服务
    • 安装PHP
    • 安装rrdtool
    • 安装net-snmp
    • 配置MYSQL数据库
    • 安装 配置cacti

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

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

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



  
2安装apache服务[html] view plaincopyprint?

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

  
3安装PHP[sql] view plaincopyprint?

  • [iyunv@test usr]# tar -zxvf php-5.2.12.tar.gz  
  • [iyunv@test usr]# cd php-5.2.12  
  • [iyunv@test 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  
  • [iyunv@test php-5.2.12]# make && make install  
  • [iyunv@test php-5.2.12]# cp php.ini-dist /www/php/php.ini  
  • [iyunv@test php-5.2.12]# 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  
  • [iyunv@test php-5.2.12]# /www/bin/apachectl restart  
[iyunv@test usr]# tar -zxvf php-5.2.12.tar.gz[iyunv@test usr]# cd php-5.2.12[iyunv@test 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[iyunv@test php-5.2.12]# make && make install[iyunv@test php-5.2.12]# cp php.ini-dist /www/php/php.ini[iyunv@test php-5.2.12]# 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[iyunv@test php-5.2.12]# /www/bin/apachectl restart
Php安装完毕

  
4安装rrdtool[html] view plaincopyprint?

  • [iyunv@test usr]# tar zxvf rrdtool-1.3.8.tar.gz  
  • [iyunv@test usr]# cd rrdtool-1.3.8  
  • [iyunv@test rrdtool-1.3.8]# ./configure  
  • [iyunv@test rrdtool-1.3.8]# make && make install  
[iyunv@test usr]# tar zxvf rrdtool-1.3.8.tar.gz[iyunv@test usr]# cd rrdtool-1.3.8[iyunv@test rrdtool-1.3.8]# ./configure[iyunv@test rrdtool-1.3.8]# make && make install
Rrdtool安装完毕

  
5安装net-snmp需要
[sql] 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*进行安装。
  • 安装完成后修改配置文件:  
  • [iyunv@test usr]# vi /etc/snmp/snmpd.conf  
  • 更改 1、com2sec notConfigUser  default      public  
  • 改为:com2sec notConfigUser   127.0.0.1       public
  • 2、access  notConfigGroup “”      any       noauth    exact  systemview  none none
  • 改为:access  notConfigGroup “”      any       noauth    exact all  none  none  
  • 3、#view all    included  .1         80
  • 将前面的 # 注释 去掉。  
  • 保存退出 :wq  
  • [iyunv@test usr]# 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*进行安装。安装完成后修改配置文件:[iyunv@test usr]# 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[iyunv@testusr]# service snmpd restart



  
6配置MYSQL数据库[sql] 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[html] view plaincopyprint?

  • [iyunv@test usr]# useradd cactiuser -g users  
  • [iyunv@test usr]# passwd cactiuser (pwd:cactipw)  
  • [iyunv@test usr]# cp cacti-0.8.7b.tar.gz /www/htdocs/  
  • [iyunv@test usr]# cd /www/htdocs/  
  • [iyunv@test htdocs]# tar zxvf cacti-0.8.7b.tar.gz  
  • [iyunv@test htdocs]# mv cacti-0.8.7b cacti  
  • [iyunv@test htdocs]# cd cacti  
  • [iyunv@test cacti]# /usr/local/mysql/bin/mysql -u root -pmysql cactidb < cacti.sql  
  • [iyunv@test cacti]# chown -R cactiuser rra/ log/  
  • [iyunv@test cacti]# cd scripts  
  • [iyunv@test scripts]# chown cactiuser:users *  
  • [iyunv@test scripts]# vi /www/htdocs/cacti/include/config.php  
  • $database_type = “mysql”;
  • $database_default = “cactidb”;  
  • $database_hostname = “localhost”;
  • $database_username = “cactiuser”;
  • $database_password = “cactipw”;
  • 更改用户、密码 等项 与上面给出的对应 保存退出  
  • [iyunv@test scripts]# 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  
[iyunv@test usr]# useradd cactiuser -g users[iyunv@test usr]# passwd cactiuser (pwd:cactipw)[iyunv@test usr]# cp cacti-0.8.7b.tar.gz /www/htdocs/[iyunv@test usr]# cd /www/htdocs/[iyunv@test htdocs]# tar zxvf cacti-0.8.7b.tar.gz[iyunv@testhtdocs]# mv cacti-0.8.7b cacti[iyunv@test htdocs]# cd cacti[iyunv@test cacti]# /usr/local/mysql/bin/mysql -u root -pmysql cactidb < cacti.sql[iyunv@test cacti]# chown -R cactiuser rra/ log/[iyunv@test cacti]# cd scripts[iyunv@test scripts]# chown cactiuser:users*[iyunv@test scripts]# vi /www/htdocs/cacti/include/config.php$database_type = “mysql”;$database_default = “cactidb”;$database_hostname = “localhost”;$database_username = “cactiuser”;$database_password = “cactipw”;更改用户、密码 等项 与上面给出的对应 保存退出[iyunv@test scripts]#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还不能显示图形,需要将服务重新启动一下

[html] view plaincopyprint?

  • [iyunv@test scripts]# service snmpd restart  
  • [iyunv@test scripts]# service mysql restart  
  • [iyunv@test scripts]# service httpd restart  
[iyunv@test scripts]# service snmpd restart[iyunv@test scripts]# service mysql restart[iyunv@test scripts]# service httpd restart


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

要添加自定义图形,请阅读《CACTI使用文档》。
  
  转自:http://www.zhdba.com/mysqlops/2011/06/08/cacti-install-setting/

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-142147-1-1.html 上篇帖子: Cacti 添加多台主机带宽汇聚 下篇帖子: Cacti安装配置#
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表