Tuesday, March 10, 2009

Install Tomcat 6 on Debian (Lenny) with virtual hosts and Apache2 integration

in this case i want "Install Tomcat 6 on Debian 5.0 (Lenny) with virtual hosts and Apache2 integration" . i'll write step by step :

1. you should have installed DEBIAN Linux 5.0 (codename LENNY) already.
2. install jdk6 (java sdk version 1.6) on your system.
3. install Apache2
in debian you must be root then type apt-get install apache2
4. download tomcat6, then install it
4a. extract tomcat6 tar bal
tar -zxvf apache-tomcat-6.0.18.tar.gz
mkdir /usr/local/tomcat6
mv apache-tomcat-6.0.18 /usr/local/tomcat6


i have installed tomcat6 on /usr/local/tomcat6 directory

4b. create tomcat6 init-script (in my indonesian blog)

4c. Activate tomcat-manager (see my indonesian blog)
vim /usr/local/tomcat6/conf/tomcat-users.xml

then restart your tomcat6, it will make a change

5. install mod_jk connector (mod_jk.so)
apt-get install libapache2-mod-jk

6. edit file workers.properties
vim /etc/apache2/workers.properties

workers.tomcat_home=/usr/local/tomcat6
workers.java_home=/usr/local/java6
ps=/
worker.list=default
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1


7. edit file jk.conf
vim /etc/apache2/conf.d/jk.conf (see my indonesian blog)

8. create virtualhost

mkdir /var/www/vhost1

mkdir /var/www/vhost1/htdocs

mkdir /var/www/vhost1/logs


*** edit file /etc/apache2/sites-available/vhost1 (see my indonesian blog)

login as root and type
a2ensite vhost1
/etc/init.d/apache2 reload


9. configure file server.xml (see my indonesian blog)

vim /usr/local/tomcat6/conf/server.xml

10. restart tomcat6 then apache2

11. on your browser (internet explorer, mozila) type
http://www.vhost1.com/index.jsp

http://www.vhost1.com/examples

your request should apache2 connect to tomcat6

12. try it & good luck

2 comments:

Anonymous said...

thanks your info

Anonymous said...

a good tutorial & i have been try it.
nice, it works
thanks friend