RHEL5.2 cacti
作者:Xiajc 注:使用RHEL5.2一.安装apache
./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared="proxy proxy_http proxy_ftp proxy_connect headers"
make
make install
二.安装mysql
//添加用于启动MySQL的用户及用户组
groupadd mysql
useradd mysql -g mysql
tar -xvzf mysql-5.0.51a-linux-i686.tar.gz
cp -rf mysql-5.0.51a-linux-i686 /usr/local/
//建立符号链接,如果以后有新版本的MySQL的话,你可以仅仅将源码解压到新的路径,然后重新做一个符号链接就可以了。这样非常方便,数据也更加安全。
ln -s /usr/local/mysql-5.0.51a-linux-i686 /usr/local/mysql
//初始化授权表
scripts/mysql_install_db --user=mysql
//修改MySQl目录的所有权
chown -R mysql.mysql /usr/local/mysql-5.0.51a-linux-i686
chown -R mysql.mysql /usr/local/mysql
//启动Mysql
/usr/local/mysql/bin/safe_mysqld --user=mysql &
//配置系统启动时自动启动MySQl
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
三 安装PHP
先安装zlib,freetype,libpng,jpeg以便于让PHP支持GD库(Cacti的WeatherMap插件必须要较新GD库的支持)
//下载需要的库
http://oss.oetiker.ch/rrdtool/pub/libs/ freetype-2.3.5.tar.gz,libpng-1.2.18.tar.gz,zlib-1.2.3.tar.gz
http://www.optix.org/~dxy/solaris/jpegsrc/ jpegsrc.v6b.tar.gz
http://www.libgd.org/releases/ gd-2.0.35.tar.gz
http://fontconfig.org/release/ fontconfig-2.6.0.tar.gz
1).安装zlib
tar zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install
2).安装libpng
tar zxvf libpng-1.2.18.tar.tar
cd libpng-1.2.18
cp scripts/makefile.linux ./makefile
make
make install
注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个
3).安装freetype
tar zxvf freetype-2.3.5 .tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype
make
make install
4).安装Jpeg
tar -zvxf jpegsrc-1.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参数,不然,不会生成共享库
5).安装Fontconfig
tar -zxvf fontconfig-2.6.0.tar.gz
cd fontconfig-2.6.0
./configure --with-freetype-config=/usr/local/freetype/bin/freetype-config
make
make install
6).安装GD
tar -zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/libgd --with-png --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg --with-jpeg=/usr/local/libjpeg --with-zlib-dir=/usr/local/zlib
make
make install
编译时显示以下信息:
** Configuration summary for gd 2.0.34:
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.
需要安装以下的软件包
gettext-0.14.6-4.el5.i386.rpm
gettext-devel-0.14.6-4.el5.i386.rpm
分别在第2,3张光盘里
7).编辑/etc/ld.so.conf,添加以下几行到此文件中。
/usr/local/zlib/lib
/usr/local/freetype/lib
/usr/local/libjpeg/lib
/usr/local/libgd/lib
并执行ldconfig命令,使用动态装入器装载找到共享库
8).安装PHP
PHP下载地址:http://www.php.net/downloads.php#v5
./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 --with-zlib-dir=/usr/local/zlib --enable-xml --enable-mbstring --enable-sockets
对于使用rpm安装的mysql,不需指定--with-mysql=/usr/local/mysql,而应该为--with-mysql
对php编译选项的解释:
--prefix=/usr/local/php //指定PHP的安装目录
--with-apxs2=/usr/local/apache2/bin/apxs //支持Apache模块
--with-mysql=/usr/local/mysql //支持MySQl
--with-gd=/usr/local/libgd //支持GD库
--enable-gd-native-ttf //激活对本地 TrueType 字符串函数的支持
--with-ttf //激活对 FreeType 1.x 的支持
--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-mbstring //激活mbstring模块
--enable-gd-jis-conv //使JIS-mapped可用,支持日文字体
--with-mail //支持Mail函数
--enable-xml //支持XML
--enable-sockets //支持套接字
make
make test (6)
make install
cp php.ini-recommended /usr/local/php/lib/php.ini
ln –s /usr/local/php/bin/* /usr/local/bin/
vi /usr/local/apache/conf/httpd.conf
查找AddType application/x-compress .Z
在其下加入
AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType image/x-icon .ico
修改DirectoryIndex 行,添加index.php
# vi /usr/local/apache/htdocs/test.php
添加以下行:
//php标记(用
页:
[1]