我的系统环境为:CentOS 64位操作系统
服务器为Dell 1950服务器
由于我全是用源代码安装,大多适用于其它的操作系统
由于CentOS与redhat的关系,基本是适用于redhat linux as 5
下载相关软件
wget http://www.zlib.net/zlib-1.2.3.tar.gz
wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
wget http://download.savannah.gnu.org ... eetype-2.3.5.tar.gz
wget ftp://ftp.simplesystems.org/pub/ ... ibpng-1.2.18.tar.gz
wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
我全部是下载源代码编译方式进行安装的
一、先安装Mysql
groupadd mysql
useradd -g mysql mysql
tar zxvf mysql-5.0.45.tar.gz
cd mysql-5.0.45
./configure --prefix=/usr/local/mysql
make
make install clean
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
chown -R mysql . //后面有个点号,要注意了!
chgrp -R mysql . //后面有个点号,要注意了!
bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql var
bin/mysqld_safe --user=mysql &
如果没有出错的话,这里Mysql应该可以正常启动了。
如果编译时出现了以下错误:
checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap library found
说明 curses/termcap 库没有安装
去下载一个ncurses-5.6.tar.gz,
wget
http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6
./configure --prefix=/usr --with-shared --without-debug
make
make install clean
然后再重新编译Mysql进行安装。
二、安装GD库和GD库所需的环境
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install clean
如果编译的时候出现
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
错误,解决办法请点击查看
tar zxvf libpng-1.2.18.tar.gz
cd libpng-1.2.18
./configure
make
make install clean
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure
make
make install clean
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure
make
make install-lib
如果在编译的时候出现
/usr/bin/ld: /usr/local/lib/libjpeg.a(jcapimin.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
错误,解决办法请点击查看
如果以上软件都安装成功了,就可以开始安装GD了
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --with-png --with-freetype --with-jpeg
编译的时候,最后结果那里可以看到
** 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: no
Support for Xpm library: no
Support for pthreads: yes
可以看到png 、 jpeg 、 freetype都已经安装上了
三、安装Apache2.2.4
tar zxvf httpd-2.2.4.tar.gz
cd httpd-2.2.4
./configure --prefix=/usr/local/apache22 --enable-rewrite=shared --enable-speling=shared --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all
make
make install clean
安装完后使用/usr/local/apache22/bin/apachectl -k start可以启动
四、安装PHP5.2.3
tar zxvf php-5.2.3.tar.gz
cd php-5.2.3
./configure --prefix=/usr/local/php5 --with-mysql-dir=/usr/local/mysql --with-apxs2=/usr/local/apache22/bin/apxs --with-jpeg --with-freetype --enable-trace-vars --with-zlib --with-gd --enable-ftp --enable-sockets
make
make install
make clean
cp php.ini-dist /usr/local/php5/lib/php.ini
配置 httpd.conf 让apache支持PHP
vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重启Apache
/usr/local/apache22/bin/apachectl -k restart
编辑一个PHP页面进行测试一下phpinfo.php
<?php
phpinfo();
?>
五、安装Zend
去官方网站下载ZendOptimizer-3.3.0a-linux-glibc23-x86_64.tar.gz
tar zxvf ZendOptimizer-3.3.0a-linux-glibc23-x86_64.tar.gz
cd ZendOptimizer-3.3.0a-linux-glibc23-x86_64
./install.sh
根据提示安装
注意配置好PHP.ini文件的路径和Apache的Apachectl文件的路径
完成安装!