old-www/HOWTO/Enterprise-Java-for-Linux-H...

268 lines
10 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Enterprise Java for Linux HOWTO: How to Setup the Web Server </TITLE>
<LINK HREF="Enterprise-Java-for-Linux-HOWTO-4.html" REL=next>
<LINK HREF="Enterprise-Java-for-Linux-HOWTO-2.html" REL=previous>
<LINK HREF="Enterprise-Java-for-Linux-HOWTO.html#toc3" REL=contents>
</HEAD>
<BODY>
<A HREF="Enterprise-Java-for-Linux-HOWTO-4.html">Next</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO-2.html">Previous</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO.html#toc3">Contents</A>
<HR>
<H2><A NAME="sec: web"></A> <A NAME="s3">3. How to Setup the Web Server </A></H2>
<P>
<P>There are several Web Servers available for Linux. These include:
<UL>
<LI>
<A HREF="#sec: apache">Apache </A></LI>
<LI>
<A HREF="#sec: domino">IBM Domino </A></LI>
<LI>
<A HREF="#sec: ibmhttp">IBM HTTP Server </A></LI>
<LI>
<A HREF="#sec: jetty">Jetty HTTP Server</A></LI>
</UL>
<P>If you are going to try just one Web Server, I suggest you initially try
Apache, principally because it comes with most major Linux distributions and
may already be installed, and perhaps running, on your system.
<H2><A NAME="sec: apache"></A> <A NAME="ss3.1">3.1 Apache </A>
</H2>
<P>
<H3>Background </H3>
<P>
<P>Apache is the most popular HTTP server on the Internet. It was originally
based upon the NCSA httpd and has since been completely rewritten. It is Open
Source licensed. (From the Apache website.)
<H3>Download, Installation, and Setting up Your Environment </H3>
<P>
<P>Rather than downloading from Apache, I suggest you initially try the Apache
that most likely came with your Linux distribution.
<P>Alternatively, Apache can be obtained from
<A HREF="http://www.apache.org">http://www.apache.org</A>.
<H3>Confirming Your Installation </H3>
<P>
<P>To confirm that Apache is installed and running on your computer, open
your web browser, and enter the URL: &quot;http://127.0.0.1&quot;. (127.0.0.1
is the IP address for the localhost.)
<P>You should see a web page to the effect of &quot;It Worked!&quot;
<P>If it did not work, you can confirm that Apache is installed by typing
the following on a RedHat Package Manager (RPM)-based Linux distribution.
<PRE>
rpm -q | grep apache
</PRE>
<P>To start Apache, type:
<PRE>
cd /etc/rc.d/init.d
./httpd start
</PRE>
<P>Note: The httpd script used at boot time may be in a different location
on other Linux distributions.
<P>For more assistance, I suggest you look into the Apache FAQ at
<A HREF="http://www.apache.org/docs/misc/FAQ.html">http://www.apache.org/docs/misc/FAQ.html</A>.
<P>
<H2><A NAME="sec: domino"></A> <A NAME="ss3.2">3.2 IBM Domino </A>
</H2>
<P>
<P>To be written.
<P>See
<A HREF="http://www.lotus.com/dominolinux">http://www.lotus.com/dominolinux</A>for
more information.
<H2><A NAME="sec: ibmhttp"></A> <A NAME="ss3.3">3.3 IBM HTTP Server </A>
</H2>
<P>
<H3>Background </H3>
<P>
<P>The IBM HTTP Server is an IBM repackaging of Apache. You might consider
using the IBM HTTP Server if you plan on working with IBM WebSphere.
<P>At the time of this writing, the most recent version is 1.3.6.1.
<H3>Download </H3>
<P>
<P>The IBM HTTP Server can be obtained from
<A HREF="http://www-4.ibm.com/software/webservers/httpservers/download.html">http://www-4.ibm.com/software/webservers/httpservers/download.html</A>.
<P>
<P>Click on the download link and select 56-bit or 128-bit SSL encryption.
<P>
<P>You will need to register with IBM, fill out a marketing survey, and accept
the license agreement before downloading. The IBM HTTP Server requires glibc
either version 2.0 or 2.1. glibc is the new Linux libc. If you have an older
distribution that is based upon libc5, you will not be able to use the IBM
HTTP Server.
<P>On an RedHat Package Manager (RPM)-based Linux distribution, you can run:
<P>
<PRE>
rpm -qa | grep libc
</PRE>
<P>You will see output such as:
<PRE>
glibc-2.1.2-11
libc-5.3.12-31
</PRE>
<P>This will show you which versions of libc5 and glibc you have installed
on your Linux distribution. In my above example I have both glibc and libc5
installed on my system. glibc is version 2.1, so I would want to download
the files for glibc2.1.
<P>I suggest downloading all of the tar files for the glib version of Linux
that you have as they are relatively small. However, minimally you will need
the server file. For RedHat 6.0 and distributions derived from Redhat 6.0
you will also need the redhat60only. For glibc2.0 based distributions you
will also need the libstdc file.
<H3>Installation </H3>
<P>
<P>I suggest installing files in the /usr/local directory. After downloading
the files, run:
<PRE>
mkdir /usr/local/ibm
mv HTTPServer.linux.* /usr/local/ibm
</PRE>
<P>You can now open the distribution package file or files.
<PRE>
tar xvf [filename].tar
</PRE>
<P>Where [filename] is the name of the file.
<P>Under the /usr/local/ibm directory, you now should see the directory IHS.
<P>
<P>Use the RedHat Package Manager (RPM) to install the rpm files that the
tar file produced. If you needed the libstdc file, you will need to install
that file first. Then you would install the server RPM file such as:
<PRE>
cd IHS
rpm -i IBM_HTTP_Server-1.3.6-2.i386.rpm
</PRE>
<P>The above example shows version 1.3.6 for the Intel architecture. Substitute
the filename as appropriate.
<P>After installing you can delete the rpm files as they can be easily recreated
from the tar files.
<H3>Setting up Your Environment </H3>
<P>
<P>The environment variables to set up are:
<UL>
<LI>PATH</LI>
</UL>
<P>The IBM HTTP Server installed itself into /opt/IBMHTTPServer. You need
to add its bin directory to your PATH.
<PRE>
export PATH=/opt/IBMHTTPServer/bin:$PATH
</PRE>
<P>Note that /opt/IBMHTTPServer/bin was added to the front of the PATH so
that the installed Web Server will be used rather than any Web Server that
might have come with your Linux distribution.
<P>To confirm that your PATH is correctly set up, check which Apache controller
will be used. Type:
<PRE>
which apachectl
</PRE>
<P>The output should reference apachectl in the /opt/IBMHTTPServer/bin directory.
<P>
<P>Note: because the IBM HTTP Server is based upon Apache, it uses the Apache
controller to start and stop it. When you have both the IBM HTTP Server and
Apache installed on a computer, take particular care to your PATH to make sure
you are working with the correct server.
<P>You may need to modify the IBM HTTP Server configuration file. The configuration
file was installed in /opt/IBMHTTPServer/conf/httpd.conf. The most common
two entries that need to be changed are the ServerName and the Listen port
number. Look for the key words &quot;ServerName&quot; and &quot;Listen&quot;
in the httpd.conf file. The ServerName should be set to either your hostname
or IP address. If your computer uses DHCP to acquire an IP address, the hostname
is a better candidate. However, in order to use your computer's hostname,
your computer's hostname and IP address must be properly registered in DNS.
<P>
<P>Additionally if you are running another Web server on the computer you
need to assign the IBM HTTP Server to another port so you can run both Web
servers simultaneously if necessary.
<P>The following is an example entry in httpd.conf.
<PRE>
ServerName 192.168.0.4
Listen 3000
</PRE>
<H3>Confirming Your Installation </H3>
<P>
<P>To start the IBM HTTP Server, type the following:
<PRE>
/opt/IBMHTTPServer/bin/apachectl start
</PRE>
<P>To confirm that the IBM HTTP Server is installed and running on your computer,
open your web browser, and enter the URL: &quot;http://192.168.0.4:3000&quot;
substituting the correct IP address and port number entered into httpd.conf.
<P>
<P>You should see a web page to the effect of &quot;Welcome to the IBM HTTP
Server&quot;. Contratulations, you have installed, set up an environment for,
and tested the IBM HTTP Server for Linux.
<H3>More Information</H3>
<P>
<P>For more information, I suggest you look into the IBM HTTP Server Support
page at
<A HREF="http://www-4.ibm.com/software/webservers/httpservers/support.html">http://www-4.ibm.com/software/webservers/httpservers/support.html</A>.
<P>
<H2><A NAME="sec: jetty"></A> <A NAME="ss3.4">3.4 Jetty HTTP Server and Servlet Container </A>
</H2>
<P>
<H3>Background </H3>
<P>Jetty is an Open Source HTTP Servlet Server written in 100% Java.
It is both a full featured HTTP/1.1 server and a Servlet Container.
It is designed to be light weight, high performance, embeddable, extensible
and flexible, thus making it an ideal platform for serving dynamic HTTP
requests from any Java application.
<P>Jetty can be used as a stand-alone HTTP server and servlet container or
it can be embedded in another java application (eg. the JBoss EJB container
is using Jetty as it's prefered server and container solution).
<P>As a combined server and servlet container, both these functions run
efficiently in a single unix process. Installation and configuration
is also simpler as a single application.
<P>
<H3>Download</H3>
<P>The Jetty HTTP Server and Servlet container may be downloaded via:
<P>
<A HREF="http://jetty.mortbay.org">http://jetty.mortbay.org</A>.
<P>Jetty is distributed under the artistic license, full source is included and
it can be used and distributed commercially.
<P>
<H3>Installation </H3>
<P>The package is distributed as a gzipped tar file, which can be
unpacked with:
<PRE>
gunzip &lt; Jetty-x.x.x.tgz | tar xf -
</PRE>
<P>Which will create a Jetty-x.x.x directory where x.x.x is the version
number.
<P>
To run the demo server:
<PRE>
export JETTY_HOME=&lt;jetty install directory>
export JAVA_HOME=&lt;JRE install directory>
$JETTY_HOME/bin/jetty.sh run
</PRE>
Then to see the Jetty demo and tutorial point a browser at
<A HREF="http://localhost:8080">http://localhost:8080</A>.
<P>Jetty can also be installed and run via JMX or as part of the JBoss
distributions. See
<A HREF="http://jetty.mortbay.org">http://jetty.mortbay.org</A>
or the README.TXT file for more details.
<P>
<HR>
<A HREF="Enterprise-Java-for-Linux-HOWTO-4.html">Next</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO-2.html">Previous</A>
<A HREF="Enterprise-Java-for-Linux-HOWTO.html#toc3">Contents</A>
</BODY>
</HTML>