Apache+SSL+PHP+JSP+MySQL+IMAP+GD安裝全攻略(轉)

post0發表於2007-08-11
Apache+SSL+PHP+JSP+MySQL+IMAP+GD安裝全攻略(轉)[@more@]

在RedHat 7.2上,假設所有安裝程式包都下在/pub下面,原始碼包都用紅色表示,

假設在telnet或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 )

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

Accelerator (用在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. ,看看有沒有很多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. 訪問,有很多jsp的例子,執行看看有沒有問題。恭喜你,jsp也可以了

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8225414/viewspace-944655/,如需轉載,請註明出處,否則將追究法律責任。

相關文章