2)安装Apache(httpd-2.2.17.tar.bz2)
|
# tar -zxvf httpd-2.2.17.tar.bz2 |
说明:
--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 |
对下面的内容在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 --level 345 httpd on
注意:可能出现的问题 # chkconfig --add httpd service httpd does not support chkconfig httpd服务不支持 chkconfig。需要编辑/etc/rc.d/init.d/httpd,添加以下注释信息:
|
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 |
3).ii).安装libpng(libpng-1.2.18.tar.gz)
|
# tar -zxvf libpng-1.2.18.tar.gz
【出错的话: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 |
3).iv).安装jpeg(jpegsrc.v6b.tar.gz)
|
# tar -zxvf jpegsrc.v6b.tar.gz |
注意,这里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
注意: 问题一: checking for LIBXML2... configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:
解决方案:报错的话,应该需要安装libxml2-2.6.32.tar.gz 如果还有错误的话 确定 /usr/local/libxml2/lib/pkgconfig 目录下有 libxml-2.0.pc
另外出现问题: 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
|
编译成功后会显示以下信息** 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 |
3).ix).安装php(php-5.3.5.tar.bz2)
|
# tar -jxvf php-5.2.10.tar.bz2 |
|
注意:该版本去掉--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目录
|
说明:
--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 & 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();
?>
另外还可能遇到一些关于时间的问题,我们都可以在网上找到解决的办法
