old-www/HOWTO/Apache-mods-3.html

553 lines
18 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Apache+DSO+mod_ssl+mod_perl+php+mod_auth_nds+mod_auth_mysql+mod_fastcgi: Component Installation</TITLE>
<LINK HREF="Apache-mods-4.html" REL=next>
<LINK HREF="Apache-mods-2.html" REL=previous>
<LINK HREF="Apache-mods.html#toc3" REL=contents>
</HEAD>
<BODY>
<A HREF="Apache-mods-4.html">Next</A>
<A HREF="Apache-mods-2.html">Previous</A>
<A HREF="Apache-mods.html#toc3">Contents</A>
<HR>
<H2><A NAME="s3">3. Component Installation</A></H2>
<H2><A NAME="ss3.1">3.1 Preparations</A>
</H2>
<P>You will need the following software:
<UL>
<LI>
<A HREF="http://www.apache.org/dist/apache_1.3.12.tar.gz">Apache 1.3.12</A></LI>
<LI>
<A HREF="http://www.php.net/distributions/php-3.0.15.tar.gz">PHP 3.0.15</A>
<UL>
<LI>GD 1.3 (to make use of GIF files)
<UL>
<LI>
<A HREF="http://www.boutell.com/gd/http/gd-1.3.tar.gz">Source</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/redhat/redhat-6.0/i386/RedHat/RPMS/gd-1.3-5.i386.rpm">RPM</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/redhat/redhat-6.0/i386/RedHat/RPMS/gd-devel-1.3-5.i386.rpm">RPM-devel</A></LI>
</UL>
</LI>
<LI>GD 1.8.1 (to make use of PNG files)
<UL>
<LI>
<A HREF="http://www.boutell.com/gd/http/gd-1.8.1.tar.gz">Source</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/contrib/libc6/i386/gd-1.8.1-1.i386.rpm">RPM</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/contrib/libc6/i386/gd-devel-1.8.1-1.i386.rpm">RPM-devel</A></LI>
</UL>
</LI>
<LI>IMAP 4.5+
<UL>
<LI>
<A HREF="ftp://ftp.cac.washington.edu/imap/imap-4.7b.tar.Z">Source</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/redhat/redhat-6.1/i386/RedHat/RPMS/imap-4.5-4.i386.rpm">RPM</A></LI>
</UL>
</LI>
<LI>OpenLDAP 1.2.9+
<UL>
<LI>
<A HREF="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-1.2.9.tgz">Source</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/rawhide/1.0/i386/RedHat/RPMS/openldap-1.2.9-5.i386.rpm">RPM</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/rawhide/1.0/i386/RedHat/RPMS/openldap-devel-1.2.9-5.i386.rpm">RPM-devel</A></LI>
</UL>
</LI>
</UL>
</LI>
<LI>
<A HREF="http://perl.apache.org/dist/mod_perl-1.22.tar.gz">mod_perl 1.22+</A>
<UL>
<LI><EM>Perl5 Modules Required</EM></LI>
<LI>
<A HREF="http://amaunet.informatik.uni-dortmund.de/cgi-bin/CPAN/authors/id/GAAS/MIME-Base64-2.11.tar.gz">MIME::Base64</A></LI>
<LI>
<A HREF="http://www.perl.com/CPAN-local/modules/by-module/URI/URI-1.05.tar.gz">URI</A></LI>
<LI>
<A HREF="http://www.perl.com/CPAN-local/modules/by-module/HTML/HTML-Parser-3.07.tar.gz">HTML-Parser</A></LI>
<LI>
<A HREF="http://www.perl.com/CPAN-local/modules/by-module/Digest/Digest-MD5-2.09.tar.gz">Digest-MD5</A></LI>
<LI>
<A HREF="http://www.perl.com/CPAN-local/modules/by-module/Net/libnet-1.0703.tar.gz">libnet</A></LI>
<LI>
<A HREF="http://www.perl.com/CPAN-local/modules/by-module/WWW/libwww-perl-5.47.tar.gz">libwww</A></LI>
</UL>
</LI>
<LI>
<A HREF="http://www.modssl.org/source/mod_ssl-2.6.2-1.3.12.tar.gz">mod_ssl 2.6.2+</A>
<UL>
<LI>OpenSSL 0.9.5
<UL>
<LI>
<A HREF="http://www.openssl.org/source/openssl-0.9.5.tar.gz">Source</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/contrib/libc6/i386/openssl-0.9.5-1.i386.rpm">RPM</A></LI>
<LI>
<A HREF="ftp://rpmfind.net/linux/contrib/libc6/i386/openssl-devel-0.9.5-1.i386.rpm">RPM-devel</A></LI>
</UL>
</LI>
<LI>
<A HREF="ftp://ftp.wwc.edu/pub/apache/modules/mod_ssl/depend/rsaref20.1996.tar.Z">RSAREF 2.0</A></LI>
<LI>
<A HREF="http://www.engelschall.com/sw/mm/mm-1.0.12.tar.gz">MM 1.0.12</A></LI>
</UL>
</LI>
<LI>
<A HREF="http://www.mysql.com/Downloads/MySQL-3.22/mysql-3.22.32.tar.gz">MySQL 3.22.32</A></LI>
<LI>
<A HREF="ftp://vrooom.at.drew.edu/pub/mod_auth_nds/mod_auth_nds-0.4.tar.gz">mod_auth_nds 0.4</A>
<UL>
<LI>
<A HREF="ftp://vrooom.at.drew.edu/pub/mod_auth_nds/ncpfs/ncpfs-2.2.0.17.tgz">ncpfs 2.2.0.17</A>
Note: the kernel must also be compiled with IPX support.</LI>
</UL>
</LI>
<LI>
<A HREF="http://bourbon.netvision.net.il/mysql/mod_auth_mysql/mod_auth_mysql-2.20.tar.gz">mod_auth_mysql 2.20</A></LI>
<LI>
<A HREF="http://www.FastCGI.com/dist/mod_fastcgi_SNAP_Oct06.tar.gz">mod_fastcgi SNAP Oct06</A></LI>
</UL>
<P>This is the directory layout scheme I use and recommend:
<P>
<PRE>
+ /usr/src
|
+-+ apache
|
+-+ apache-1.3.12
|
+-+ modules
| |
| +-+ mod_perl
| | |
| | +- mod_perl-1.21
| | |
| | +-+ depend
| | |
| | +- &lt;perl modules here>
| |
| +-+ mod_ssl
| | |
| | +- mod_ssl-2.6.2-1.3.12
| | |
| | +-+ depend
| | |
| | +- openssl-0.9.5
| | |
| | +- rsaref-2.0
| | |
| | +- mm-1.0.12
| |
| +-+ mod_fastcgi_SNAP
| |
| +-+ php
| | |
| | +- php-3.0.15
| | |
| | +-+ depend
| | |
| | +- gd-1.3
| | |
| | +- imap-4.5
| | |
| | +- openldap-1.2.9
| |
| +-+ mod_auth_nds
| | |
| | +- mod_auth_nds-0.4
| | |
| | +-+ depend
| | |
| | +- ncpfs-2.2.0.17
| |
| +-+ mod_auth_mysql
|
+-+ mysql
</PRE>
<P>Check to see if some of the above modules/software packages are already installed
on your system. It usually doesn't hurt, however, to download everything and install
it just in case. You might have an older version installed on your system.
<H2><A NAME="ss3.2">3.2 mod_ssl</A>
</H2>
<H3>Installing and Compiling OpenSSL</H3>
<P>mod_ssl requires some sort of SSL engine be installed. OpenSSL is the natural
choice for the Linux environment. You can either install it via RPM (as I did),
or compile it from source. Since I did not compile it from source, you're on
your own, although I would think it pretty straightforward. Most likely you'll
either install it on the system (into /usr/local or something) or leave it in
its directory and simply point whichever applications need OpenSSL to its
directory.
<P>RPM will install OpenSSL into system directories.
<H3>Installing and Compiling RSAREF 2.0</H3>
<P>Create the rsaref-2.0 directory wherever you like. For me this is in
/usr/src/apache/modules/mod_ssl-blah/depend/. Change to this directory.
<P>
<PRE>
cd rsaref-2.0
cp -rp install/unix local
cd local
make
mv rsaref librsaref.a
</PRE>
<P>These commands should build you the rsaref library! Just leave the stuff here
and when you need to link against it, just point the appropriate configure
script to this location.
<H3>Installing and Compiling MM</H3>
<P>Extract mm-1.0.12 (or whichever version is most current) to the depend
directory of the mod_ssl-blah subdirectory. Perform the following steps:
<P>
<PRE>
cd mm-1.0.12
./configure --disable-shared
make
</PRE>
<P>This should build your mm libraries. As above, reference this path when
needed. You're on your own if you want to install this library to the system.
<H3>Installing and Compiling mod_ssl (at last!)</H3>
<P>The normal procedure with apxs is to compile Apache first, and then, using
apxs, compile the modules you want to use and insert them into the server.
However, mod_ssl needs to be compiled into the server the normal way before you
can use it via apxs. Once mod_ssl is in the server for the first time, you can
then upgrade it via apxs without having to completely recompile Apache.
<P>Enter the directory where you are compiling mod_ssl and execute the following
configuration directive (here is the file I use) for the initial compile:
<P>
<PRE>
#!/bin/sh
./configure \
--with-apache=/usr/src/apache/apache_1.3.12 \
--with-ssl \
--with-rsa=../depend/rsaref-2.0/local \
--with-mm=../depend/mm-1.0.12 \
--enable-shared=ssl
</PRE>
<P>You don't need to run 'make' or anything here. When we compile Apache, it
will do it all for us.
<P>This configuration line gives two examples of how your system could be set up.
In my case, OpenSSL was already installed somewhere in the system (probably
in /usr/lib, /usr/include). Therefore, I didn't need to pass it any location
parameters. However, rsa and mm were -not- on the system, and I compiled them
myself and left them within their source trees (didn't run make install, et
al). In that case, you need to point configure to the appropriate directory
so it can find the headers/libraries.
<P>From this point on, unless you upgrade Apache (in which case you'd need to
perform the above step again for the new version of Apache), you can use apxs
to upgrade and recompile mod_ssl. Here is the configure script I use for
this:
<P>
<PRE>
./configure \
--with-apxs=/apps/apache-1.3.12/bin/apxs \
--with-ssl=../depend/openssl-0.9.4 \
--with-rsa=../depend/rsaref-2.0/local \
--with-mm=../depend/mm-1.0.12
</PRE>
<P>Or some combination of the above. Then run:
<P>
<PRE>
make
make install
make distclean
</PRE>
<P>to complete the installation.
<P>Notes: <EM>MM is -not- required to compile mod_ssl. If you're having problems
getting it to work, simply omit compiling it and also from the ./configure
line(s).</EM>
<P><EM>When I compiled mod_ssl, I had errors regarding DBM. To fix this, I had to
add -lndbm to the Makefile:</EM>
<P>
<UL>
<LI>Run the above configure script.</LI>
<LI>cd to pkg.sslmod</LI>
<LI>Edit the makefile and add -lndbm to LIBS_SHLIB. It should look like:</LI>
<LI><CODE>LIBS_SHLIB=-lm -lcrypt -lndbdm</CODE></LI>
</UL>
<P><EM>Hopefully that will save you some grief.</EM>
<H2><A NAME="ss3.3">3.3 Apache</A>
</H2>
<P>Extract apache-1.3.12.tar.gz to /usr/src/apache or wherever. Next we want to
compile Apache enabling the following options:
<P>
<UL>
<LI>mod_ssl (In order to compile mod_ssl as a DSO, it has to be first
compiled into the server normally. After doing this, the
module can then be upgraded via apxs.)</LI>
<LI>mod_proxy</LI>
<LI>mod_so</LI>
<LI>mod_rewrite (For use with Zope)</LI>
</UL>
<P>Here is the configuration file I used to initially compile Apache:
<P>
<PRE>
#!/bin/sh
SSL_BASE=../depend/openssl-0.9.4 \
RSA_BASE=../depend/rsaref-2.0/local \
EAPI_MM=../depend/mm-1.0.12 \
./configure \
--enable-module=ssl \
--enable-module=proxy\
--enable-shared=proxy\
--enable-module=rewrite \
--enable-shared=rewrite \
--prefix=/apps/apache-1.3.12 \
--enable-shared=ssl \
--enable-rule=SHARED_CORE \
--enable-rule=SHARED_CHAIN \
--enable-module=so
</PRE>
<P>Then run
<P>
<PRE>
make
make certificate
make install
</PRE>
<P>Apache should now be compiled and installed into whicever directory you
specified with --prefix. Test it out and make sure it starts up.
<P><CODE>/path/to/apache/bin/apachectl start</CODE>
<P>or
<P><CODE>/path/to/apache/bin/apachectl startssl</CODE>
<P>Hopefully it all runs smoothly. If not, trace back over your steps and ensure
you didn't forget anything.
<H2><A NAME="ss3.4">3.4 MySQL</A>
</H2>
<P>php as well as mod_auth_mysql and possibly mod_perl will require that MySQL
be installed and running on your system. It is beyond the scope of this
document to go into the details of installing MySQL, but download the archive
and follow the directions in the INSTALL file(s). It is a fairly straight-forward
procedure to get MySQL up and running. Something like:
<P>
<PRE>
./configure
make
make install
</PRE>
<P>Should get everything installed so that you can compile the other Apache
modules.
<H2><A NAME="ss3.5">3.5 PHP 3.0.15</A>
</H2>
<P>We will compile php-3.0.15 as a DSO which means that it is a separate module
that can be loaded and unloaded from the server. This makes it easy to
upgrade php without having to recompile everything (which can be a pain if
you use a lot of modules with Apache).
<H3>GD</H3>
<P>In our installation of Apache, php uses gd to create images, and such. I used
an older version of gd (installed via RPM) to link php against. This way we
can use output GIF files. This probably isn't too desirable do to copyright
issues, and thus you may wish to use a version later than 1.3 which only
supports PNG files.
<P>Either install via RPM (rpm -i gd*.rpm) or compile from source and install
to the system.
<H3>IMAP</H3>
<P>If you want IMAP support, the procedure is similar to that of gd. I used the
RPM since I'm on a Red Hat system, but installing from source should be a
relatively simple procedure of ./configure;make;make install.
<H3>OpenLDAP</H3>
<P>Once again you can install OpenLDAP either via RPM or source. I chose to do
it via source since the latest version was not yet available via RPM at the
time we were setting things up.
<P>
<PRE>
./configure
make
make install
</PRE>
<P>should do the trick! (Or rpm -i openldap*.rpm)
<H3>Installing and Compiling PHP 3.0.15</H3>
<P>Once the above items are installed and working, we can go ahead and compile
PHP as a DSO. The process is very straightforward and simple.
<P>
<PRE>
cd /usr/src/apache/modules/php/php-3.0.15
./configure \
--with-apxs=/apps/apache/bin/apxs \
--with-config-file-path=/apps/etc \
--with-gd \
--with-imap \
--with-mysql=/apps/mysql \
--with-ldap=/apps \
--with-zlib \
--enable-track-vars
</PRE>
<P><EM>Make sure that if any of your --with libraries are not installed
in /usr/local or /usr, that you tack on an =/location/ line so that configure
can find the stuff it needs!</EM>
<P>
<PRE>
make
make install
</PRE>
<P>If everything completes properly, 'make install' will use apxs to install
libphp3.so to /apache/libexec/libphp3.so and add the proper entries into
httpd.conf and activate php3. Pretty slick.
<H2><A NAME="ss3.6">3.6 mod_perl</A>
</H2>
<P>This section documents the installation of mod_perl as a DSO for Apache.
There are a number of perl modules (in addition, of course, to perl5,
which I will assume you already have installed) that must be added before
mod_perl will compile without complaining. If you don't install these
modules, mod_perl should complain and tell you which ones you are missing.
<P>There is a certain order in which the modules must be installed. Some
depend on others and thus I've listed the install order that I used without
any problems.
<H3>Required Perl Modules</H3>
<P>The perl modules can be obtained from locations detailed further up in this
document. Download them and put them wherever you like or in the location
I used as depicted in the directory map (also above). Installing a module
is fairly simple. After extracting the module to a directory (usually with
tar xvfz), you simply change to that directory and execute the following
commands:
<P>
<PRE>
perl Makefile.PL
make
make install
</PRE>
<P>If everything goes as it should, this will configure, build and install the
perl module for you. Of course, check the README for each module if things
don't work quite as expected.
<P>Here is the order I used to install the modules necessary for mod_perl:
<P>
<OL>
<LI>MIME::Base64</LI>
<LI>URI</LI>
<LI>HTML::Parser</LI>
<LI>Digest-MD5</LI>
<LI>libnet</LI>
<LI>libwww</LI>
</OL>
<H3>Installing and Compiling mod_perl 1.2x</H3>
<P>After installing the perl modules, we're ready to compile and install
mod_perl into Apache. Change to the directory where you extracted mod_perl
to, and run the following script:
<P>
<PRE>
perl Makefile.PL \
USE_APXS=1 \
WITH_APXS=/path/to/apache/bin/apxs \
EVERYTHING=1
</PRE>
<P>This will set up your Makefile and tell mod_perl to compile itself as a DSO
using apxs (the location of which you must specify). After this step,
simply run
<P>
<PRE>
make
make install
</PRE>
<P>And mod_perl will be moved to the appropriate directory and lines added to
your httpd.conf file.
<H2><A NAME="ss3.7">3.7 mod_auth_mysql</A>
</H2>
<P>mod_auth_mysql lets the Apache web-server authorize against a MySQL user
database. Installation of the module as a DSO isn't exactly documented
in the README file, but it can be done.
<P>First, change to the directory you extracted mod_auth_mysql to. I assume
that you have MySQL installed somewhere (along with the headers, etc). Make
sure you know the location of the MySQL libraries and header files. If in
doubt, check /usr/lib/mysql and /usr/include/mysql.
<P>In order to compile mod_auth_mysql, we'll first have to rename the 'config.h'
file to 'auth_mysql_config.h'. I'm not sure why this file wasn't named
correctly, but simply execute the following command:
<P>
<PRE>
cp config.h auth_mysql_config.h
</PRE>
<P>Now for the final step:
<P>
<PRE>
/path/to/apache/bin/apxs -i -a -I/usr/include/mysql -L/usr/lib/mysql \
-lmysqlclient -c mod_auth_mysql.c
</PRE>
<P>You may need to run as root if you do not have read/write access to the Apache
directory.
<H2><A NAME="ss3.8">3.8 mod_auth_nds</A>
</H2>
<P>At my school, the Windows network of choice is Netware. It's been in place
for a long time, and although hopefully someday it will be retired, for now
it is still the main network on campus for filesharing and email. Every student
has a Netware account on which their personal files--including their webpages
are stored. We mount these directories on our linux server and it's nice to
be able to password protect certain ones with the Netware username and password
information. With this module, Apache can authenticate straight to the Netware
server itself.
<H3>ncpfs</H3>
<P>In order to compile mod_auth_nds, we need to have ncpfs installed (along with its
headers of course). Before compiling ncpfs, you must ensure that your kernel
has IPX support compiled in. If this is the case, simply running
<P>
<PRE>
./configure
make
make install (optional)
</PRE>
<P>will compile (and install) the libraries.
<H3>Compiling and Installing mod_auth_nds</H3>
<P>With ncpfs installed, running the following command should compile mod_auth_nds
as a DSO:
<P>
<PRE>
/path/to/apache/bin/apxs -c -lncp -L/usr/lib -I/usr/include mod_auth_nds.c
/path/to/apache/bin/apxs -i mod_auth_nds.so
</PRE>
<P>Then add the following lines to your httpd.conf (by hand):
<P>
<PRE>
LoadModule nds_auth_module libexec/mod_auth_nds.so
AddModule mod_auth_nds.c
</PRE>
<P>Then, restart Apache!
<H2><A NAME="ss3.9">3.9 mod_fastcgi</A>
</H2>
<P>Installing mod_fastcgi is necessary if you want to allow access to your Zope server
through Apache. This might be useful simply because Apache is inherently more
secure and much more configurable than the Zope server itself.
<P>The current stable version of mod_fastcgi is 2.2.2, however, this version does not
work properly with Zope. You must get the SNAP release which is dated Oct 06. The
link is provided above.
<P>Change to the mod_fastcgi directory and run the following commands:
<P>
<PRE>
/path/to/apache/bin/apxs -o mod_fastcgi.so -c *.c
/path/to/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
</PRE>
<P>See the mod_fastcgi documentation for a description of its use.
<HR>
<A HREF="Apache-mods-4.html">Next</A>
<A HREF="Apache-mods-2.html">Previous</A>
<A HREF="Apache-mods.html#toc3">Contents</A>
</BODY>
</HTML>