cacti的基本安装(一)

以下测试是经安装cacti成功出图后笔记,仅供参考:
    首先,下载cacti环境所需包:
    httpd-2.2.6.tar.gz,mysql-5.1.37.tar.gz,libxml2-2.6.28.tar.gz,cacti-0.8.7e.tar.gz 
    gettext-0.16.1.tar.gz,libpng-1.2.18.tar.gz,rrdtool-1.2.27.tar.gz
    curl-7.15.0.tar.gz ,zlib-1.2.3.tar.gz,freetype-2.3.5.tar.gz  jpegsrc.v6b.tar.gz
    gd-2.0.35.tar.gz ,libart_lgpl-2.3.17.tar.gz  php-5.1.6.tar.gz
    还有net-snmp包,我在实验中使用是rpm安装。
    解压下载的包后,分别进入解压目录进行下列安装
    1.安装Apache
   ./configure --prefix=/usr/local/apache2 --enable-module=so --with-mpm=worker --enable-module=rewrite
   make && make install
   /usr/local/apache2/bin/apachectl start
   IE访问 http://ip/出现”It works!”,说明apache安装成功。
    2.安装mysql
   groupadd mysql
   useradd �Cg mysql mysql
   ./configure --prefix=/usr/local/mysql --localstatedir=/opt/data/ --with-extra-charsets=gbk
   make && make install     
   cp  support-files/my-medium.cnf /etc/my.cnf
     cd /usr/local/mysql
     bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/opt/mydata
     chown -R mysql.mysql .
     /usr/local/mysql/bin/mysqld_safe --user=mysql --datadir=/opt/mydata &
   /usr/local/mysql/bin/mysqladmin �Cu root �Cp password '123456'
     Enter password:直接回车
   /usr/local/mysql/bin/mysql �Cu root �Cp
   Enter password:    ----123456
    3.插件相关:编译安装libxml
    ./configure --prefix=/usr/local/libxml2/
    make && make install
    4.编译安装zlib
    ./configure --prefix=/usr/local/zlib2/
    make && make install
    5.编译安装jpeg
    mkdir /usr/local/jpeg6/include  -p
      mkdir /usr/local/jpeg6/lib
      mkdir /usr/local/jpeg6/bin
    mkdir /usr/local/jpeg6/man/man1 �Cp
      ./configure --prefix=/usr/local/jpeg6
    make install-lib
    make install
    6.编译安装libpng
    cp scripts/makefile.gcmmx makefile
    ./configure --disable-shared --prefix=/usr/local/libpng2/
    make && make install
    7.编译安装freetype
    ./configure --disable-shared --prefix=/usr/local/freetype2/
    make && make install
    8.编译安装libart_lgpl
    ./configure --disable-shared --prefix=/usr/local/libart/
    make && make install
    9.编译安装gettext
    ./configure --prefix=/usr/local/gettext/
    make && make install
    10.安装编译gd
      ./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib2/ --with-png=/usr/local/libpng2/ --with-jpeg=/usr/local/jpeg6/ --with-
freetype=/usr/local/freetype2/ --with-libart=/usr/local/libart/ --with-gettext=/usr/local/gettext/ --with-libxml=/usr/local/libxml2/
    make && make install
    11.编译curl
    ./configure --prefix=/usr/local/curl
    make && make install
    12.编译安装PHP
 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg6/ --with-png-
dir=/usr/local/libpng2/ --with-gd --with-freetype-dir=/usr/local/freetype2/ --with-zlib-dir=/usr/local/zlib2/ --with-mysql=/usr/local/mysql --
with-curl=/usr/local/curl   --with-libxml-dir=/usr/local/libxml2 --with-gettext=/usr/local/gettext --enable-sockets
   make&&make install
   cp php.ini-dist /usr/local/php/lib/php.ini  
   vi /usr/local/apache2/conf/httpd.conf 
     在#AddType application/x-tar.tgz填加
     AddType application/x-httpd-php .php
     AddType image/x-icon .ico
     找到 DirectoryIndex行,添加index.php  保存
   /usr/local/apache2/bin/apachectl restart 
   13.安装rrdtool
   ./configure --prefix=/usr/local/rrdtool
   make && make install
     在实验时,出现下面的错误:
     configure: error: Please fix the library issues listed above and try again.
     解决:安装libart_lgpl-devel这个包,rpm 包或者源码包都可以
  14.安装net-snmp(使用rpm包,也可以编译)
   yum -y install net-snmp*
   配置snmp:
   vi /etc/snmp/snmpd.conf (只修改一行)
   #view         all        included            .1         80  (去掉#)
   保存启动:service snmpd start
  15.安装配置cacti
     useradd cactiuser
   tar zxvf cacti-0.8.7e.tar.gz
     mv cacti-0.8.7e /usr/local/apache2/htdocs/cacti
   chown -R cactiuser:cactiuser /usr/local/apache2/htdocs/cacti
   在Mysql中创建新的database,导入cacti目录中的cacti.sq创建表:
   /usr/local/mysql/bin/mysql �Cu root �Cp
   Enter Password:    123456
   mysql> create database cacti;
   mysql> use cacti;
   mysql> source /usr/local/apache2/htdocs/cacti/cacti.sql;
   grant all on cacti.* to root;               (权限的设置)
   grant all on cacti.* to root@localhost;
   grant all on cacti.* to cactiuser;
   grant all on cacti.* to cactiuser@localhost;
   set password for cactiuser@localhost=password('cactipw');
   vi /usr/local/apache2/htdocs/cacti/include/config.php
   $database_password=“cactipw”;   (只改这行)
   打开浏览器 http://IP/cacti
   提示安装:需要修改前2个路径:
      RRDTool Binary Path: /usr/local/rrdtool/bin/rrdtool  
 PHP Binary Path:/usr/local/php/bin/php    
   安装完成
   首次登陆默认账号:admin密码admin
   登陆后系统会强制立即修改密码
   /usr/local/php/bin/php /usr/local/apache2/htdocs/cacti/poller.php > /dev/null 2>&1   (手动生成图像文件:位
于/usr/local/apache2/htdocs/cacti/rra下)
 snmpwalk -v 1 127.0.0.1 -c public若没错误则说明snmp没有问题
 crontab �Ce:如下每5分钟更新图像统计信息
     */5 * * * *  /usr/local/php/bin/php /usr/local/apache2/htdocs/cacti/poller.php> /dev/null 2>&1
查看 http://ip/cacti(下图是我过了一段时间截的图)
1.
     
2.
     

你可能感兴趣的:(安装,职场,cacti,休闲)