手机版
你好,游客 登录 注册
背景:
阅读新闻

Red Hat Enterprise Linux 5.4下Cacti的安装和配置

[日期:2011-07-13] 来源:Linux社区  作者:zhuying_linux [字体:大 中 小]

2)安装Apache(httpd-2.2.17.tar.bz2)

# tar -zxvf httpd-2.2.17.tar.bz2
# cd httpd-2.2.17
# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-mods-shared=most

  说明:
  --enable-so      //让Apache可以支持DSO模式,注意,这里采用的是Apache2.0的语法。如果你的Apache是1.3版本,应改为--enable-module=so。
  --enable-mods-shared=most     //告诉编译器将所有标准模块都编译为DSO模块。你要是用的是Apache1.3,改为--enable-shared=max就可以。
  --enable-rewrite     //支持地址重写功能,使用1.3版本的朋友请将它改为--enable-module=rewrite。

# make
# make install
# vi /usr/local/apache/conf/httpd.conf      //
修改Apache配置文件,添加ServerName www.yourdomain.com              (或ServerName 本机ip)

  对下面的内容在httpd.conf中进行查找和修改
  DirectoryIndex index.php index.html         //修改默认启动页
  DocumentRoot "/var/www/html/cacti"          //指定主目录(/usr/local/apache2/htdocs)
  ServerName localhost:80

  查找AddType application/x-compress .Z
  在其下加入 AddType application/x-tar .tgz
  AddType application/x-httpd-php .php
  AddType image/x-icon .ico

  在rc.local上加入一行/usr/local/apache/bin/apachectl –k start,系统启动时启动Apache服务。

# vi /etc/rc.d/rc.local


  将 apache 注册为 Linux 系统服务

# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
# chkconfig --add httpd

#chkconfig --level 345 httpd on
# service httpd start   //
启动服务

# service httpd stop    //
停止服务
# service httpd restart //
重新启动

 

注意:可能出现的问题

# chkconfig --add httpd

service httpd does not support chkconfig

httpd服务不支持 chkconfig。需要编辑/etc/rc.d/init.d/httpd,添加以下注释信息:
# daizhongxian
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server.

 



  3)安装PHP(php-5.3.5.tar.bz2)
  先安装zlib,freetype,libpng,jpeg以便于让PHP支持GD库(Cacti的WeatherMap插件必须要较新GD库的支持)

  3).i).安装zlib(zlib-1.2.3.tar.gz)

# cd /usr/local/_temp
# tar -zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=/usr/local/zlib
# make
# make install



  3).ii).安装libpng(libpng-1.2.18.tar.gz)

# tar -zxvf libpng-1.2.18.tar.gz
# cd libpng-1.2.18
# cd scripts/
# mv makefile.linux ../makefile
# cd ..
# make
# make install

 

 

 

 

【出错的话:collect2: ld returned 1 exit status

make: *** [pngtest] Error 1

可以直接编译./configure –prefix=/usr/local/libpng】

  注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个

  3).iii).安装freetype(freetype-2.3.5.tar.gz)

# tar -zxvf freetype-2.3.4.tar.gz
# cd freetype-2.3.5 
# ./configure --prefix=/usr/local/freetype
# make
# make install


  3).iv).安装jpeg(jpegsrc.v6b.tar.gz)

# tar -zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b/
# mkdir /usr/local/libjpeg
# mkdir /usr/local/libjpeg/include
# mkdir /usr/local/libjpeg/bin
# mkdir /usr/local/libjpeg/lib
# mkdir /usr/local/libjpeg/man
# mkdir /usr/local/libjpeg/man/man1
# ./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
# make
# make install

注意,这里configure一定要带--enable-shared参数,不然,不会生成共享库
注意:可能会出错

make: ./libtool: Command not found

make: *** [jcapimin.lo] Error 127

解决办法:下载libtool安装【libtool-2.2.6a.tar.gz】

tar  --zxvf libtool-2.2.6a.tar.gz

cd libtool-2.2.6a.tar.gz

./configure --prefix=/usr/local/libtool

make && make install

==================

#cd jpeg-6b

cp /usr/share/libtool/config.sub .
#cp /usr/share/libtool/config.guess .

  3).v).安装Fontconfig(fontconfig-2.4.2.tar.gz)

# tar -zxvf fontconfig-2.4.2.tar.gz
# cd fontconfig-2.4.2
# ./configure --prefix=/usr/local/fontconfig  --with-freetype-config=/usr/local/freetype
# make
# make install

 

 

 

注意:

问题一:

checking for LIBXML2... configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:

No package 'libxml-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBXML2_CFLAGS
and LIBXML2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

 

解决方案:报错的话,应该需要安装libxml2-2.6.32.tar.gz

如果还有错误的话

确定 /usr/local/libxml2/lib/pkgconfig 目录下有 libxml-2.0.pc
export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
再次生成 makefile ,make && install 这样就成功了

 

另外出现问题:

make编译不成功

make[3]: *** [fc-case.o] Error 1

make[3]: Leaving directory `/usr/local/_temp/fontconfig-2.4.2/fc-case'

make[2]: *** [all] Error 2

make[2]: Leaving directory `/usr/local/_temp/fontconfig-2.4.2/fc-case'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/usr/local/_temp/fontconfig-2.4.2'

make: *** [all] Error 2

解决:

./configure --with-freetype-config=/usr/local/freetype/bin/freetype-config

 

 

 

 


  3).vi).安装GD(gd-2.0.35.tar.gz)

# tar -zxvf gd-2.0.35.tar.gz
# cd gd-2.0.35
# ./configure --prefix=/usr/local/libgd --with-png =/usr/local/libpng --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg --with-fontconfig=/usr/local/fontconfig
# make
# make install

 

  编译成功后会显示以下信息** Configuration summary for gd 2.0.35:

   Support for PNG library:          yes
   Support for JPEG library:         yes
   Support for Freetype 2.x library: yes
   Support for Fontconfig library:   yes
   Support for Xpm library:          no
   Support for pthreads:             yes

注意:make过后会出现错误

configure.ac:64: error: possibly undefined macro: AM_ICONV

If this token and others are legitimate, please use m4_pattern_allow.

See the Autoconf documentation.

make: *** [configure] Error 1

make[2]: *** [gd_png.lo] Error 1

make[2]: Leaving directory `/usr/local/_temp/gd-2.0.35'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/usr/local/_temp/gd-2.0.35'

make: *** [all] Error 2

=====================================================

解决方法:

下载gettext-0.18.tar.gz

/usr/lib/libncurses.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

make[4]: *** [libgettextlib.la] Error 1

make[4]: Leaving directory `/usr/local/_temp/gettext-0.18.1.1/gettext-tools/gnulib-lib'

make[3]: *** [all] Error 2

make[3]: Leaving directory `/usr/local/_temp/gettext-0.18.1.1/gettext-tools/gnulib-lib'

make[2]: *** [all-recursive] Error 1

make[2]: Leaving directory `/usr/local/_temp/gettext-0.18.1.1/gettext-tools'

make[1]: *** [all] Error 2

make[1]: Leaving directory `/usr/local/_temp/gettext-0.18.1.1/gettext-tools'

make: *** [all-recursive] Error 1

解决办法 ,编译加m4_pattern_allow参数

即:./configure --enable-m4_pattern_allow

便能顺利编译安装

 

#################################################
如果出现下面错误:
gd_png.c:825: warning: data definition has no type or storage class
make[2]: *** [gd_png.lo] Error 1
修复方法:
CPPFLAGS="-I/usr/local/libpng/include" ./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg --with-fontconfig=/usr/local/fontconfig/
#################################################

  3).vii).编辑/etc/ld.so.conf文件,添加以下几行到此文件中。

# vi /etc/ld.so.conf


  /usr/local/zlib/lib
  /usr/local/freetype/lib
  /usr/local/libjpeg/lib
  /usr/local/libgd/lib

添加:/usr/local/mysql/lib

# ldconfig -v      //并执行ldconfig命令,使用动态装入器装载找到共享库



  3).viii).安装libxml(libxml2-2.7.8.tar.gz)

# tar -zxvf libxml2-2.6.32.tar.gz
# cd libxml2-2.6.32
# ./configure  --prefix=/usr/local/libxml2
# make
# make install


  3).ix).安装php(php-5.3.5.tar.bz2)

# tar -jxvf php-5.2.10.tar.bz2
# cd php-5.2.10
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local/libgd --enable-gd-native-ttf --with-ttf --enable-gd-jis-conv --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --with-zlib-dir=/usr/local/zlib --enable-xml --enable-mbstring --enable-sockets --with-snmp --enable-short-tags

 

注意:该版本去掉--with-ttf,不支持

 

注意:如果提示错误,说不支持snmp,我们可以先安装net-snmp,然后再指定路径

--with-snmp=/usr/local/net-snmp

 

注意:安装完成后可能会出现错误提示:

/usr/local/zlib/lib/libz.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

make: *** [libphp5.la] Error 1

解决办法:

cd zlib-1.2.3 //进入zlib目录
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib   //
使用64位元的方法进行编译
make
make install

 

  说明:
  --with-apxs2=/usr/local/apache/bin/apxs  //这是加入apache中为DSO模块的位置
  --with-mysql=/usr/local/mysql    //支持MySQl
  --with-gd=/usr/local/libgd     //支持GD库
  --enable-gd-native-ttf     //激活对本地 TrueType 字符串函数的支持
  --with-ttf     //激活对 FreeType 1.x 的支持
  --enable-gd-jis-conv //使JIS-mapped可用,支持日文字体
  --with-freetype-dir=/usr/local/freetype    //激活对 FreeType 2.x 的支持
  --with-jpeg-dir=/usr/local/libjpeg //激活对 jpeg-6b 的支持
  --with-png-dir=/usr   //激活对 png 的支持
  --with-zlib-dir=/usr/local/zlib //激活对zlib 的支持
  --enable-xml     //支持XML
  --enable-mbstring    //激活mbstring模块
  --enable-sockets      //支持套接字
  --with-snmp     //支持snmp
  --enable-short-tags  //支持PHP的短标记

# make
# make install
# cp php.ini-recommended /usr/local/php/lib/php.ini   //
复制php配置文件【在php-5.3.5.tar.bz2版本中式将php.ini-development拷为php.ini的】

# ln -s /usr/local/php/bin/* /usr/local/bin/      //
建立符合链接
# service httpd restart //
重新启动apache服务

 

注意:在make & make install后会出现以下情况:

/usr/local/net-snmp/lib/libnetsnmp.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

make: *** [libphp5.la] Error 1

解决方案:

    可以先安装snmp协议,并且指定他的目录

 

注意:后面安装php后可能要修改配置文件

Vim /usr/local/apache/htdocs/conf/httpd.conf

添加:

LoadModule php5_module        modules/libphp5.so

 

注意:由于php的版本比较高,安装过程中海可能遇到一些问题,比如说测试的时候,可能代码得改成<?php

phpinfo();

?>

另外还可能遇到一些关于时间的问题,我们都可以在网上找到解决的办法

linux
相关资讯       redhat  CACTI 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* suanfa 发表于 2011/11/22 17:25:55
好