转Apache: Building MySQL, PHP, Mod_Perl and Mod_SSL Support

由 天下无雪 在 06-19-2003 09:12 发表:

转Apache: Building MySQL, PHP, Mod_Perl and Mod_SSL Support

经小弟测试,在Redhat8.0环境下通过

Comprehensive Guide to Building Apache on FreeBSD and LINUX

1. Getting Started

2. Downloads

3. Building MySQL

4. Building PHP

5. Building SSL

6. Building mod_perl

7. Building Apache

1. Getting Started

Before you begin to build Apache and various third party modules, make sure you have access to a system with gcc and Perl.

Almost all FreeBSD and Linux systems will have these by default.

In this guide, we will look at a typical yet complex Apache build. That is, we are building Apache along with some popular

third party add-ons. In our case, we are building an Apache Web Server with support for MySQL, PHP, SSL, and mod_perl. If

you decide that you dont want all these features, simply omit the respective steps.

One final point. The approach used here is one in which we build everything from scratch. No binaries are used. This

actually tends to make the process more seemless.

2. Downloads

To begin, we need to download the following to the root level of our system:

Apache (/apache_1.3.24.tar.gz)

MySQL (/mysql-3.23.49.tar.gz)

PHP (/php-4.2.0.tar.gz)

mod_ssl (/mod_ssl-2.8.8-1.3.24.tar.gz)

OpenSSL (/openssl-0.9.6d.tar.gz)

mod_perl (/mod_perl-1.26.tar.gz)

RSAREF (/rsaref-2.0.tar)

You can find these files at the following respective URLs:

http://httpd.apache.org/

http://www.mysql.org/

http://www.php.net/

http://www.modssl.org/

http://www.openssl.org/

http://www.modssl.org/

http://perl.apache.org/

http://www.essenz.com/downloads/

3. Building MySQL

First, get superuser access.

su root

Now, goto the root level of your system where the downloads are.

cd /

Unpack MySQL

gunzip -f mysql-3.23.49.tar.gz

tar xvf mysql-3.23.49.tar

Go into MySQL Directory

cd mysql-3.23.49

Build it

configure --prefix=/usr/local/mysql

make

make install

Some preliminary setup

/mysql-3.23.49/scripts/mysql_install_db

cd /usr/local/mysql/bin

./safe_mysqld &

./mysqladmin -u root password 'your-new-password'

That is about it for MySQL. If you want, you could simply install a binary version of MySQL, but just make sure you know

the path of where it is installed. There are some platform related issues when installing MySQL. For instance, on FreeBSD

your need to create the following user:

mysql:*:88:88::0:0:MySQL Daemon:/usr/local/mysql/var:/sbin/nologin

If you have trouble with the MySQL installation, just ask around on your favorite MySQL mailing list. I dont want to

elaborate to much on it here since this guide is for Apache, not MySQL.

4. Building PHP

Goto the root level of your system where the downloads are.

cd /

Unpack PHP

gunzip -f php-4.2.0.tar.gz

tar xvf php-4.2.0.tar

When building PHP, we need to have the Apache build environment ready. So we do the following:

cd /

gunzip -f apache_1.3.24.tar.gz

tar xvf apache_1.3.24.tar

cd apache_1.3.24

./configure --prefix=/usr/local/apache

Thats it. Now we switch back over to PHP.

cd /php-4.2.0

Now we build PHP

./configure \

--with-mysql=/usr/local/mysql \

--with-xml \

--with-apache=/apache_1.3.24 \

--enable-track-vars

make

make install

cp php.ini-dist /usr/local/lib/php.ini

And thats it.

5. Building SSL

For SSL we need to build rsaref, openssl, and prepare mod_ssl.

Lets build rsaref (Skip this if you are outside the US)

cd /

mkdir RSA

mv rsaref.tar ./RSA

cd RSA

tar xvf rsaref.tar

cp -rp install/unix local

make

mv rsaref.a librsaref.a

Now we move on to OpenSSL

cd /openssl-0.9.6d

./config --prefix=/usr/local/ssl \

-L'pwd'/RSA/local/rsaref -fPIC

make

make test

make install

Now we prepare mod_ssl for Apache

cd /mod_ssl-2.8.8-1.3.24

./configure --with-apache=/apache_1.3.24

You should see something like this:

Configuring mod_ssl/2.8.8 for Apache/1.3.24

+ Apache location: /apache_1.3.24 (Version 1.3.24)

+ Auxiliary patch tool: ./etc/patch/patch (local)

+ Applying packages to Apache source tree:

o Extended API (EAPI)

o Distribution Documents

o SSL Module Source

o SSL Support

o SSL Configuration Additions

o SSL Module Documentation

o Addons

Done: source extension and patches successfully applied.

At this point, everything is setup to be built into Apache.

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus