LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 632|回复: 1

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

[复制链接]
发表于 2003-6-19 09:12:51 | 显示全部楼层 |阅读模式
经小弟测试,在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. OpenSSL is installed and mod_ssl is ready to be built into
Apache. Likewise, PHP is installed and is ready to be built into Apache. In the next section, we build one more popular
feature into Apache.

6. Building mod_perl

mod_perl is very popular among developers. So we will integrate it into our Apache build.

Goto the location of the mod_perl distribution
# cd /
# gunzip -f mod_perl-1.26.tar.gz
# tar xvf mod_perl-1.26.tar
# cd mod_perl-1.26

Now prepare mod_perl
# perl Makefile.PL \
     APACHE_SRC=/apache_1.3.24/src \
     DO_HTTPD=1 \
     USE_APACI=1 \
     PREP_HTTPD=1 \
     EVERYTHING=1
# make
# make test
# make install

mod_perl is now ready to be built with Apache.

7. Building Apache

With all the dependencies taken care of, we can now build Apache.

Goto our Apache environment
# cd /apache_1.3.24

Create our Mega-Makefiles
# ./configure \
--enable-module=ssl \
--activate-module=src/modules/php4/libphp4.a \
--enable-module=php4 \
--prefix=/usr/local/apache \
--enable-shared=ssl \
--activate-module=src/modules/perl/libperl.a
# make
# make certificate
# make install
 楼主| 发表于 2003-6-19 09:40:59 | 显示全部楼层
555~~~~~~~只好自己来顶了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表