Chinaunix首页 | 论坛 | 博客
  • 博客访问: 334590
  • 博文数量: 64
  • 博客积分: 2301
  • 博客等级: 大尉
  • 技术积分: 570
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-25 11:48
文章分类

全部博文(64)

文章存档

2013年(5)

2012年(6)

2011年(36)

2010年(7)

2009年(10)

分类: LINUX

2010-04-12 16:24:47

Redhat5.3cacti的安装配置

系统环境及相关软件

Linux redhat enterprise as5.3

httpd-2.2.13.tar

mysql-5.0.75.tar.gz

php-5.2.3.tar.bz2

rrdtool-1.4.2.tar.gz

net-snmp-5.5.tar.gz

cacti-0.8.7e.tar.gz

安装配置

1.apache的安装

tar -xvf httpd-2.2.13.tar

cd httpd-2.2.13

./configure --prefix=/cacti/apache --enable-so

make

make install

2.mysql的安装

tar -xzvf mysql-5.0.75.tar.gz

cd  mysql-5.0.75

./configure --prefix=/cacti/mysql

make

make install

cp support-files/my-medium.cnf /etc/my.cnf

cp ./support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

groupadd mysql

useradd -g mysql  mysql

cd /usr/local/mysql

./bin/mysql_install_db --user=mysql

3.php的安装

tar -xjvf php-5.2.3.tar.bz2(注:开始安装使用的是php-5.3.2.tar.gz但是安装后运行cacati出错,

Deprecated: Function ereg_replace() is deprecated in /cacti/apache/htdocs/cacti/include/config.php  on line 63

后再网络上查出cacti的开发使用的是php5.1,而php5.3已经将ereg_replace()函数删除,所以将php版本将为php-5.2.3

cd php-5.2.3

./configure --prefix=/cacti/php \

--with-apxs2=/cacti/apache/bin/apxs \

--with-config-file-path=/cacti/php \

--with-mysql=/cacti/mysql \

--with-zlib-dir=/usr/include \

--enable-sockets \

--with-gd

最后可能会提示缺少libxml,就需要下载回来安装,很简单 ./configure 然后 make; make install

make

make install

cp php.ini-development /cacti/php/php.ini

vi /cacti/apache/conf/httpd.conf

找到 在index.html 加上index.php

    DirectoryIndex index.html  =>  DirectoryIndex index.php index.html

在最末尾加如:

AddType application/x-httpd-php .php .php3  .phtml

AddType application/x-httpd-php-source .phps

然后在 /usr/local/apache/htdocs 里建立一个php文件

vi index.php

内容如下:

phpinfo();

?>

页面无法解析就修改你的php.ini

修改short_open_tag = Off

short_open_tag = on

5.rrdtool的安装

安装rrdtool-1.4.2 版本的

# tar -xzvf rrdtool-1.4.2.tar.gz

#cd rrdtool-1.4.2

#./configure --prefix=/cacti/rrdtool

出现如下错误:

configure: WARNING:

----------------------------------------------------------------------------

* I found a copy of pkgconfig, but there is no cairo-png.pc file around.

  You may want to set the PKG_CONFIG_PATH variable to point to its

  location.

----------------------------------------------------------------------------

还有缺少cairo pango相关包

解决方法:

#find  / -name pkgconfig

/usr/share/pkgconfig

/usr/lib/pkgconfig

#vi /etc/profile在最后添加如下

export PKG_CONFIG_PATH=/usr/share/pkgconfig

保存退出

cairo安装在关盘中找到相关文件并安装出现错误如下

libglibjava-0.2.so is needed by cairo-java-1.0.5-3.fc6.i386

libglibjni-0.2.so is needed by cairo-java-1.0.5-3.fc6.i386

解决方法:

安装glib-java-0.2.6-3.fc6.i386.rpm  glib-java-devel-0.2.6-3.fc6.i386.rpm

安装cairo相关

安装cairo-develpango-devel

configure完成后继续编译安装

#make

#make  install

mrtg相比,rrdtool自带了gd,所以不用先安装gd.(不过由于rrdtool自带的gd库不支持中文,所以rrdtool画出来

的图也不能有中文,否则会出现乱码).

 

设置mysql

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 

mysql>create database cactidb;

Query OK, 1 row affected (0.00 sec)

mysql>grant all on cactidb.* to cactiuser;

Query OK, 0 rows affected (0.00 sec)

mysql>grant all on cactidb.* to cactiuser@localhost;

Query OK, 0 rows affected (0.01 sec)

mysql> set password for cactiuser@localhost=password('llycacti123');

Query OK, 0 rows affected (0.00 sec)

mysql>exit

6.net-snmp的安装

安装net-snmp

# tar -xzvf net-snmp-5.5.tar.gz

#cd net-snmp-5.5

#./configure --prefix=/cacti/net-snmp

#make

#make install

EXAMPLE.conf文件复制到/cacti/net-snmp/snmp.cnf

#cp  EXAMPLE.conf  /cacti/net-snmp/snmp.cnf

#cd /cacti/net-snmp

#vi snmp.conf

查找以下字段:
sec.name  source          community
com2sec notConfigUser  default       public
"comunity"字段改为你要设置的密码.比如"public".                                             
“default”改为你想哪台机器可以看到你的snmp信息,10.10.10.10

查找以下字段:
# Finally, grant the group read-only access to the systemview view.
#       group          context sec.model sec.level prefix read   write  notif
access  notConfigGroup ""      any       noauth    exact  all none none
"read"字段改为all.

查找以下字段:
#           incl/excl subtree                          mask
#view all    included  .1                               80
将该行前面的"#"去掉.

保存退出

接着启动snmp

 /cacti/net-snmp/sbin/snmpd –c /cacti/net-snmp/snmp.cnf&

7.安装配置cacti

#cd /cacti/apache/htdocs

#tar -xzvf /home/foursunadmin/soft/cacti-0.8.7e.tar.gz  ./

#mv cacti-0.8.7e  cacti

#useradd cactitest

#passwd  cactitest

#chown cactitest.root  -R cacti

#cd cacti

#mysql -uroot  cactidb < cacti.sql

#vi /cacti/apache/htdocs/cacti/include/config.php

    $database_type = mysql;

    $database_default = cactidb;  

    $database_hostname = localhost;

    $database_username = cactiuser;

    $database_password = llycacti123;

 采集数据的命令:*/5 * * * * /cacti/php/bin/php /cacti/apache/htdocs/cacti/poller.php > /dev/null 2>&1

 

 

 页面配置

全部设置完后打开浏览器 进入cacti的初始设置页面,第一次默认登陆账号

 

admin 密码 admin ,登陆后再新改个密码,再用admin和密码登陆就OK

需要说明的还有路径

snmpwalk Binary Path /cacti/net-snmp/bin/snmpwalk

 

snmpget Binary Path /cacti/net-snmp/bin/snmpget

 

RRDTool Binary Path /cacti/rrdtool/bin/rrdtool

 

PHP Binary Path /cacti/php/bin/php

 

Cacti Log File Path/cacti/apache/htdocs/cacti/log/cacti.log

 

Cactid Poller File Path/cacti/apache/htdocs/cacti/poller.php

 

 

 

阅读(1485) | 评论(0) | 转发(0) |
0

上一篇:nmap使用说明书

下一篇:redhat安装yum

给主人留下些什么吧!~~