centos 安装cacti 笔记

yum -y install wget


service iptables stop       关闭防火墙
setenforce 0                关闭selinux

1.安装epel 源
$ yum install epel -release -y

2.安装依赖软件(lamp、net-snmp、rrdtool)
yum install httpd php php -mysql mysql mysql -server mysql -devel php -gd libjpeg libjpeg -devel libpng libpng -devel  wget httpd* mysql* libart_lgpl* net-snmp* libtool gcc gcc-c++ vim* cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel net -snmp net -snmp -utils rrdtool -y
yum install  php-snmp  net-snmp -y
yum -y install php-process  PHP-ldap
yum search ldap
yum install PHP-ldap


3.启动相关服务
$ /etc/init.d/mysqld start
$ /etc/init.d/httpd start
$ /etc/init.d/snmpd start
chkconfig --level 2345 snmpd on      设置snmp启动项
chkconfig --level 2345 httpd on      设置http启动项
chkconfig --level 2345 mysqld on     设置mysql启动项

Apache:
$ vim /etc/httpd/conf/httpd.conf
# 增加下行,避免启动httpd服务出现关于ServerName的警告。
ServerName 自定义 : 80

$ vim /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 all
        </IfModule>
    </Directory>
    #
    # yum安装的httpd为2.2版本,在httpd-2.2配置段的"Allow from localhost"后添加允许访问的主机IP,
    # 或者直接改为"Allow from all"以允许所有IP访问。
    # 这样才能进行Cacti的Web端安装和监控。
$ /etc/init.d/httpd restart

PHP:
$ vim /etc/php .ini
# 设置时区
date .timezone = Asia/Shanghai

tar zxvf cacti-1.1.36.tar.gz
mv cacti-1.1.36/* /var/www/html/cacti

tar zxvf cacti-spine-1.1.36.tar.gz
cd cacti-spine-1.1.36
./configure && make && make install

Mysql:
$ mysql -uroot
mysql > create database cacti;
mysql > grant all on cacti . * to cacti@localhost identified by 'cactipassword';
mysql > flush privileges;
grant all privileges on *.* to cacti@localhost identified by ' cactipassword ';
flush privileges;

mysql > quit
$ mysql -uroot cacti < /var/www/html/cacti/cacti.sql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
mysql初始没有密码,进入mysql,创建cacti数据库,赋予cacti用户对该数据库进行操作的权限,导入


vim /var/www/html/cacti/include/config.php

$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti';
$database_password = 'cactipassword';
$database_port     = '3306';
$database_ssl      = false;

/etc/init.d/httpd restart
/usr/bin/php /var/www/html/cacti/poller.php

$ /usr/bin/php /usr/share/cacti/poller.php  
$ crontab -e
# 写入下行,每五分钟获取监控信息  
* /5 * * * * /usr /bin/php /usr/share/cacti/poller.php



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值