HP 5991-5565 User Manual

HP Open Source Middleware Stacks Blueprint:

Web Server on HP ProLiant Servers with SUSE Linux Enterprise Server Version 10
HP Part Number: 5991-5565 Published: August 2007 Edition: 3.0
© Copyright 2007 Hewlett-Packard Development Company, L.P.
Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR12.211and 12.212, Commercial
Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under
vendor's standard commercial license.
The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express
warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP
shall not be liable for technical or editorial errors or omissions contained herein.
Acknowledgments
Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
Java is a US trademark of Sun Microsystems, Inc.

Table of Contents

Introduction............................................................................................................................................9
Executive Summary...........................................................................................................................9
Intended Audience............................................................................................................................9
Scope and Purpose............................................................................................................................9
HP Services........................................................................................................................................9
Typographic Conventions...............................................................................................................10
HP Encourages Your Comments.....................................................................................................10
HP Open Source Web Server Middleware Stack..................................................................................11
Web Server Stack Architecture........................................................................................................11
Installing and Verifying the Linux Distribution...................................................................................13
Installing the Linux Distribution.....................................................................................................13
Required Packages and Installation Recommendations............................................................13
Verifying the Linux Distribution Installation.............................................................................14
Installing, Configuring, and Managing Web Server Middleware Stack Components.........................15
Configuring the Basic Apache HTTP Server...................................................................................15
Installing and Configuring Sun JDK on an HP Proliant System.....................................................15
Installing and Configuring Tomcat.................................................................................................17
Advanced Apache HTTP Server Features.......................................................................................18
Using the Apache HTTP Server Benchmarking Tool.................................................................18
Apache HTTP Server Status and Information...........................................................................19
Configuring and Using the Modules....................................................................................19
Apache HTTP Server Log...........................................................................................................21
Using the Error Log to Diagnose the Apache HTTP Server ................................................21
Using Webalizer to Perform Apache HTTP Server Log Analysis........................................21
Using Virtual Host Support.......................................................................................................22
Using Apache HTTP Server URL Redirection...........................................................................23
Using Apache HTTP Server Proxy Features..............................................................................24
Error Responses and Redirects...................................................................................................25
Customizing Plain Text Responses.......................................................................................25
Customizing Local URL Redirect Responses.......................................................................25
Customizing External URL Redirect Responses...................................................................26
Using Per-User Web Directories.................................................................................................26
Integrating the Web Server Stack Components...............................................................................27
Configuring the Apache and Tomcat Connector ......................................................................27
Integrating the Apache Web Server and PHP............................................................................29
Integrating the Apache Web Server and Perl.............................................................................29
Integrating the Apache Web Server and Python........................................................................30
Connecting Tomcat to a Database...................................................................................................30
Connecting Tomcat and MySQL................................................................................................31
Obtaining and Installing the JDBC Drivers..........................................................................31
Creating a New Data Source.................................................................................................31
Configuring the MySQL Server............................................................................................32
Testing MySQL Database Connectivity................................................................................32
Connecting Tomcat and Oracle.......................................................................................................33
Obtaining and Installing the Oracle JDBC Driver......................................................................34
Creating an Oracle Data Source.................................................................................................34
Configuring the Oracle Server...................................................................................................34
Testing the Oracle Database Connectivity.................................................................................34
Connecting Tomcat to MySQL or Oracle Using Hibernate ............................................................36
Installing Hibernate, Tomcat, and JDK......................................................................................36
Configuring a Database Driver in Tomcat.................................................................................36
Adding Test Data to the Databases............................................................................................36
Table of Contents 3
Creating a Simple Application in Tomcat..................................................................................37
Verifying the Simple Application Operation.............................................................................41
Secure the Web Server Stack............................................................................................................42
Enabling HTTPS Support in the Apache HTTP Server.............................................................42
Apache HTTP Server Authorization .........................................................................................43
Creating a Test index.html File.............................................................................................43
Configuring the Authorized Overrides................................................................................43
Creating a Password File......................................................................................................44
Creating the Distributed Configuration File........................................................................44
Restarting the Apache HTTP Server ....................................................................................44
Verifying the Authentication and Authorization Operations..............................................44
Protecting Apache HTTP Server Authorization with Symas CDS............................................44
Configuring CDS and LDAP Services..................................................................................44
Configuring Apache HTTP Server Services.........................................................................45
Protecting Tomcat Authorization with Symas CDS...................................................................46
Monitor Tomcat with OpenView Tomcat SPI.......................................................................................48
Software Prerequisites and Reference Guides.................................................................................49
Tomcat SPI Components .................................................................................................................49
Tools...........................................................................................................................................50
Policies........................................................................................................................................50
Appendix A: Checklist for Building a Web Server Middleware Stack.................................................51
Appendix B: Frequently Asked Questions...........................................................................................53
Appendix C: Vendor Information Reference........................................................................................54
Appendix D: Hibernate Test Application Source Code........................................................................55
4 Table of Contents
List of Figures
1 Web Server Stack Architecture......................................................................................................12
2 Web Server Hardware Environment.............................................................................................13
3 YaST Software Selection and System Tasks...................................................................................14
4 SUSE Installation Settings ............................................................................................................14
5 Tomcat Successful Installation Verification...................................................................................17
6 Apache Server Status.....................................................................................................................20
7 Apache Server Information...........................................................................................................20
8 Webalizer Usage Report................................................................................................................22
9 Connecting the Apache Web Server and Tomcat Web Container.................................................27
10 JSP Examples Page to Test mod_jk................................................................................................28
11 Tomcat Connections Using JDBC .................................................................................................31
12 Tomcat Connecting MySQL Test Page..........................................................................................33
13 Oracle Database Test.....................................................................................................................35
14 Verifying the Simple Application Configuration..........................................................................41
15 SSL_Enabled Apache.....................................................................................................................43
16 OVOW Architecture......................................................................................................................49
5
6
List of Tables
1 Software Test Configuration..........................................................................................................12
2 Required OVOW Patches..............................................................................................................49
3 SE-SPI Applications of the Tool Group.........................................................................................50
4 SE SPI Applications of the Policy Group.......................................................................................50
7
8

Introduction

Executive Summary

The HP Open Source Integrated Portfolio (HP OSIP) comprises a range of products and services designed to verify that customers can successfully realize the cost and feature benefits of adopting open source software in their IT environments. HP Open Source foundation components include the base components of an open source-based ecosystem. HP servers and storage are validated to run the Linux operating system together with the supported commercial Linux distribution.
HP Open Source Middleware Stacks offer building block applications, such as the Web Server; technical blueprints, such as this document, describing how to integrate individual components of a technology stack; and consulting services to speed the successful implementation of an open source strategy.

Intended Audience

The intended audience for this document is enterprise customers who are evaluating or deploying an open source Web Server on HP ProLiant servers running SUSE Linux Enterprise Server Version 10 (SLES10).

Scope and Purpose

This blueprint provides technical information for the implementation of an open source Web Server Middleware Stack. It covers installation of the initial Linux distribution and middleware building blocks, integration of the components, and steps for verification of stack functionality. The software components described in this paper are tested and validated to run on HP ProLiant servers and StorageWorks products.
HP provides quality assurance from extensive integration testing with open source software and HP hardware so that you can confidently deploy the complete stack. Once you have completed a successful evaluation, you have the flexibility to “do it yourself” or get assistance from HP to incorporate open source stacks into your existing IT infrastructure.

HP Services

HP Open Source Consulting Services can help you build and integrate open source and commercial software across multiple operating systems (OS) environments. Additionally, HP Open Source Support Services provide industry leading technical support for all the products HP sells, including hardware, operating systems, and open source middleware.
NOTE: While HP does not offer support for JDK, JVM, and components directly, a number of commercial support options are available for these components. HP can help you integrate those offerings into one support strategy.
To learn more about HP Open Source Consulting and Support Services, contact your local HP sales representative or visit the HP Business and IT Services website at:
http://www.hp.com/hps
Introduction 9

Typographic Conventions

This document uses the following typographical conventions.
Command ComputerOut
Ctrl-x A key sequence. A sequence such as Ctrl-x indicates that
ENVIRONVAR The name of an environment variable, for example, PATH. [ERRORNAME]
Key The name of a keyboard key. Return and Enter both refer
Term The defined use of an important word or phrase.
UserInput
VARIABLE
\ (continuation character)
... The preceding element can be repeated an arbitrary number
| Separates items in a list of choices.
A command name or qualified command phrase. Text displayed by the computer.
you must hold down the key labeled Ctrl while you press another key or button.
The name of an error, usually returned in the errno variable.
to the same key.
Commands and other text that you type. The name of a placeholder in a command, function, or
other syntax display that you replace with an actual value. A backslash (\) at the end of a line of code (such as a
command) indicates that the following line of code is contiguous, and you must not insert a line break. This convention facilitates the typesetting of long lines of code examples on a printed page. If you cut and paste sample code from this publication, ensure that you remove backslash characters at line endings.
of times.

HP Encourages Your Comments

HP encourages your comments concerning this document. We are committed to providing documentation that meets your needs. Send any errors found, suggestions for improvement, or compliments to:
feedback@fc.hp.com
Include the document title, manufacturing part number, and any comment, error found, or suggestion for improvement you have concerning this document.
10

HP Open Source Web Server Middleware Stack

The following components comprise the HP OSMS Web Server Middleware Stack:
Apache Web Server The Apache Web Server is a mature open source web server that has
become the de facto standard because of its high adoption rate on the Internet.
Apache Tomcat
Hibernate Hibernate is an object/relational persistence and query service for
mod_jk
mod_ssl
Perl Perl (Practical Extraction and Report Language) has long been a
PHP PHP is a scripting language that can be embedded in HTML pages,
Python Python is an object-oriented language that has a clean, straightforward
JDK The Java Platform Standard Edition Development Kit (JDK) is a
Apache Tomcat (or Tomcat) is a J2EE servlet and JavaServer Pages (JSP) engine for developing and deploying web applications. It also includes other features, such as an embedded web server.
Java. Hibernate provides support for collections and object relations, and composite types. In addition to persisting objects, Hibernate provides a rich query language to retrieve objects from the database, and an efficient caching layer and Java Management Extensions (JMX) support. User-defined data types and composite primary keys give additional flexibility to support legacy applications.
The mod_jk module is commonly used to allow Tomcat to handle Java Servlet and JSP requests while Apache httpd handles requests for static and dynamic contents implemented in PHP, Perl, or Python.
The mod_ssl module provides a Secure Sockets Layer (SSL) and Transport Layer Security (TLS) implementation that allows web applications running within the Apache Web Server to communicate securely with their respective clients. Communication can still occur over standard HTTP while running mod_ssl.
popular text-processing language. Recently, Perl has become popular for the development and deployment of web applications.
allowing developers to add more dynamic contents to their web applications. A large portion of the PHP syntax is similar to C and Java.
syntax. Python can be extended to exploit facilities implemented in other programming languages, such as C and C++.
development platform for building Java-based applications and components.

Web Server Stack Architecture

This section provides architecture, configuration, and the software environment for a web server stack. Figure 1 shows the logical architecture of the stack.
HP Open Source Web Server Middleware Stack 11
Figure 1 Web Server Stack Architecture
Table 1 lists the software used to test the configurations described in this blueprint.
Table 1 Software Test Configuration
Software
Tomcat
Version
2.2.0-21.2Apache httpd
5.5.20Apache
3.2.1Hibernate
2.2.0-21.2mod_ssl
1.2.20mod_jk
5.8.8-14.2Perl
5.1.2-29.5PHP
2.4.2-18.2Python
1.5.0_10Sun JDK
apache2.2.0-21.2.x86_64.rpm
apache-tomcat-5.5.20.tar.gz
hibernate-3.2.1.tar.gz
apache2-prefork-2.2.0-21.2.x86_64.rpm
tomcat-connectors-1.2.20-src.tar.gz
perl-5.8.8-14.2.x86_64.rpm
php-5.1.2-29.5.x86_64.rpm
python-2.4.2-18.2.x86_64.rpm
jdk-1_5_0_10-linux-amd64-rpm.bin
Novell
Apache
Website LinkDistributorPackage NamePackage
Apache httpd website
Apache Tomcat website
Hibernate websiteHibernate
mod_ssl websiteNovellInclude with
mod_jk websiteApache
Perl websiteNovell
PHP websiteNovell
Python websiteNovell
Sun Java websiteSun
12
NOTE: The installation and configuration of the MySQL and Oracle databases are not covered in this blueprint. The MySQL and Oracle databases are installed on a separate HP ProLiant servers with database files on Modular Smart Array (MSA) 1000 storage. All other software listed in Table 1 are installed on HP ProLiant servers, as displayed in Figure 2.
Figure 2 Web Server Hardware Environment
Figure 2 shows a basic configuration consisting of multiple nodes of an Apache Web Server as
the load balancer. The key processes that occur are as follows:
Connection of the Apache Web Server and the Tomcat Web Container, using the mod_jk
module.
Connection of Apache Tomcat Server to a database, such as MySQL or Oracle, using a JDBC Driver.
Support from Apache Web Server for login authentication using Java Authentication and Authorization Service (JAAS) with the Symas Connexitor Directory Services (CDS) Server.
Use of an additional, required OpenView Management Server to host HP OpenView Operations (OVO) for manageability through the Apache Web Server.
For a checklist that provides high-level guidelines for building the web server stack, see “Appendix
A: Checklist for Building a Web Server Middleware Stack” (page 51).

Installing and Verifying the Linux Distribution

This section describes how to build a Web Server Middleware Stack, beginning with the installation of the Linux distribution.

Installing the Linux Distribution

Complete instructions for installation of a Linux distribution are outside the scope of this document. This section provides information to verify installation of the required packages for the OSMS Web Server.

Required Packages and Installation Recommendations

The Web Server Middleware Stack depends on several software package groups included with the SLES10 distribution media. To verify package selection, perform the following steps:
1. From the Installation Settings screen of YaST, select the Software tab.
Installing and Verifying the Linux Distribution 13
2. Under the Primary Functions heading, select Web and LAMP Server and under the Development heading, select C/C++ Compiler and Tools as displayed in Figure 3.
Figure 3 YaST Software Selection and System Tasks
3. Select the Details button to display a table with the detailed software package selections.
4. From the Filter options drop-down list, select Package Groups.
5. In the Package Groups pane, expand the Development group and select Languages from the expanded list.
Verify that the perl and python components are selected as displayed in Figure 4
Figure 4 SUSE Installation Settings
6. From the Productivity packages group, select Networking.
Verify that the apache2, apache2-prefork, php5, apache2-mod_perl, apache2-mod_php5, apache2-mod_python, and webalizer components are selected.

Verifying the Linux Distribution Installation

To verify installation of the necessary packages, enter the following command:
14
# rpm –q apache2 apache2-prefork apache2mod_perl apache2mod_python \ apache2–mod_php5 webalizer
If any of these packages are not installed, locate the RPM package on the Linux distribution media, and install the missing package.
NOTE: By default, the installation enables the iptables firewall, which prevents external systems from accessing ports below 1024. See “Appendix B: Frequently Asked Questions”
(page 53) and verify the firewall is disabled or the appropriate rules are set to allow the Apache
and Tomcat connection. The system verification steps described later in this document will not work if the iptables firewall is improperly configured.

Installing, Configuring, and Managing Web Server Middleware Stack Components

This section explains how to install, configure, and manage the Web Server middleware stack components not included in the Linux distribution along with other related components. All components are distributed as RPM packages or binaries, therefore, you can install and remove all the components separately. Table 1 (page 12) lists the appropriate version and additional information. You must install the following components separately:
SUN JDK
Tomcat

Configuring the Basic Apache HTTP Server

Use the following procedure to configure a basic Apache HTTP Server.
1. Start Apache by entering the following:
# /etc/init.d/apache2 start
2. Verify that Apache starts successfully by ensuring that messages similar to the following
appear in the log file /var/log/apache2/error_log:
[Sat Feb 03 12:41:21 2007] [notice] Apache/2.2.0 (Linux/SUSE) configured -- resuming normal operations
3. Create a file named /srv/www/htdocs/apache.html and add the following lines:
<HTML> <HEAD> </HEAD> <BODY DIR="LTR"> <P ALIGN=CENTER STYLE="margin-bottom: 0cm"> <FONT FACE="Times New Roman, serif"> <FONT SIZE=6>Apache http server worked !</FONT> </FONT></P> </BODY> </HTML>
Verify the Apache installation by opening a browser and entering the following website:
http://<YOUR_WEB_SERVER_IP>/apache.html
The following message appears:
Apache HTTP server worked !

Installing and Configuring Sun JDK on an HP Proliant System

For an HP Proliant system, the following procedure to install and configure a Sun Java Development Kit (JDK):
Installing, Configuring, and Managing Web Server Middleware Stack Components 15
1. Download the Sun JDK package from the Java website and install as follows (see Table 1
(page 12) for the correct version and website link):
Change to the Sun JDK install package directory, as appropriate for your system, and install the package by entering the following command:
# chmod 755 jdk-1_5_0_10-linux-amd64-rpm.bin
# ./jdk-1_5_0_10-linux-amd64-rpm.bin
2. Create a symbolic link for Sun JDK by entering the following:
# ln -s /usr/java/jdk1.5.0_10 /usr/local/jdk
3. The JAVA_HOME environment variable must be properly set before stack components, such as Tomcat, can begin executing.
To export the JAVA_HOME environment variable, modify the system file that is appropriate for your shell, /etc/profile.d/alljava.sh or /etc/profile.d/alljava.csh:
For the alljava.sh file, add the following lines:
if [ -x /usr/local/jdk/bin/java ] ; then export PATH=$PATH:/usr/local/jdk/bin export JAVA_BINDIR=/usr/local/jdk/bin export JAVA_ROOT=/usr/local/jdk export JAVA_HOME=/usr/local/jdk export JRE_HOME=/usr/local/jdk unset JDK_HOME unset SDK_HOME export JDK_HOME=/usr/local/jdk export SDK_HOME=/usr/local/jdk else if [ -x /usr/lib/java/jre/bin/java ] ; then # it is IBMJava2-JRE or SunJava2-JRE export PATH=$PATH:/usr/lib/java/jre/bin export JAVA_BINDIR=/usr/lib/java/jre/bin export JAVA_ROOT=/usr/lib/java export JAVA_HOME=/usr/lib/java/jre export JRE_HOME=/usr/lib/java/jre unset JDK_HOME unset SDK_HOME fi fi
For the alljava.csh file, add the following lines:
if ( -x /usr/local/jdk/bin/java ) then setenv PATH ${PATH}:/usr/local/jdk/bin setenv JAVA_BINDIR /usr/local/jdk/bin setenv JAVA_ROOT /usr/local/jdk setenv JAVA_HOME /usr/local/jdk setenv JRE_HOME /usr/local/jdk unsetenv JDK_HOME unsetenv SDK_HOME setenv JDK_HOME /usr/local/jdk setenv SDK_HOME /usr/local/jdk else if (-x /usr/lib/java/jre/bin/java)then #it is IBMJava2-JRE or SunJava2-JRE setenv PATH ${PATH}:/usr/lib/java/jre/bin setenv JAVA_BINDIR /usr/lib/java/jre/bin setenv JAVA_ROOT /usr/lib/java setenv JAVA_HOME /usr/lib/java/jre setenv JRE_HOME /usr/lib/java/jre unsetenv JDK_HOME unsetenv SDK_HOME endif endif
16
4. Log out of the system, and then log back in to start using the revised profile.
5. Verify the Sun JDK installation was successful by entering the following:
# java –version
The following messages appear:
java version "1.5.0_10" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_10-b03, mixed mode)

Installing and Configuring Tomcat

The following procedure provides the steps for installing and configuring Tomcat.
NOTE: Prior to installing Apache Tomcat, you must verify that JDK is installed and configured on your system.
1. Download the Tomcat Web Server package from the Apache Software Foundation website and follow the instructions provided to install it. See Table 1 (page 12) for the correct version and website link.
NOTE: In the following steps, it is assumed that Tomcat is installed in
/usr/local/apache-tomcat; if Tomcat is installed in a different directory, replace /usr/local/apache-tomcat with the correct path.
2. Set the CATALINA_HOME environment variable to the Tomcat directory path by editing /etc/profile and adding the following lines to the end of the file:
CATALINA_HOME=/usr/local/apache-tomcat export CATALINA_HOME
3. Log out of the system, and then log back in to it to start using the revised profile.
4. Start Tomcat by entering the following:
# /usr/local/apache-tomcat/bin/startup.sh
The following messages appear:
Using CATALINA_BASE: /usr/local/apache-tomcat Using CATALINA_HOME: /usr/local/apache-tomcat Using CATALINA_TMPDIR: /usr/local/apache-tomcat/temp Using JRE_HOME: /usr/local/jdk
5. Verify that the Tomcat installation once the startup is complete by opening a browser and entering the following URL:
http://<YOUR_TOMCAT_SERVER_IP>:8080
The Tomcat web page is displayed as in Figure 5.
Figure 5 Tomcat Successful Installation Verification
Installing, Configuring, and Managing Web Server Middleware Stack Components 17
NOTE: If the iptables firewall is enabled, you will not be able to connect to Tomcat from a remote computer.
6. If necessary, stop Tomcat by entering the following command:
# /usr/local/apache-tomcat/bin/shutdown.sh
The following messages appear:
Using CATALINA_BASE: /usr/local/apache-tomcat Using CATALINA_HOME: /usr/local/apache-tomcat Using CATALINA_TMPDIR: /usr/local/apache-tomcat/temp Using JRE_HOME: /usr/local/jdk

Advanced Apache HTTP Server Features

The following section describes several widely used Apache HTTP Server features.

Using the Apache HTTP Server Benchmarking Tool

The benchmarking tool is supplied with the Apache HTTP Server and is used to benchmark your Apache HTTP Server and monitor its performance. For example, you can use the benchmarking tool to perform concurrency requests to an Apache HTTP Server. Use the following command to start using the benchmarking tool:
# /usr/ab2
Additionally, you can verify the stability of the Apache HTTP Server by running a basic stress test on the test system. The following steps show a stress test for an example system:
1. Create a file using the following path name: /srv/www/htdocs/abtest.html
2. Add the following lines to the file you created in Step 1:
<HTML> <HEAD> </HEAD> <BODY DIR="LTR"> <P ALIGN=CENTER STYLE="margin-bottom: 0cm"> <FONT FACE="Times New Roman, serif"> <FONT SIZE=6>The page is used for Apache benchmarking test !</FONT> </FONT> </P> </BODY> </HTML>
3. Perform a concurrency request to the test system by logging into another system and entering the following command:
# ab2 -c 1000 -n 1000 http://<YOUR_WEB_SERVER_IP>/abtest.html
Where:
The value of the -n option sets the number of requests.
The value of the -c option sets the number of concurrency requests.
4. Monitor the access status on the test system by displaying the end of the access log file. To do this, enter the following command:
# tail -f /var/log/apache2/access_log
The system displays messages similar to the following:
10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev"
10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev"
10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev"
10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev"
10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev"
10.101.2.28 - - [03/Feb/2007:12:49:53 -0500] "GET / HTTP/1.0" 200 44 "-" "ApacheBench/2.0.40-dev"
18
Loading...
+ 39 hidden pages