Fedora7 + Tomcat6.0.13 + Apache2.2.4 + connectors Integration Process

Source: Internet
Author: User
Fedora7 + Tomcat6.0.13 + Apache2.2.4 + connectors integration process-Linux Enterprise Application-Linux server application information. See the following for details. Preface:
Install software:
1. jdk-1_5_0_06-linux-i586.bin
2. httpd-2.2.4.tar.gz
3. apache-tomcat-6.0.13.tar.gz
4. jakarta-tomcat-connectors-1.2.15-src.tar.gz
And put it in the/usr/local directory.

1. Install JDK
The LINUX version of JDK downloaded from the internet is generally in bin format.

1. Make the BIND file executable.
[Root @ localhost local] # chmod + x jdk-1_5_0_06-linux-i586.bin

2. Installation
[Root @ localhost loacl] #./jdk-1_5_0_06-linux-i586.bin

3. For ease of operation, it is necessary to create a JDK synchronization directory for the jdk1.5.0 _ 06 just installed.
[Root @ localhost local] # ln-s jdk1.5.0 _ 06 jdk

4. Set the environment variable JAVA_HOME (this variable will be used in Tomcat later ).
[Root @ localhost local] # vi/etc/profile
Add the following two lines at the end of the file
Export JAVA_HOME =/usr/local/jdk
Export CLASSPATH = $ JAVA_HOME/lib
Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH
Save and exit

5. Verify the setting of the variable. Skip this step if the installation is successful.
[Root @ localhost local] # echo $ JAVA_HOME
We will find that empty rows are returned.
Don't be alarmed. Just quit and log on to the system again.
Or run the command to make the environment variable take effect immediately.
[Root @ localhost local] source/etc/profile
[Root @ localhost/] # echo $ JAVA_HOME
/Usr/local/jdk
[Root @ localhost/] java? Version
Java version "1.5.0 _ 06"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.5.0 _ 06-b05)
Java HotSpot (TM) Client VM (build 1.5.0 _ 06-b05, mixed mode, sharing)
If this row is returned, the setting is successful. So far, your JDK has been installed.

Ii. install Tomcat
Tomcat installation is relatively simple. Unzip the package and run it.

1. Copy the installation package to the/usr/local directory for installation,
[Root @ localhost local] # tar-zxvf apache-tomcat-6.0.13.tar.gz

2. Create a synchronization directory named tomcat for apache-tomcat-6.0.13 after decompression.
[Root @ localhost local] # ln-s apache-tomcat-6.0.13 tomcat

3. Set the environment variable CATALINA_HOME and verify
[Root @ localhost local] # vi/etc/profile
Add the following line at the end of the file
Export CATALINA_HOME =/usr/local/tomcat
Save and exit
The process of verifying CATALINA_HOME is the same as that of verifying JAVA_HOME above.

4. Start and test the installation result.
[Root @ localhost local] # cd./tomcat/bin
[Root @ localhost bin] #./startup. sh
Using CATALINA_BASE:/usr/local/tomcat
Using CATALINA_HOME:/usr/local/tomcat
Using CATALINA_TMPDIR:/usr/local/tomcat/temp
Using JAVA_HOME:/usr/java/jdk
[Root @ localhost bin] # netstat-tnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN
Tcp 0 0 192.168.1.254: 53 0.0.0.0: * LISTEN
Tcp 0 0 192.168.2.254: 53 0.0.0.0: * LISTEN
Tcp 0 0 127.0.0.1: 53 0.0.0.0: * LISTEN
Tcp 0 0 127.0.0.1: 953 0.0.0.0: * LISTEN
Tcp 0 0: ffff: 127.0.0.1: 8005: * LISTEN
Tcp 0 0: 8009: * LISTEN
Tcp 0 0: 8080: * LISTEN
Tcp 0 0: 22: * LISTEN

Port 8080 and 8009 are already LISTEN

6. Open the browser, enter the host address and port number 8080, and press Enter.
For example, http: // 192.168.1.254: 8080
If the following figure is displayed, the installation is successful.

3. install Apache
Apache installation is also very simple, and each step is very simple.

1. Copy the installation package to/usr/local and decompress it in the target directory.
[Root @ localhost local] # cd/usr/local
[Root @ localhost local] # tar-zxvf httpd-2.2.4.tar.gz

2. Configure the installation parameters. The installation target directory is/usr/local/apache. We recommend that you set enable-mod-shared = all. Just comment out unnecessary modules!
[Root @ localhost local] # cd httpd-2.2.4
[Root @ localhost httpd-2.2.4] #./configure -- prefix =/usr/local/apache -- enable-so -- enable-mods-shared = all

3. Compile and install the SDK.
[Root @ localhost httpd-2.2.4] # make
[Root @ localhost httpd-2.2.4] # make install

4. Start Apache and test it.
[Root @ localhost httpd-2.2.4] # cd/usr/local/apache/bin
[Root @ localhost bin] #./apachectl start
Open your browser and enter the host IP address in the address bar.
For example, http: // 192.168.1.254
If the following figure is displayed, the installation is successful.
It works!

4. Generate the mod_jk.so Connector
1. copy the source package to/usr/local and decompress it in the target directory (of course, it is also possible to decompress it in the original directory, the author puts all programs installed under/usr/local for Standardization ).
[Root @ localhost bin] # cd/usr/local
[Root @ localhost local] # tar-zxvf jakarta-tomcat-connectors-1.2.15-src.tar.gz

2. Create a ctor synchronization directory to simplify operations.
[Root @ localhost local] # ln-s jakarta-tomcat-connectors-jk2-2.0.4-src connector

3. Compile the configuration. You must note that the first three of these parameters are very important. If necessary, you can go to the corresponding directory to check whether the related files exist.
[Root @ localhost local] # cd connector/native
[Root @ localhost native] #./buildconf. sh
[Root @ localhost native] #. /configure -- with-apxs =/usr/local/apache/bin/apxs -- with-tomcat =/usr/local/tomcat -- with-java-home =/usr/java/ jdk -- with-jni

4. Compile
[Root @ localhost apache] # make

5. Run apxs under apache. If the following result is returned, it is normal.
[Root @ localhost native] # cd apache-2.0
[Root @ localhost apache-2.0] #/usr/local/apache/bin/apxs-n jk2-I mod_jk.so
/Usr/local/apache/build/instdso. sh SH_LIBTOOL = '/usr/local/apache/build/libtool 'mod_jk2.so/usr/local/apache/modules
/Usr/local/apache/build/libtool -- mode = install cp mod_jk.so/usr/local/apache/modules/
Cp mod_jk.so/usr/local/apache/modules/mod_jk.so
Warning! Dlname not found in/usr/local/apache/modules/mod_jk.so.
Assuming installing a. so rather than a libtool archive.
Chmod 755/usr/local/apache/modules/mod_jk.so

[Root @ localhost apache-2.0] #
Ll/usr/local/apache/modules/mod_jk.so
-Rwxr-xr-x 1 root 709215 08-14 10:22/usr/local/apache/modules/mod_jk.so
Mod_jk.so is generated successfully.

5. Configuration explanation jsp
1. Configure jk2.properties of Tomcat
[Root @ localhost apache] # cd/usr/local/tomcat/conf
[Root @ localhost conf] # vi jk2.properties

# ChannelUnix. file =$ {jkHome}/work/jk2.socket
# Just to check if the config is working
Shm. file =/usr/local/apache/logs/jk2.shm

# In order to enable jni use any channelJni direve ve
# ChannelJni. disabled = 0
# And one of the following ctictives:

2. Create the file workers. properties in the conf directory of Apache, and add the following lines
[Root @ localhost conf] # vi workers. properties
You can add a virtual directory for Tomcat.
[Uri:/examples/*]
In this way, you can access examples
# ------ Start ---------
[Shm]
File =/usr/local/apache/logs/shm. file
Size = 1048576
[Channel. socket: localhost: 8009]
TomcatId = localhost: 8009
[Uri:/examples/*]
# -------- End ------------
Save and exit

3. Configure Apache/usr/local/apache/conf/httpd. conf and add a line after LoadModule,
LoadModule jk_module modules/mod_jk.so
When Apache is started, mod_jk.so is loaded.
[Root @ localhost conf] # cd/usr/local/apache/conf
[Root @ localhost conf] # vi httpd. conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile/usr/local/apache/conf/workers. properties
JkShmFile/usr/local/apache/logs/k2.shm

4. apache2.2.4 you can configure the VM using the extension file remove Include conf/extra/httpd-vhosts.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Turn on:/usr/local/apache/conf/extra/httpd-vhosts.conf
Add the following content (modify as needed)

Options FollowSymLinks
AllowOverride None
Order allow, Deny
Allow from all



ServerAdmin hacder@hstc.edu.cn
DocumentRoot "/var/www/html/www"
ServerName www.mc333.com
UserDir "/var/www/html/www"
JkMount/*. jsp ajp13
CustomLog logs/www.mc333.com-access_log common



Order allow, deny
Deny from all


5. Copy the tomcat Example to the apache example directory for testing:
# Cp? R/usr/local/tomcat/webapps/examples // usr/local/apache/htdocs/

6. Start tomcat, apache, and perform tests.
[Root @ localhost conf] # cd/usr/local/tomcat/bin
[Root @ localhost bin] #./shutdown. sh
[Root @ localhost bin] #./startup. sh
Using CATALINA_BASE:/usr/local/tomcat
Using CATALINA_HOME:/usr/local/tomcat
Using CATALINA_TMPDIR:/usr/local/tomcat/temp
Using JAVA_HOME:/usr/local/jdk
[Root @ localhost bin] # cd/usr/local/apache/bin
[Root @ localhost bin] #./apachectl restart
Open your browser and enter http: // host address/examples
For example, http: // 192.168.1.254/examples/jsp

Test whether the jsp file can be opened normally. If yes, congratulations!

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.