分类: LINUX
2010-07-16 14:07:22
以下操作步骤是在 Red Hat Linux ES 3.6 版本上测试
一.
1.软件
httpd-2.2.3.tar.gz
mysql-max-5.0.26-linux-i686-glibc23.tar.gz
php-5.1.4.tar.gz
gzip-1.2.4.tar.gz
libxml2-2.6.26.tar.gz
zlib-1.1.3.tar.gz 或 zlib-1.2.3.tar.gz
curl-7.15.0.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.12.tar.gz
freetype-2.1.1.tar.gz
gd-2.0.33.tar.gz
2.curl安装
http://curl.haxx.se/download.html
进入curl目录,执行
./configure --prefix=/usr/local/curl
make
make install
3.gzip安装
进入gzip目录,执行
mkdir -p /usr/local/gzip
./configure --prefix=/usr/local/gzip
make
make install
4.libxml2安装
进入libxml2目录,执行
./configure --prefix=/usr/local/libxml2
make
make install
6.apache2安装
进入httpd目录,执行
./configure --prefix=/usr/local/apache2
--enable-module=most
--enable-shared=max
-enable-so
make
make install
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
/etc/rc.d/init.d/httpd
注意,最后一个命令是让apache2编译出所有的so文件,apache2以DSO模式运行。
7.安装mysql5
mysql5是不用编译的,从他们网站下的就是已经编译好的,你可以直接使用,把解压出来的mysql5目录cp到/usr/local/mysql目录。
tar -zxvf mysql-max-5.0.26-linux-i686-glibc23.tar.gz
mv mysql-max-5.0.26-linux-i686-glibc23 /usr/local/mysql
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
cd /usr/local/mysql
cp support-files/my-medium.cnf /etc/my.cnf
./scripts/mysql_install_db --user=mysql
chown -R root
chown -R mysql data
chgrp -R mysql .
./bin/mysqld_safe --user=mysql &
./bin/mysqladmin -u root password "123456"
rm -rf /etc/rc.d/init.d/mysqld
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
/etc/rc.d/init.d/mysqld start
8.安装 jpeg6
CODE:
建立目录:
mkdir -p /usr/local/jpeg6
mkdir -p /usr/local/jpeg6/bin
mkdir -p /usr/local/jpeg6/lib
mkdir -p /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man
mkdir -p /usr/local/jpeg6/man1
mkdir -p /usr/local/jpeg6/man/man1
tar -zvxf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/
--enable-shared
--enable-static
make
make install
9.安装libpng
tar -zvxf libpng-1.2.12.tar.gz
cd libpng-1.2.12
./configure --prefix=/usr/local/libpng/
make
make install
10.安装 freetype
tar -zvxf freetype-2.1.1.tar.gz
cd freetype-2.1.1
mkdir -p /usr/local/freetype
./configure --prefix=/usr/local/freetype
make && make install
11.安装GD库
tar -zvxf gd-2.0.33.tar.gz
mkdir -p /usr/local/gd2
cd gd-2.0.33
./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/
--with-png=/usr/local/lib/
--with-zlib=/usr/local/lib/
--with-freetype=/usr/local/freetype/
make
make install
12.php5安装
进入php5目录,执行
./configure --prefix=/usr/local/php5
--with-apxs2=/usr/local/apache2/bin/apxs
--with-freetype-dir=/usr/local/freetype
--enable-trace-avrs
--with-mysql=/usr/local/mysql
--with-zlib-dir=/usr/local/zlib
--with-libxml-dir=/usr/local/libxml2
--enable-shared
--with-curl=/usr/local/curl
--with-gd=/usr/local/gd2
--with-jpeg-dir=/usr/local/jpeg6
--with-png=/usr/local/libpng
--enable-mbstring=all
--enable-mbregex
--enable-so
--enable-ftp
make
make install
cp php.ini-dist /usr/local/php5/lib/php.ini
其中./configure 后的
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/mysql5/
--with-libxml-dir=/usr/local/libxml2
是必要的选项
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-png=/usr/local/lib
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype
这是让PHP支持GD库的配置选项
--with-curl=/usr/local/curl 支持CURL库
--enable-ftp 打开FTP库函数支持
--enable-soap --with-xsl=/usr/local/libxslt --enable-xslt
让PHP支持SOAP, 上面这些一般用得少, 可以去掉
#
在
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
下添加:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重新启动 Apache 服务;
#
三.其它
安装ZendOptimizer加速PHP
tar zxvf ZendOptimizer-2.6.2-linux-glibc21-i386.tar.gz
cd ZendOptimizer-2.6.2-linux-glibc21-i386.tar.gz
./install.sh
注意:忘了mysql的root口令怎么办
# /usr/local/mysql/support-files/mysql.server stop
# mysqld_safe --skip-grant-tables &
# mysqladmin -u user password 'newpassword'
# mysqladmin flush-privileges
让mysql 与 apache 在系统启动时自动运行
编辑/etc/rc.d/rc.local 文件
增加如下二行:
/etc/rc.d/init.d/httpd
/etc/rc.d/init.d/mysqld