Installing the Required Software


Our first task is to install all the software required to run the AxKit document server. Although Appendix B discusses Perl module installations, I think this is a unique enough case to cover it within the chapter, especially because you need to install other components. Here is a list of the required components ,which can also be seen at the beginning of this chapter:

  • Apache web server

  • AxKit

  • mod_perl

  • LibXML2

  • LibXSLT2

  • XML::LibXML Perl module

  • XML::LibXSLT Perl module

In this section, we'll discuss the installation instructions for each of the required components.

Apache Web Server and mod_perl Installation

To publish web pages (either with or without AxKit), an HTTP server such as Apache needs to be installed, properly configured, and running. The Apache web server is the most powerful and popular web server in the world, and AxKit was specially designed to integrate tightly with Apache.

For our installation, we'll be using a version of the Apache web server that supports mod_perl. mod_perl is an Apache plug-in Perl interpreter that integrates with the Apache web server. It provides many benefits over CGI scripting, including increased performance, efficiency, and a persistent environment.

Installing on Unix Systems

Binaries are available for some Unix systems, but sometimes it is just as easy to recompile locally. This usually assures that you're installing the latest version of the software. To compile a mod_perl-enabled Apache web server, you'll first need to download the source code for both packages.

The Apache web server source code is available from:

http://www.apache.org/dist/httpd/

The mod_perl source code is available from:

http://perl.apache.org/dist/

After you download the tar files to a location on the local machine, you'll need to start a command-line terminal and change directories (that is, the cd command) to the directory where both files now reside.

You can then untar and unzip the files with the following commands:

 $ tar xvzf apache_1.3.24.tar.gz  $ tar xvzf mod_perl-1.26.tar.gz 

The preceding commands uncompress the files into their own directories, apache_1.3.24 and mod_perl-1.26. If you use other decompression tools, use their decompression commands to untar and unzip the files.

You'll now need to cd into the mod_perl directory. As part of the mod_perl compilation, you specify the location of the Apache web server source code. The Apache web server is compiled along with the mod_perl during the compilation process. Once inside the mod_perl directory, issue the following commands:

 $ perl Makefile.PL \  >   APACHE_SRC=/home/isterin/apache_1.3.24/src/ \  >   DO_HTTPD=1 \  >   USE_APACI=1 \  >   EVERYTHING=1  $ make  $ make test  $ su - $ make install 

Note

We'll assume that the Apache web server uncompressed source code files reside in /home/isterin/apache_1.3.24.tar and mod_perl source code files are in /home/isterin/mod_perl-1.26.tar.


The preceding commands compile, install, and configure Apache and mod_perl on standard Unix systems (for example, Linux and Solaris). Notice the su - command; it switches the current user to the root user before actually installing the software. This is required because you'll need root privileges to install the software in the default location. As with any other software, you can install Apache and mod_perl in a non-standard directory such as your home directory (this might be a good idea or your only option if you don't have root privileges on the machine). If you'd like to install it in a non-standard directory, set the APACHE_PREFIX and PREFIX flags when running perl Makefile.PL . The APACHE_PREFIX identifies the directory where you'd like the Apache binaries installed and PREFIX specifies the location where you'd like mod_perl installed. That's about it for a Unix installation of the Apache web server and mod_perl. Now let's take a look at a Microsoft Windows installation.

Installing on Microsoft Windows

If you want to install the Apache web server and mod_perl on Windows, you either have to repeat the previous steps with Microsoft Visual C++ and the nmake utility, or you can download and install the Apache binary from http://www.apache.org/dist/httpd/binaries/win32/.

If you are running the ActiveState version of Perl under Microsoft Windows, you can use the ppm utility to install the mod_perl binary by running this command in the command line:

 ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl.ppd 

Note

If you have any questions about installing Perl modules using PPM, instructions can be found in Appendix B.


Apache Web Server Configuration

After the Apache web server, mod_perl, and all required libraries and modules have been installed, you need to configure Apache to utilize AxKit for processing.You'll need to edit our Apache configuration file, httpd.conf.

Note

For our example, we're assuming that the Apache web server is accessed in the local machine using the default port 80.


Because we don't want to modify the server's configuration if it is already running, we'll create a new directory named axkit-stuff and configure Apache to serve from that directory using AxKit:

 ** Make sure you are executing this command as the root user  $ cd /usr/local/apache  $ mkdir axkit-stuff 

Note

The following commands assume Apache is installed in the standard /usr/local/apache directory on Unix/Linux system. Microsoft Windows users have to modify the following commands a bit to accommodate the Microsoft Windows file structure as well as equivalent commands. Note also that starting and stopping the Apache web server can be accomplished by using the proper commands on the Start menu. Microsoft Windows users can check their httpd.conf files by using a tool found on the Start menu.


Now you'll configure Apache by adding these directives to the bottom of the httpd.conf file and saving it:

 Alias /axkit-stuff "/usr/local/apache/axkit-stuff"  <Directory "/usr/local/apache/axkit-stuff">      PerlModule AxKit      AddHandler axkit .xml      AxDebugLevel 10     AxAddStyleMap  text/xsl  Apache::AxKit::Language::LibXSLT      Options -All +Indexes +FollowSymLinks      DirectoryIndex index.xml  </Directory> 

You will now start your Apache web server:

 $ /usr/local/apache/bin/apachectl start 

Or if you already had the Apache web server up and running, you'll need to restart it:

 $ /usr/local/apache/bin/apachectl restart 

If everything went well, you shouldn't see any error messages. If you do happen to get errors, it most likely means you have an error in the httpd.conf file.You should then go back to the previous section, where we discussed the httpd.conf, and make sure you entered everything as shown. Make any corrections that are required and restart the Apache web server.

Installing LibXML2 and LibXSLT2 Libraries

You'll also need to install the latest LibXML2 and LibXSLT2 libraries.You can find the latest rpm or source code versions from ftp://xmlsoft.org/.

If you want to recompile the source code versions locally, use the following commands to build each package. Just replace the package.tar.gz with the correct package name .

 $ tar xvzf package.tar.gz  $ cd package  $ ./configure  $ make  $ make test  $ su -  $ make install 

The latest Microsoft Windows versions of the libraries (already compiled) can be found at http://www.fh-frankfurt.de/~igor/projects/libxml/index.html.

If you are installing Microsoft Windows binaries, refer to the included installation instructions.

Perl Modules

Several Perl modules need to be installed to use AxKit. Some modules are required and others are optional depending on the functionality required. The installation of the Perl modules varies depending on the operating system and distribution of Perl that you're using. I have provided instructions for installing Perl modules in Appendix B.

Some Perl modules are required and others are optional. The required modules are

  • XML::LibXML

  • XML::LibXSLT

  • Digest::MD5 2.09 or higher

  • Compress::Zlib

  • Error 0.13 or higher

  • Apache::Request 0.32 or higher

  • HTTP::GHTTP 1.0 or higher

A number of Perl modules are optional depending on which AxKit options you use in your particular situation. The following Perl modules are optional (that is, not required for our example):

  • XML::Parser 2.27 (not required in all cases, but nice to have for particular cases)

  • XML::XPath 1.00 or higher is required for XPathScript

  • XML::Sablotron 0.40

Although I list the required versions for most modules, as time passes , later module versions might be required. As with all the modules in the book, I recommend you use the latest stable version available.

AxKit Perl Module Installation

Several methods exist for installing the AxKit Perl module. The first method is the manual Perl module installation. This method requires you to download the Perl module as well as all the dependencies from CPAN (or a mirror site) and install all the modules in the proper order. This method is fairly standard and works on both Unix and Microsoft Windows operating systems. Remember, a compiler is required, and it must be the same compiler that was used to build Perl for your system. For additional information, please see the detailed Perl module installation instructions in Appendix B.

The second method of installing the AxKit Perl module is to use the CPAN.pm Perl module. This method installs AxKit as well as any required dependencies all at once. If you don't already have this module installed, you can download it from CPAN (http://www.cpan.org) and install it. After the CPAN module is installed and configured, the following commands install AxKit.

 $ su -  $ perl -MCPAN -e shell  cpan>install AxKit 

This installs AxKit and all the required dependencies. After it is finished installing, you can exit the CPAN.pm prompt by typing quit .

The third method of installing the AxKit Perl module is to use the PPM utility. The PPM utility is included with ActiveState Perl distributions. To install the AxKit module using PPM, you use the following statement:

 ppm install AxKit 

Additional information on the PPM utility can be found in Appendix B.



XML and Perl
XML and Perl
ISBN: 0735712891
EAN: 2147483647
Year: 2002
Pages: 145

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net