FreeBSD Minimal installation +diablo-jdk +apache and TOMCAT integration!

Source: Internet
Author: User
Tags gettext java web

This article is to make up a long time ago a homework, also by the way to quell many students in the jar of doubt.

Let me explain the general situation of the configuration environment:
OS FreeBSD 6.2-release
Jdk diablo-jdk-1.5.0.07.01
Apache apache-2.2.3
Tomcat tomcat-5.5.23

The specific version information appears as follows:

[Root@freebsd ~] $ pkg_info
apache-2.2.3 Version 2.2 The Apache Web server with Prefork MPM.
bash-3.1.17 the GNU Project ' s Bourne Again SHell
cvsup-without-gui-16.1h_2 General Network file distribution system optimized for CVS
diablo-jdk-1.5.0.07.01 Java Development Kit 1.5.0_07.01
Expat-2.0.0_1 XML 1.0 parser written in C
fontconfig-2.3.2_6,1 an xml-based font configuration APIs for X Windows
Freetype2-2.2.1_1 A free and portable TrueType font rendering engine
Gettext-0.14.5_2 GNU GetText Package
Gmake-3.81_1 GNU version of ' make ' utility
javavmwrapper-2.3 wrapper script for various Java Virtual machines
libdrm-2.0.2 userspace interface to kernel Direct Rendering Module Servi
Libiconv-1.9.2_2 A Character Set conversion library
mod_jk-ap2-1.2.21,1 Apache JK Module for connecting to Tomcat using ajp1x
perl-5.8.8 Practical Extraction and Language
pkg-config-0.21 A Utility to retrieve information about installed libraries
tomcat-5.5.23 open-source Java Web server by Apache, 5.5.x Branch
xorg-libraries-6.9.0 X11 libraries and headers from x.org

OK, let's take a look at the specific approach.

Step One: Install the FreeBSD and take the steps of minimizing the installation.

There is nothing special here, just a reminder that after the installation is complete notice to update to the latest ports tree.

Because it is a minimized installation, it is necessary to install the following several package via Sysinstall (via CD-ROM):
Cvsup-without-gui # Update Ports tree needs
Perl # Perl, of course, is what many places need ... ^^!
Gmake # When installing MOD_JK requires bash # I'm not familiar with C Shell, so I installed this in addition
After completing the installation, update ports tree, I used the cvsup. Freebsdchina.org as mirroring.

Step Two: Install the JDK 1.5 package released by Jdk-freebsd

Wordy, the era of compiling JDK from source code has passed, I am lazy, so I like to use Pkg_add.

If you want to compile JDK from ports, you can look here: compiling JDK in FreeBSD

2.1 Download DIABLO-JDK Packages: diablo-jdk-freebsd6.i386.1.5.0.07.01.tbz

2.2 Find dependencies for DIABLO-JDK:

[Root@freebsd/usr/ports] $ make search name=diablo-jdk-1.5.0.07.01
port:diablo-jdk-1.5.0.07.01
Path:/usr/ports/java/diablo-jdk15
Info:java Development Kit 1.5.0_07.01
maint:glewis@freebsd.org
B-deps:expat-2.0.0_1 fontconfig-2.3.2_6,1 freetype2-2.2.1_1 libdrm-2.0.2 pkg-config-0.21 xorg-libraries-6.9.0
R-deps:expat-2.0.0_1 fontconfig-2.3.2_6,1 freetype2-2.2.1_1 javavmwrapper-2.3 libdrm-2.0.2 pkg-config-0.21 xorg-libraries-6.9.0
Www:http://www.freebsdfoundation.org/downloads/java.shtml

You can see that there are several packages that need to be installed:
Expat-2.0.0_1 fontconfig-2.3.2_6,1 freetype2-2.2.1_1 libdrm-2.0.2 pkg-config-0.21 xorg-libraries-6.9.0 javavmwrapper-2.3 2.3 Software packages needed to install DIABLO-JDK from the network (not the Ports compilation installation method)

[Root@freebsd ~] $ setenv packagesite ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/i386/packages-6.2-release/Latest/
[Root@freebsd ~] $ pkg_add-r Expat
[Root@freebsd ~] $ pkg_add-r FreeType
[Root@freebsd ~] $ pkg_add-r fontconfig
[Root@freebsd ~] $ pkg_add-r ... Omitted...
[Root@freebsd ~] $ pkg_add-r xorg-libraries
[Root@freebsd ~] $ pkg_add-r Javavmwrapper

Note: When using Pkg_add, there is no version number with the package.

* There is no debian/ubuntu in the apt-get feeling ah. ^^!

2.4 Install DIABLO-JDK, directly find our downloaded JDK package file, add with Pkg_add:

[Root@freebsd ~] $ pkg_add DIABLO-JDK-FREEBSD6.I386.1.5.0.07.01.TBZ
[Root@freebsd ~] $/usr/local/diablo-jdk1.5.0/bin/java-version
Java Version "1.5.0"
Java (TM) 2 Runtime environment, Standard Edition (build diablo-1.5.0-b01)
Java HotSpot (TM) Client VM (build diablo-1.5.0_07-b01, Mixed mode)

Remind:
When installed, will come out of the Sun's license agreement, you can agree. Installation will say Javawmwrapper version is a bit high, you can ignore.
Step Three: Install Tomcat

3.1 Grab the tomcat file down:

[Root@freebsd ~] $ cd/usr/ports/www/tomcat55
[Root@freebsd Tomcat55] $ make
===> vulnerability check disabled, database not found
=> apache-tomcat-5.5.23.tar.gz doesn ' t seem to exist in/usr/ports/distfiles/.
=> attempting to fetch from http://www.apache.org/dist/tomcat/tomcat-5/v5.5.23/bin/.
apache-tomcat-5.5.23.tar.gz 100% of 5837 KB 00m00s
===> Extracting for tomcat-5.5.23
=> MD5 Checksum OK for apache-tomcat-5.5.23.tar.gz.
=> SHA256 Checksum OK for apache-tomcat-5.5.23.tar.gz.
===> Patching for tomcat-5.5.23
Installation settings:
Destination directory:/usr/local/tomcat5.5
Location of JDK:/usr/local/diablo-jdk1.5.0
Location of Java port:java/diablo-jdk15
Running as (user/group): www/www
HTTP port:8180
Shutdown Listener port:8005
AJP 1.3 Connector port:8009
Logfile stdout:/usr/local/tomcat5.5/logs/stdout.log
Logfile stderr:/usr/local/tomcat5.5/logs/stderr.log
===> applying FreeBSD patches for tomcat-5.5.23
>> Removing unneeded files ... [Done]
>> Customizing Server.xml ... [Done]
===> Configuring for tomcat-5.5.23

3.2 Install Tomcat

[Root@freebsd tomcat55] $ make install
===> Installing for tomcat-5.5.23
===> tomcat-5.5.23 depends on file:/usr/local/diablo-jdk1.5.0/bin/java-found
===> Generating Temporary packing list
===> Checking if www/tomcat55 already installed
>> Creating destination Directory ... [Done]
>> copying files to destination directory ...
Installing local configuration file:/usr/local/tomcat5.5/conf/catalina/localhost/host-manager.xml
Installing local configuration file:/usr/local/tomcat5.5/conf/catalina/localhost/manager.xml
Installing local configuration file:/usr/local/tomcat5.5/conf/catalina.policy
Installing local configuration file:/usr/local/tomcat5.5/conf/catalina.properties
Installing local configuration file:/usr/local/tomcat5.5/conf/context.xml
Installing local configuration file:/usr/local/tomcat5.5/conf/logging.properties
Installing local configuration file:/usr/local/tomcat5.5/conf/server-minimal.xml
Installing local configuration file:/usr/local/tomcat5.5/conf/server.xml
Installing local configuration file:/usr/local/tomcat5.5/conf/tomcat-users.xml
Installing local configuration file:/usr/local/tomcat5.5/conf/web.xml
[Done]
>> Creating log files ... [Done]
>> creating symlink to Tools.jar ... [Done]

Step Fourth: Install Apache Web Server


[Root@freebsd ~] $ pkg_add-r Apache22


Fifth step: The integration of Apache Web Server and Tomcat

5.1 Prerequisite Component MOD_JK Installation

[ROOT@FREEBSD/USR/PORTS/WWW/MOD_JK] $ make
===> vulnerability check disabled, database not found
=> tomcat-connectors-1.2.21-src.tar.gz doesn ' t seem to exist in/usr/ports/distfiles/.
=> attempting to fetch from http://www.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.21/.
=> attempting to fetch from http://www.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.21/.
tomcat-connectors-1.2.21-src.tar.gz 100% of 1303 KB/KBps 00m00s
===> Extracting for mod_jk-ap2-1.2.21,1
=> MD5 Checksum OK for tomcat-connectors-1.2.21-src.tar.gz.
=> SHA256 Checksum OK for tomcat-connectors-1.2.21-src.tar.gz.
===> Patching for mod_jk-ap2-1.2.21,1
===> applying FreeBSD patches for mod_jk-ap2-1.2.21,1
===> mod_jk-ap2-1.2.21,1 depends on file:/usr/local/sbin/apxs-found
===> mod_jk-ap2-1.2.21,1 depends on executable in:gmake-found
===> mod_jk-ap2-1.2.21,1 depends on file:/usr/local/sbin/apxs-found
===> Configuring for mod_jk-ap2-1.2.21,1
... Omitted...
... Omitted...
... Omitted...
Making all in common
GMAKE[1]: Entering directory '/usr/ports/www/mod_jk/work/tomcat-connectors-1.2.21-src/native/common '
GMAKE[1]: Nothing is done for ' all '.
GMAKE[1]: Leaving directory '/usr/ports/www/mod_jk/work/tomcat-connectors-1.2.21-src/native/common '
Making all in apache-2.0
GMAKE[1]: Entering directory '/usr/ports/www/mod_jk/work/tomcat-connectors-1.2.21-src/native/apache-2.0 '
GMAKE[1]: Nothing is done for ' all '.
GMAKE[1]: Leaving directory '/usr/ports/www/mod_jk/work/tomcat-connectors-1.2.21-src/native/apache-2.0 '

[ROOT@FREEBSD/USR/PORTS/WWW/MOD_JK] $ make install

5.2 Edit the/usr/local/etc/apache22/httpd.conf file and add the following:

LoadModule Jk_module libexec/apache/mod_jk.so

5.3 Establish the document/USR/LOCAL/ETC/APACHE22/INCLUDES/TOMCAT-APACHE.CONF, the contents are as follows:

[Root@freebsd Includes] $ cat tomcat-apache.conf
Jkworkersfile/usr/local/tomcat5.5/conf/workers.properties

Jklogfile/var/log/mod_jk.log
Jkloglevel Info

Jkmount/*.jsp ajp13
jkmount/jsp-examples/* ajp13
jkmount/servlets-examples/* ajp13
jkmount/servlet/* ajp13

* Jkmount is a mapping of the URI in Tomcat to the URI of Apache, which means:

Apache: http://localhost/jsp-examples/some-jsp-file.jsp
<----corresponding--->
Tomcat: http://localhost:<port>/jsp-examples/some-jsp-file.jsp

5.4 Create MOD_JK log files and set the users and groups to which they belong:

[Root@freebsd ~] $ touch/var/log/mod_jk.log
[Root@freebsd ~] $ chown Www:www/var/log/mod_jk.log

5.5 Establish/usr/local/tomcat5.5/conf/workers.properties files:

[Root@freebsd ~] $ cat/usr/local/tomcat5.5/conf/workers.properties
workers.tomcat_home=/usr/local/tomcat5.5
workers.java_home=/usr/local/diablo-jdk1.5.0
ps=/
WORKER.LIST=AJP12, AJP13
worker.ajp13.port=8009
Worker.ajp13.host=localhost
Worker.ajp13.type=ajp13

5.5 Users and groups who change the Workers.properties file attribution:

[Root@freebsd ~] $ chown www:www/usr/local/tomcat5.5/conf/workers.properties

5.6 Determine if the AJP feature is open in the Tomcat configuration file Server.xml:

<!--Define an AJP 1.3 Connector--->
<connector classname= "Org.apache.ajp.tomcat4.Ajp13Connector"
Port= "8009" minprocessors= "5" maxprocessors= "75"
Acceptcount= "Ten" debug= "0"/>

* This paragraph cannot be looked at.

Step Sixth: Test

6.1 Start Service

[Root@freebsd ~] $/usr/local/etc/rc.d/tomcat55 OneStart
Starting tomcat55.
[Root@freebsd ~] $/usr/local/etc/rc.d/apache22 OneStart
Performing sanity check on APACHE22 configuration:
Syntax OK
Starting Apache22.

6.2 Test

http://localhost/---> Presence apache information: It works!
http://localhost/index.jsp---> The Tomcat Welcome page appears

This means that Apache is handing the JSP processing to Tomcat.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.