Linux99学习论坛-linux论坛|Linux系统论坛

 找回密码
 注册
搜索
查看: 1808|回复: 0

CentOS 5.5下源码安装配置Apache,PHP5.2.14,MySql

[复制链接]

91

主题

0

好友

411

积分

管理员

Rank: 9Rank: 9Rank: 9

金钱
317
主题
91
发表于 2011-4-21 14:58:49 |显示全部楼层
CentOS 5.5下源码安装配置Apache,PHP5.2.14,MySql
一、Apache安装
下载apache (http://httpd.apache.org/)到tmp
解压,tar –zxvf httpd-2.2.6.tar.gz
cd httpd-2.2.6
mkdir /usr/local/apache2
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-rewrite --enable-cache


make
make install
安装apache完成,输入命令 #/usr/local/apache2/bin/apachectl -k start
启动Apache
service httpd start

二、Mysql安装
到这里下载mysql RPM(service和client),
MySQL-server-community-5.1.51-1.rhel5.i386.rpm    安装服务端
MySQL-client-community-5.1.51-1.rhel5.i386.rpm     安装客户端
MySQL-devel-community-5.1.51-1.rhel5.i386.rpm     用于php的mysql安装
rpm –ivh MySQL-server-community-5.1.51-1.rhel5.i386.rpm
rpm –ivh MySQL-client-community-5.1.51-1.rhel5.i386.rpm
rpm –ivh MySQL-devel-community-5.1.51-1.rhel5.i386.rpm

三、安装PHP

1、下载相关安装包

PHP准备的tar包安装:
curl-7.15.0.tar.gz
freetype-2.3.5.tar.gz
gd-2.0.35.tar.gz
gettext-0.16.1.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.31.tar.bz2
libxml2-2.6.31.tar.gz
t1lib-5.0.0.tar.gz
tiff-3.8.2.tar.gz
zlib-1.2.3.tar.gz

2、下载地址:

#=== Apache 2.2.16
#=== URL: http://labs.renren.com/apache-mirror/httpd/
wget http://labs.renren.com/apache-mirror/httpd/httpd-2.2.16.tar.gz

#=== PHP 5.3.3
#=== URL: http://cn2.php.net/get/php-5.3.3.tar.gz/from/a/mirror
wget http://cn2.php.net/get/php-5.3.3.tar.gz/from/cn.php.net/mirror

#=== libxml2-2.7.7
#=== URL: ftp://xmlsoft.org/libxml2/
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz

#=== libxslt 1.1.22
#=== URL: http://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/
wget http://ftp.gnome.org/pub/GNOME/s ... bxslt-1.1.22.tar.gz

#=== MCrypt
#=== URL: http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/
wget http://nchc.dl.sourceforge.net/p ... mcrypt-2.6.8.tar.gz

#=== libmcrypt
#=== URL: http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/
wget http://nchc.dl.sourceforge.net/p ... mcrypt-2.5.8.tar.gz

#=== mhash
#=== URL: http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/
wget http://nchc.dl.sourceforge.net/p ... hash-0.9.9.9.tar.gz

#=== libiconv
#=== URL:  http://ftp.gnu.org/pub/gnu/libiconv/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz

#=== curl
#=== URL: http://curl.haxx.se/download.html
wget http://curl.haxx.se/download/curl-7.21.0.tar.gz

#=== zlib
#=== URL: http://zlib.net/
wget http://zlib.net/zlib-1.2.5.tar.gz

#=== freetype
#=== URL: http://nchc.dl.sourceforge.net/project/freetype/freetype2/
wget http://nchc.dl.sourceforge.net/p ... eetype-2.4.1.tar.gz

#=== fontconfig
#=== URL: http://www.fontconfig.org/release/
wget http://www.fontconfig.org/release/fontconfig-2.8.0.tar.gz

#=== GD2
#=== URL: http://www.libgd.org/releases/
wget http://www.libgd.org/releases/gd-2.0.36RC1.tar.gz

#=== libpng
#=== URL: http://nchc.dl.sourceforge.net/p ... bpng-stable/1.2.42/
wget http://nchc.dl.sourceforge.net/p ... ibpng-1.2.42.tar.gz

#==== Devl URL: http://nchc.dl.sourceforge.net/project/libpng/02-libpng-devel/
#wget http://nchc.dl.sourceforge.net/p ... -1.5.0beta16.tar.gz

#=== libjpeg v6b
#=== URL: http://nchc.dl.sourceforge.net/project/libjpeg/libjpeg/6b/
wget http://nchc.dl.sourceforge.net/p ... /jpegsrc.v6b.tar.gz

#=== libgif
#=== URL: http://sourceforge.net/projects/giflib/files/
wget http://sourceforge.net/projects/ ... 1.6.tar.gz/download

#=== MySQL
#=== URL: http://www.mysql.com/downloads/mysql/#downloads
wget http://dev.mysql.com/get/Downloa ... //mysql.ntu.edu.tw/

#=== PAM-Mysql
#=== URL: http://pam-mysql.sourceforge.net/
wget http://prdownloads.sourceforge.n ... mysql-0.7RC1.tar.gz

#=== cronolog
#=== URL: http://cronolog.org/
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz

#=== Xcache
#=== URL: http://xcache.lighttpd.net/
wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz



3、安装包

3.1 安装curl-7.15.0.tar.gz
      #tar zxvf curl-7.15.0.tar.gz
      #cd curl-7.15.0
      #mkdir /usr/local/crul
      #./configure --prefix=/usr/local/curl
      #make clean
      #make
      #make install
3.2 jpegsrc.v6b.tar.gz
      #mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}
      #./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
      #make clean
      #make
      #make install



其中在安装jpegsrc.v6b.tar.gz包执行./configure 安装的时候提示如下的错误

checking host system type… Invalid configuration `x86_64-unknown-linux-gnu’: machine `x86_64-unknown’ not recognized

解决方案:
把 /usr/share/libtool/config.guess 覆盖到相关软件自带的config.guess
把 /usr/share/libtool/config.sub 覆盖到相关软件自带的config.sub
./configure –enable-shared –enable-static


3.3 libxml2-2.6.31.tar.gz
      #tar zxvf libxml2-2.6.31.tar.gz
      #cd libxml2
      #mkdir usr/local/libxml2
      #./configure --prefix=/usr/local/libxml2
      #make clean
      #make(时间可能稍长些)
      #make install
      #cp xml2-config /usr/bin
3.4 PDFlib-7.0.3-Linux-php.tar.gz
      #tar xvf PDFlib-7.0.3-Linux-php.tar.gz
      #cd pdflib
      #cp bind/php5/php520mt/libpdf-php.so /usr/local/lib/
      (上面的php520mt目录的同级目录中有php503,php510,php520目录,不知道是不是版本的区别)
3.5 t1lib-5.0.0.tar.gz
      #tar zxvf t1lib-5.0.0.tar.gz
      #cd t1lib
      #mkdir /usr/local/t1lib
      #./configure --prefix=/usr/local/t1lib
      #make without-doc
      #make install
3.6 freetype-2.3.5.tar.gz
      #tar zxvf freetype-2.3.5.tar.gz
      #cd freetype
      # mkdir /usr/local/freetype
      #./configure --prefix=/usr/local/freetype
      #make clean
      #make
      #make install
3.7 zlib-1.2.3.tar.gz
      #tar zxvf zlib-1.2.3.tar.gz
      #cd zlib-1.2.3
      #./configure --shared
      #make clean
      #make
      #make install
3.8 libpng-1.2.26.tar.gz
      #tar zxvf libpng-1.2.26.tar.gz
      #cd libpng
      #cp scripts/makefile.linux ./makefile
      #mkdir /usr/local/libpng
      #./configure --prefix=/usr/local/libpng
      #make clean
      #make
      #make install
3.9 gettext-0.16.tar.gz
      #tar zxvf gettext-0.16.tar.gz
      #cd gettext
      #mkdir /usr/local/gettext
      #./configure --prefix=/usr/local/gettext
      #make clean
      #make
      #make install(时间稍长)
3.10 gd-2.0.35.tar.gz
      #tar zxvf gd-2.0.35.tar.gz
      #cd gd
      #./configure --with-png=/usr/local/lib --with-zlib=/usr/local/lib --with-freetype=/usr/local/freetype/lib --with-jpeg=/usr/local/jpeg/lib
      #make clean
      #make
      #make install



四、安装PHP
下载php-5.2.14
tar gxvf php-5.2.14.tar.bz2
cd php-5.2.14
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-track-vars --with-sockets --enable-sockets --with-sysvshm --with-sysvsem --with-pdflib-dir=/usr/local/lib --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/lib --enable-mbstring=all --with-zlib-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype --with-curl=/usr/local/curl --with-libxml-dir=/usr/local/libxml2/lib --with-gettext=/usr/local/gettext/lib --with-gd --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config
#make clean
#make
#make test
# make install
Php.ini文件的修改
#cp php.ini-production /usr/local/lib/php.ini
#vi /usr/local/lib/php.ini
查找修改extension_dir='./'的内容(如下)
extension_dir = /usr/local/lib
添加PHP的环境变量:
临时的 #export PATH=$PATH:/usr/local/php/bin
永久性的:在/etc下有个profile的文件,将其打开把“export PATH=$PATH:/usr/local/php/bin”这句放在“export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC”的上一行
立即生效环境配置,不需要重启,用下命令:
. /etc/profile

五、修改apache配置文件httpd.conf
       #vi /usr/local/apache2/conf/httpd.conf
       查找AddType 大约在DefaultType text/plain
       <IfModule mime_module>
       输入如下内容
       AddType application/x-httpd-php .htm
       AddType application/x-httpd-php .html
       AddType application/x-httpd-php .phtml
       AddType application/x-httpd-php .php
       (不清楚是不是必须输入这么多项)
查找DirectoryIndex index.html 在其后输入 index.php
查找确保有如下两行配置:
LoadModule php5_module        modules/libphp5.so
LoadModule rewrite_module modules/mod_rewrite.so
保存文件,退出。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

关于我们|Archiver||Linux99学习论坛    

GMT+8, 2013-4-8 14:24 , Processed in 0.098911 second(s), 25 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部