Apache+SSL+PHP+JSP+MySQL+IMAP+GD安装全攻略

发表于:2007-06-21来源:作者:点击数: 标签:
在RedHat 7.2上,假设所有安装程序包都下在/pub下面,源码包都用红色表示, 假设在te .net 或ssh文本界面下进行如下所有操作。 1. Install target=_blankJ2SDK 1.4 1. 下载 J2SDK1.4 的 Linux RPM版本 j2sdk-1_4_0- linux -i386-rpm.bin 2. cd /pub 3. chmod

   
  在RedHat 7.2上,假设所有安装程序包都下在/pub下面,源码包都用红色表示,

假设在te.net或ssh文本界面下进行如下所有操作。


1. Install
target=_blank>J2SDK 1.4

1. 下载 J2SDK1.4 的 Linux RPM版本 j2sdk-1_4_0-linux-i386-rpm.bin
2. cd /pub
3. chmod +x j2sdk-1_4_0-linux-i386-rpm.bin
4. ./j2sdk-1_4_0-linux-i386-rpm.bin
5. rpm -ivh j2sdk-1_4_0-fcs-linux-i386.rpm
6. vi /etc/profile 增加如下内容:

JAVA_HOME=/usr/java/j2sdk1.4.0

export JAVA_HOME

CLASSPATH=/usr/java/j2sdk1.4.0/lib:/usr/java/j2sdk1.4.0/jre/lib

export CLASSPATH

PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

export PATH
7. 重新登录让环境变量生效

2. Install
target=_blank>Tomcat 4.0

1. 下载Tomcat的linux binary版本,以及 mod_webapp.so
2. tar zxvf jakarta-tomcat-4.0.3.tar.gz

3. 做 /pub/jakarta-tomcat-4.0.3/conf 目录下面server.xml中的其他相关配置
(暂时不做也可以)
4. /pub/jakarta-tomcat-4.0.3/bin/startup.sh

启动 Tomcat 服务,并且将它加到系统的启动程序中/etc/rc.d/rc.local

(用/pub/jakarta-tomcat-4.0.3/bin/shutdown.sh
停止Tomcat )




3. Install
target=_blank>MySQL

1. groupadd mysql
2. useradd -g mysql mysql
3. tar zxvf mysql-3.23.49.tar.gz
(or, gunzip < mysql-3.23.49.tar.gz | tar xvf -)
4. cd mysql-3.23.49
5. ./configure --prefix=/usr/local/mysql
6. make
7. make install
8. scripts/mysql_install_db
9. chown -R root /usr/local/mysql
10. chown -R mysql /usr/local/mysql/var
11. chgrp -R mysql /usr/local/mysql
12. cp support-files/my-medium.cnf /etc/my.cnf
13. cp scripts /usr/local/mysql -R
14. cp support-files /usr/local/mysql -R
15. cd /usr/local/mysql
16. chmod +x support-files/mysql.server
17. cp support-files/mysql.server /etc/rc.d/init.d/mysqld

同时要设置 /etc/rc.d/init.d/mysqld 开机自动运行:

ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/S99mysqld


18. /etc/rc.d/init.d/mysqld start

启动 MySQL
19. /usr/local/mysql/bin/mysqladmin -u root password
ew-password

设置 MySQL root 口令

4. Install
target=_blank>OpenSSL

1. cd /pub
2. tar zxvf openssl-0.9.6b.tar.gz
3. cd openssl-0.9.6b
4. ./config
5. make
6. make test
7. make install

5. Install
target=_blank>mod_ssl

1. cd /pub
2. tar zxvf mod_ssl-2.8.8-1.3.24.tar.gz

3. tar zxvf apache_1.3.24.tar.gz
(from www.apache.org)

4. cd mod_ssl-2.8.8-1.3.24
5. ./configure --with-apache=../apache_1.3.24
6. cd ../apache_1.3.24
7. ./configure --prefix=/www

6. Install
href="ftp://ftp.cac.washington.edu/imap/" target=_blank>IMAP support

1. cd /pub
2. tar zxvf imap-2001a.tar.Z

3. cd imap-2001a
4. make slx (for Linux)
5. 修改 /etc/services 注册端口,修改 /etc/inetd.conf 开启服务
6. cp c-client/c-client.a /usr/local/lib/libc-client.a

7. cp c-client/rfc822.h /usr/local/include
8. cp c-client/mail.h /usr/local/include
9. cp c-client/linkage.h /usr/local/include

7. Install
target=_blank>CURL support

1. cd /pub
2. tar zxvf curl-7.9.6.tar.gz

3. cd curl-7.9.6
4. ./configure --with-ssl --with-prefix=/usr/local/curl

5. make
6. make test
7. make install

8. Install
target=_blank>GD support

1. Install
target=_blank>zlib support

1. cd /pub
2. tar zxvf zlib-1.1.3.tar.gz

3. cd zlib-1.1.3
4. ./configure
5. make
6. make test
7. make install

2. Install
target=_blank>libpng support

1. cd /pub
2. tar zxvf libpng-1.0.10.tar.gz

3. cd libpng-1.0.10
4. cp scripts/makefile.linux makefile
5. vi makefile

修改其中

ZLIBLIB=/usr/local/lib

ZLIBINC=/usr/local/include

参数
6. make test
7. make install

3. Install jpeg-6b
support

1. cd /pub
2. tar zxvf jpegsrc.v6b.tar.gz

3. cd jpeg-6b
4. ./configure
5. make
6. make test
7. make install
8. make install-lib

4. Install FreeType
2.0.1 support

1. cd /pub
2. tar zxvf freetype-2.0.1.tar.gz

3. cd freetype-2.0.1
4. make setup
5. make
6. make install

5. Install GD
support

1. cd /pub
2. tar zxvf gd-1.8.4.tar.gz

3. cd gd-1.8.4
4. vi Makefile

修改其中

CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE

LIBS=-lgd -lpng -lz -ljpeg -lfreetype -lm

INCLUDEDIRS=-I. -I/usr/local/include/freetype2 -I/usr/include/X11
-I/usr/X11R6/include/X11 -I/usr/local/include
5. make
6. make install


9. Install
target=_blank>PHP

1. cd /pub
2. tar zxvf php-4.2.0.tar.gz

3. cd php-4.2.0
4.

















CFLAGS=-O2 -I/usr/local/ssl/include
./configure --with-apache=../apache_1.3.24
--enable-memory-limit=yes
--with-config-file-path=/usr/local/lib --with-imap --enable-ftp
--with-mysql=/usr/local/mysql
--enable-sockets --enable-debug=no --enable-track-vars
--with-gd=/usr/local
--with-jpeg-dir=/usr/local --with-png-dir=/usr/local
--with-curl=/usr/local/curl
--with-zlib --with-ttf --with-java

5. make
6. make install
7. cp php.ini-dist /usr/local/lib/php.ini
8. 修改 /usr/local/lib/php.ini

10.


Install
target=_blank>Zend Optimizer (这步可在最后完成)



1. cd /pub
2. tar zxvf ZendOptimizer-1[1].2.0-PHP_4.1.0-Linux_glibc21-i386.tar.gz
3. cd ZendOptimizer-1.2.0-PHP_4.1.0-Linux_glibc21-i386
4. mkdir /usr/local/Zend
5. mkdir /usr/local/Zend/lib
6. ./install.sh

11. Install
target=_blank>Zend Cache (用在等于或低于 PHP 4.0.5版本,要注册码,这步可在最后完成)

1. cd /pub
2. tar zxvf ZendCache-1[1].1.0b-PHP_4.0.5-Linux_glibc2.1-i386.tar.gz
3. cd ZendCache-1.1.0b-PHP_4.0.5-Linux_glibc2.1-i386
4. cp data/ZendCache.so /usr/local/Zend/lib
5. ( cp zend_cache.dat /usr/local/Zend ) // to register
license
6. Add the following lines to your php.ini file;
do not add any extra spaces or tabs; must after Zend Optimizer configuration:


zend_cache.use_cwd=1

zend_cache.memory_consumption=16 ; 16MB

zend_cache.validate_timestamps=1

zend_extension="/usr/local/Zend/lib/ZendCache.so"


12. Install Zend
Aclearcase/" target="_blank" >ccelerator (用在php 4.0.5以上php 4.2.0以下,要注册码哦,这步可在最后完成)

1. cd /pub
2. tar xvf ZendAccelerator-2.0.0-PHP_4.0.5-Linux_glibc21-i386.tar
3. cd ZendAccelerator-2.0.0-PHP_4.0.5-Linux_glibc21-i386
4. ./install.sh




13. Install Apache

1. cd ../apache_1.3.24
2.








SSL_BASE=/usr/local/ssl ./configure
--prefix=/www --enable-module=ssl --enable-module=so
--activate-module=src/modules/php4/libphp4.a
--enable-rule=SSL_SDBM --enable-module=rewrite


3. make
4. make certificate
5. make install
6. 修改 /www/conf/httpd.conf,

Options Indexes FollowSymLinks MultiViews -> Options FollowSymLinks MultiViews


DirectoryIndex index.html -> DirectoryIndex index.html index.php3 index.php


增加

LoadModule webapp_module libexec/mod_webapp.so

WebAppConnection warpConnection warp localhost:8008

WebAppDeploy examples warpConnection /examples/
7. vi /www/conf/mime.types 增加

application/x-httpd-php php php3


8. 拷贝下载的 mod_webapp.so 到 /www/libexec
9. 启动Apache

/www/bin/apachectl startssl
10. vi /etc/rc.d/init.d/httpd (可选)

#!/bin/sh

. /etc/rc.d/init.d/functions

case "$1" in

start)

echo -n "Starting httpd with SSL : "

/www/bin/apachectl startssl

;;

stop)

echo -n "Shutting down httpd: "

/www/bin/apachectl stop

;;

restart)

echo -n "Restarting httpd: "

/www/bin/apachectl restart

;;

status)

echo -n "Show httpd status: "

/www/bin/apachectl status

;;

*)

echo "Usage: $0 {start|stop|restart|status}"

exit 1

esac

exit 0


11. ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S99httpd (开机自动运行)


14. 最后测试

1. 在/www/htdocs/下写个test.php,内容:,
2. http://localhost/test.php,看看有没有很多php信息出来,如果有,说明php/mysql等都没有问题了。如果有“with
Zend Optimizer v1.2.0, Copyright (c) 1998-2001, by Zend Technologies”,说明Zend
Optimizer装好了。如果有“with Zend Cache v1.1.0, Copyright (c) 1999-2001, by Zend
Technologies”,说明Zend Cache装好了。同理,看Zend Accelerator装好没有。
3. 访问http://localhost/examples/jsp/index.html,有很多jsp的例子,运行看看有没有问题。恭喜你,jsp也可以了。

原文转自:http://www.ltesting.net