Linux AS4 Apache2.2.6 + PHP5.2.5 + Mysql5.0.45 配置
软件准备:
1. Apache2.2.6 http://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.gz
2. PHP5.2.5 http://cn.php.net/get/php-5.2.5.tar.gz/from/cn2.php.net/mirror
3. Mysql5.0.45 http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.45-linux-i686-glibc23.tar.gz/from/http://mirror.mysql-partners-jp.biz/
4. gd-2.0.35 http://www.libgd.org/releases/gd-2.0.35.tar.gz
5. zlib1.2.3 http://downloads.sourceforge.net/libpng/zlib-1.2.3.tar.gz?modtime=1121680730&big_mirror=0
6. libpng1.2.24 http://downloads.sourceforge.net/libpng/libpng-1.2.24.tar.gz?modtime=1197632021&big_mirror=0
7. jpeg-6b ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
8. freetype2.3.5 http://downloads.sourceforge.net/freetype/freetype-2.3.5.tar.gz?modtime=1183336047&big_mirror=0
9. fontconfig2.5.0 http://www.fontconfig.org/release/fontconfig-2.5.0.tar.gz
10. openssl0.9.8g http://www.openssl.org/source/openssl-0.9.8g.tar.gz
11. libxml2.2.6.30 http://ftp.acc.umu.se/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.30.tar.gz
12. libxslt1.1.22 http://ftp.acc.umu.se/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.22.tar.gz
13. libmcrypt-2.5.8 http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0
14. curl-7.17.1 http://curl.haxx.se/download/curl-7.17.1.tar.gz
安装软件:
Openssl
tar zxvf openssl-0.9.8g.tar.gz
cd openssl-0.9.8g
./config –prefix=/usr/local/openssl
make
make install
Zlib
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure –prefix=/usr/local/zlib
make
make install
Libpng
tar zxvf libpng-1.2.24.tar.gz
cd libpng-1.2.24
./configure –prefix=/usr/local/libpng
make
make install
Freetype
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure –prefix=/usr/local/freetype
make
make install
Jpeg
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/man/
mkdir /usr/local/jpeg/man/man1/
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure –prefix=/usr/local/jpeg –enable-shared –enable-static
make
make test
make install
Fontconfig
tar zxvf jpegsrc.fontconfig-2.5.0.tar.gz
cd fontconfig-2.5.0
./configure –prefix=/usr/local/fontconfig –disable-docs –sysconfdir=/etc –mandir=/usr/share/man
make
make install
Gd
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure –prefix=/usr/local/gd/ –with-zlib=/usr/local/zlib/ –with-png=/usr/local/libpng/ –with-jpeg=/usr/local/jpeg/ –with-freetype=/usr/local/freetype/ –with-fontconfig=/usr/local/fontconfig
make
make install
Libxml
tar zxvf libxml2-2.6.30.tar.gz
cd libxml2-2.6.30
./configure –prefix=/usr/local/libxml
make
make install
Libxslt
tar zxvf libxslt-1.1.22.tar.gz
cd libxslt-1.1.22
./configure –prefix=/usr/local/libxslt –with-libxml-prefix=/usr/local/libxml
make
make install
libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure –prefix=/usr/local/libmcrypt
make
make install
Curl
tar zxvf curl-7.17.1.tar.gz
cd curl-7.17.1
./configure –prefix=/usr/local/curl –enable-shared –enable-http –enable-file –enable-libgcc –enable-ftp –enable-thread –enable-cookies –enable-ldaps –with-ssl=/usr/local/openssl/ –with-zlib=/usr/local/zlib
make
make install
Mysql
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /home/mysql-5.0.45-i686-glibc23.tar.gz | tar xvf -
shell> ln -s ./mysql-5.0.45-i686-glibc23 mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe –user=mysql &
设置root密码:
shell> /usr/local/mysql/bin/mysqladmin -u root password ‘root’
自启动:
cd /etc/rc.d/init.d
cp /usr/local/mysql/support-files/mysql.server mysql
chmod +x mysql
/sbin/chkconfig –del mysql
/sbin/chkconfig –add mysql
cd /usr/local/bin
ln -fs /usr/local/mysql/bin/mysql mysql
Apache
tar zxvf http-2.2.6.tar.gz
cd http-2.2.6
./configure –prefix=/usr/local/apache –enable-auth-anon –enable-auth-dbm –enable-cache –enable-disk-cache –enable-expires –enable-file-cache –enable-headers –enable-info –enable-logio –enable-mem-cache –enable-proxy –enable-rewrite –enable-ssl –with-ssl=/usr/local/openssl -enable-unique-id –enable-usertrack –enable-vhost-alias –enable-mods-shared=most
make
make install
Php
tar zxvf php-5.2.5.tar.gz
cd php-5.2.5
./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php –with-mysqli=/usr/local/mysql/bin/mysql_config –with-mysql=/usr/local/mysql –with-apxs2=/usr/local/apache/bin/apxs –with-openssl-dir=/usr/local/openssl –with-expat-dir=/usr/lib –with-mcrypt=/usr/local/libmcrypt –enable-xslt –enable-pdo –with-pdo-mysql=/usr/local/mysql –enable-mbstring –with-gd=/usr/local/gd/ –with-jpeg-dir=/usr/local/jpeg/ –with-zlib-dir=/usr/local/zlib/ –with-png-dir=/usr/local/libpng/ –with-freetype-dir=/usr/local/freetype/ –with-mime-magic –with-png –with-xml –with-iconv –enable-gd-native-ttf –enable-ftp –enable-embed –enable-fastcgi –enable-calendar –enable-magic-quotes –enable-track-vars –enable-sockets –enable-soap –enable-pcntl –enable-mbstring=all –enable-mbregex –with-libxml-dir=/usr/local/libxml –with-xsl=/usr/local/libxslt/ –with-curl-dir=/usr/local/curl
make
make test
make install
配置php
cp php.ini-dist /usr/local/php/php.ini
配置Apache
vi /usr/local/apache/conf/httpd.conf
在LoadModule处添加:
LoadModule php5_module /usr/local/php/lib/libphp5.so
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
重启apache
# /usr/local/apache/bin/apachectl restart
让apache自动启动
1. 将apachectl文件拷贝到/etc/rc.d/init.d 中,然后在/etc/rc.d/rc5.d/下加入链接即可。
命令如下:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd
2. 运行chkconfig –list,发现没有linux服务列表中httpd,通过chkconfig –add httpd来添加,但是提示:httpd服务不支持 chkconfig。需要编辑/etc/rc.d/init.d/httpd,添加以下注释信息:
# chkconfig: 345 85 15
# descrīption: Apache
第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)。
保存后执行:chkconfig –add httpd,成功添加。
在rc3.d、rc4.d、rc5.d路径中会出现S85httpd的链接文件,其他运行级别路径中会出现K61httpd的链接文件。
3. 运行chkconfig –list,httpd在其中。