您的位置:首页 > 其它

Redhat EL 5.3上安装Cacti(上集)

2009-12-17 23:11 906 查看
本文只介绍Cacti环境的安装方法及安装过程中遇到的错误解决方法。
很多内容可能网络上好多朋友已经写过了,我只不过把我安装时的一些细节和遇到的出现错误的地方记录下来总结!希望对其他想安装的朋友有用!累死我了,不过现在安装一次的时间大大缩短了!哈哈~~
开始安装:
本文中所用到的软件下载地址如果不能使用了,可以自己上google/baidu搜索个链接!目前应该都好用,因为我才用过。安装时,注意你的安装目录。
第一部分:编译安装ApacheMySQL
# wget ftp://ftp.ru/pub/sunfreeware/SOURCES/httpd-2.2.6.tar.gz
# tar zxvf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# ./configure --prefix=/usr/local/apache22 --enable-module=so --with-mpm=worker --enable-module=rewrite
# make && make install
启动apache:
# /usr/local/apache22/bin/apachectl start
IE访问http://ip/出现”It works!”,说明apache安装成功。
开始安装mysql
# wget http://download.mysql.cn/download_file/gz/5.0/mysql-5.0.22.tar.gz
# tar zxvf mysql-5.0.22.tar.gz
# cd mysql-5.0.22
# ./configure
--prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data/
--without-innodb --without-debug --with-extra-charsets=gbk
--with-extra-charsets=all --enable-assembler --with-pthread
--enable-thread-safe-client --with-client-ldflags=-all-static
配置成功出现“Thank you for choosing MySQL!”提示。
# make && make install //这步大概要10分钟左右吧,漫长啊。。。
Mysql配置
# cp ./support-files/mysql.server /etc/init.d/mysql
# groupadd mysql
# useradd –g mysql mysql
# chmod 777 /etc/init.d/mysql
# /usr/local/mysql/bin/mysql_install_db
# chown -R mysql:mysql /usr/local/mysql/data/
启动Mysql
# service mysql start
# /usr/local/mysql/bin/mysqladmin –u root –p password 'rootpw' //设置密码为rootpw
Enter password: //默认密码为空,所以直接回车
# /usr/local/mysql/bin/mysql –u root –p
Enter password: //输入新密码后,登录成功
mysql安装配置完毕。
第二部分:[/b]安装[/b]GD[/b]库及相关[/b]插件[/b][/b]
编译安装libxml
#
wget http://xmlsoft.org/sources/libxml2-2.6.32.tar.gz
# tar zxvf libxml2-2.6.32.tar.gz
# cd libxml2-2.6.32
# ./configure --prefix=/usr/local/libxml2/
# make && make install
编译安装zlib
#
wget http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz
# tar zxvf zlib-1.2.3.tar.gz
# # cd zlib/1.2.3/
# ./configure --prefix=/usr/local/zlib2/
# make && make install
编译安装jpeg
这个版本jpeg在make install时会出现目录error。手动创建这些目录,然后再重新make install就可以了,我这把缺失的命令都加上了,应该不会出这个error了。
#
wget ftp://ftp.aai.ee/pub/unix/jpegsrc.v6b.tar.gz

# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/man/man1
-p
# tar zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6
# make
# make install-lib
# make install
编译安装libpng
#
wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
# tar zxvf libpng-1.2.18.tar.gz
# cd
libpng-1.2.18
# cp scripts/makefile.gcmmx makefile
# ./configure --disable-shared --prefix=/usr/local/libpng2/
# make && make install
编译安装freetype
#
wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
# tar zxvf freetype-2.3.5.tar.gz
# cd freetype-2.3.5
# ./configure --disable-shared
--prefix=/usr/local/freetype2/
# make && make install
编译安装libart_lgpl
#
wget http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
# tar zxvf libart_lgpl-2.3.17.tar.gz
# cd libart_lgpl-2.3.17
# ./configure --disable-shared
--prefix=/usr/local/libart/
# make && make install

编译安装gettext
#
wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.16.1.tar.gz
# tar zxvf gettext-0.16.1.tar.gz
# cd gettext-0.16.1
# ./configure --prefix=/usr/local/gettext/
# make && make install
//这个编译时间好长啊。。。郁闷,可以出去吃个雪糕了haha
[align=left]上面全部安装完成后,开始编译安装gd,此处注意configure时各个插件的地址是否正确: [/align]
#
wget http://google-desktop-for-linux-mirror.googlecode.com/files/gd-2.0.35.tar.gz
[align=left]# tar zxvf gd-2.0.35.tar.gz[/align]
[align=left]# cd gd/2.0.35/[/align]
# ./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
#
cp /usr/lib/libattr.* /lib/ //如果没执行这步,make时会出现下面的error信息
[align=left]# make && make install[/align]

[align=left]安装GD2时出错提示:[/align]
cd . && /bin/sh
/tmp/cacti/gd/2.0.35/config/missing --run aclocal-1.9 -I config
aclocal:configure.ac:64: warning: macro
`AM_ICONV' not found in library
cd .
&& /bin/sh /tmp/cacti/gd/2.0.35/config/missing --run automake-1.9
--foreign
cd . && /bin/sh
/tmp/cacti/gd/2.0.35/config/missing --run autoconf
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.
[align=left]make: *** [configure] error 1[/align]
[align=left]解决方法:[/align]
#
cp /usr/lib/libattr.* /lib/ //有两个libattr开头文件,有一个/lib里有,另一个复制过去就行了

编译安装Curl支持

[align=left]# wget http://dl.ambiweb.de/mirrors/curl.haxx.se/curl-7.15.0.tar.gz[/align]
[align=left]# tar zxvf curl-7.15.0.tar.gz[/align]
[align=left]# cd curl-7.15.0[/align]
[align=left]# ./configure --prefix=/usr/local/curl[/align]
# make && make install
第三部分:[/b]编译安装并配置PHP [/b]
# wget http://us3.php.net/distributions/php-5.2.10.tar.gz

# tar zxvf
php-5.2.10.tar.gz
[align=left]# cd php-5.2.10[/align]
# ./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache22/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-gettext=/usr/local/gettext
--enable-sockets

[align=left]我第一次安装时,编译PHP出错了,出错信息提示GD有问题:“configure: error: Unable to find gd.h anywhere under”上网查了下说:“系统中已经有GD了,把--with-gd后面留空,就可以顺利configure了,上面的命令,我已经去掉了—with-gd的值,所以应该不会出这个error了。仔细想想好像我装系统时确实把图形那个组件给点上了!嘿嘿~~~[/align]

Configure成功后提示”Thank
you for using PHP.”.
[align=left]# make[/align]
[align=left]# make test[/align]

[align=left]Make test时出错了,不过感觉这个错误影响不是很大,暂时也没找到原因,可能是版本问题,因为上次安装时,我用的不同版本,所以遇到的错误信息也不一样,有点忘了,上次试用了三四个版本,头都搞大了。所以这次也没管它,直接继续安装了~还好后面都成功了,php好用~~~所以暂时就这样吧,如果有高手知道原因,望告之~呵呵~~即使后面不成功的话,这里也可以重编译再装:)换版本或想别的办法解决!!![/align]
ob_start(): Ensure unerasable
buffer cannot be flushed by ob_flush().
[tests/output/ob_start_basic_unerasable_005.phpt]
SPL:
ArrayObject::exchangeArray() basic usage with object as underlying data store.
[ext/spl/tests/arrayObject_exchangeArray_basic3.phpt]

[align=left]继续:[/align]
[align=left]# make install[/align]
[align=left]# cp php.ini-dist /usr/local/php/lib/php.ini //拷贝php配置文件[/align]
[align=left]修改apache配置文件[/b]httpd.conf[/b][/align]
[align=left]# vi /usr/local/apache22/conf/httpd.conf[/align]
[align=left]在#AddType application/x-tar.tgz下加一行:[/align]
AddType
application/x-httpd-php .php
在#LoadModule foo_module
modules/mod_foo.so下加一行: 如果原来有就去掉#号
[align=left]LoadModule php5_module modules/libphp5.so[/align]
找到DirectoryIndex
index.html在后面添加 index.php

[align=left]保存httpd.conf文件. [/align]
[align=left]重启动apache [/align]
[align=left]# /usr/local/apache22/bin/apachectl stop[/align]
[align=left]# /usr/local/apache22/bin/apachectl start
hp安装完后,在 /usr/local/apache2/modules 添加了动态连接库 libphp5.so[/align]
如果在启动或者重启apache时候,出现以下信息:
[root@miix htdocs]# apachectl -k restart
httpd:
Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot
load /usr/local/apache2/modules/libphp5.so into server:
/usr/local/apache2/modules/libphp5.so: cannot restore segment prot
after reloc: Permission denied
这是由于selinux引起的,所以需要这样一下:
chcon -t textrel_shlib_t libphp5.so
php安装完后,在 /usr/local/apache2/conf/httpd.conf 添加了一行:
LoadModule php5_module modules/libphp5.so
本人不想采用这种方式,于是将上述一行注释掉,然后在 httpd.conf 文件末尾添加:
Include conf/conf.d/*.conf
接着建立目录 /usr/local/apache2/conf/conf.d
添加 php.conf 文件,内容如下:
--------------------------------------------------------------------------------
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
--------------------------------------------------------------------------------
重启apache,在 /usr/local/apache2/htdocs 目录下建立一个 test.php 文件,如下
<?php phpinfo(); ?>
写一个测试页,放到apache的htdocs目录下,打开浏览器访问应该可以看到php的版本等信息。php测试页代码如下:<?php phpinfo();?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Redhat Cacti 休闲