(一)安装 mysql
mysql
======================
[root@localhost soft]# mv mysql-5.1.16-beta-linux-x86_64-glibc23 /usr/local/mysql
[root@localhost soft]# groupadd mysql
[root@localhost soft]# useradd -g mysql mysql
[root@localhost soft]# mkdir /db
[root@localhost soft]# cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf
[root@localhost soft]# vi /etc/my.cnf
[mysqld]
datadir = /db
[root@localhost soft]# cd /usr/local/mysql/
[root@localhost mysql]# chown mysql.mysql /db/ -R
[root@localhost mysql]# scripts/mysql_install_db
[root@localhost mysql]# ll /db/
[root@localhost mysql]# chown mysql.mysql /db/ -R
[root@localhost mysql]# cp support-files/mysql.server /usr/local/bin/
[root@localhost mysql]# mysql.server start
[root@localhost mysql]# mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO ztgame IDENTIFIED BY 'G-zt.wiki123' WITH GRANT OPTION;
mysql> delete from mysql.user where password="";
mysql> flush privileges;
[root@localhost mysql]# mysql -uztgame -p
(二)安装 Apache
apache
======================
[root@localhost httpd-2.2.10]# uname -a
Linux localhost.localdomain 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST 2006 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost httpd-2.2.10]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
[root@localhost httpd-2.2.10]# make
[root@localhost httpd-2.2.10]# make install
[root@localhost httpd-2.2.10]# vi /usr/local/apache/conf/httpd.conf
ServerAdmin
ServerName 127.0.0.1:80
[root@localhost httpd-2.2.10]# /usr/local/apache/bin/apachectl start
[root@localhost httpd-2.2.10]# telnet localhost 80
[root@localhost httpd-2.2.10]# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
[root@localhost httpd-2.2.10]# iptables-save > /etc/sysconfig/iptables
(三)GD 及相关包的安装
GD
======================
freetype
----------------------
[root@localhost freetype-2.3.5]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/freetype
[root@localhost freetype-2.3.5]# make
[root@localhost freetype-2.3.5]# make install
fontconfig
----------------------
[root@localhost fontconfig-2.4.2]# CFLAGS="-O3 -fPIC" ./configure --with-freetype=/usr/local/freetype
[root@localhost fontconfig-2.4.2]# make
[root@localhost fontconfig-2.4.2]# make install
zlib
----------------------
[root@localhost zlib-1.2.3]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib
[root@localhost zlib-1.2.3]# make
[root@localhost zlib-1.2.3]# make install
libpng
----------------------
[root@localhost libpng-1.2.18]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libpng
[root@localhost libpng-1.2.18]# make
[root@localhost libpng-1.2.18]# make install
jpeg
----------------------
[root@localhost jpeg-6b]# mkdir /usr/local/libjpeg
[root@localhost jpeg-6b]# mkdir /usr/local/libjpeg/include
[root@localhost jpeg-6b]# mkdir /usr/local/libjpeg/bin
[root@localhost jpeg-6b]# mkdir /usr/local/libjpeg/lib
[root@localhost jpeg-6b]# mkdir /usr/local/libjpeg/man/man1 -p
[root@localhost jpeg-6b]# cp /usr/share/libtool/config.guess .
[root@localhost jpeg-6b]# cp /usr/share/libtool/config.sub .
[root@localhost jpeg-6b]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
[root@localhost jpeg-6b]# make libdir=/usr/lib64
[root@localhost jpeg-6b]# make libdir=/usr/lib64 install
gd
----------------------
[root@localhost gd-2.0.33]# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg
[root@localhost gd-2.0.33]# vi Makefile
CPPFLAGS = -I/usr/local/freetype/include/freetype2 -I/usr/local/freetype/include -I/usr/local/freetype/include -I/usr/local/libjpeg/include -I/usr/local/libpng/include
[root@localhost gd-2.0.33]# make
[root@localhost gd-2.0.33]# make install
(四)PHP安装
PHP
==========================
load share modules:
---------------------
[root@localhost gd]# vi /etc/ld.so.conf
/usr/local/zlib/lib
/usr/local/freetype/lib
/usr/local/libjpeg/lib
/usr/local/libgd/lib
libxml2
----------------------
[root@localhost libxml2-2.6.32]# CFLAGS="-O3 -fPIC" ./configure
[root@localhost libxml2-2.6.32]# make
[root@localhost libxml2-2.6.32]# make install
php
----------------------
[root@localhost php-5.2.6]# cp /usr/lib64/libjpeg.a /usr/local/libjpeg/lib
[root@localhost php-5.2.6]# cp /usr/lib64/libjpeg.so /usr/local/libjpeg/lib
[root@localhost php-5.2.6]# CFLAGS="-O3 -fPIC" ./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-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --with-zlib-dir=/usr/local/zlib --enable-xml --enable-mbstring --enable-sockets
[root@localhost php-5.2.6]# make
[root@localhost php-5.2.6]# make test
[root@localhost php-5.2.6]# make install
[root@localhost php-5.2.6]# ln -s /usr/local/php/bin/* /usr/local/bin/
[root@localhost php-5.2.6]# cp php.ini-recommended /usr/local/php/lib/php.ini
[root@localhost php-5.2.6]# vi /usr/local/php/lib/php.ini
shot_open_tag = On
[root@localhost php-5.2.6]# vi /usr/local/apache/conf/httpd.conf
DirectoryIndex index.html index.php
AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType image/x-icon .ico
测试:
============================
[root@localhost php-5.2.6]# vi /usr/local/apache/htdocs/test.php
[root@localhost php-5.2.6]# /usr/local/apache/bin/apachectl restart
重新编译PHP,添加LDAP支持:
============================
[root@localhost ~]# ln -s /usr/lib64/libldap.a /usr/lib
[root@localhost ~]# ln -s /usr/lib64/libldap.so /usr/lib
[root@localhost ~]# CFLAGS="-O3 -fPIC" ./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-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --with-zlib-dir=/usr/local/zlib --enable-xml --enable-mbstring --enable-sockets --with-ldap --with-ldap-sasl
[root@localhost ~]# make
[root@localhost ~]# make test
[root@localhost ~]# make install
完成!
阅读(1137) | 评论(1) | 转发(0) |