Wednesday, August 22, 2012

APACHE 2 + TOMCAT 7 + GEOSERVER



Installing Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04 or linode a cloud platform powered on linux distros


This is a tutorial on how to install Tomcat and Apache2, and then configure to connect the Apache Web Server to Tomcat using mod_jk and then drop a war file for geoserver.
Login as root in the LINODE instance by issuing the following commands

su root

A password prompt appears prompting you to supply the password. Issue the following command to install Apache:

apt-get install apache2













Test the installation from the browser using http://localhost/

apt-get install tomcat7
apt-get install tomcat7-admin


Issue the following command

apt-get install libapache2-mod-jk

First lets enable the redirect port 8443 on Tomcat by issuing the following command

vim /etc/tomcat7/server.xml

and uncomment the following line

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />











Now we will create our workers.properties file for Apache. 

vim /etc/apache2/workers.properties

Copy and paste the text below;

# Define 1 real worker using ajp13
worker.list=worker1, worker2
# Set properties for worker (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

# Define second  real worker using ajp13
# Set properties for worker (ajp13)
worker.worker2.type=ajp13
worker.worker2.host=localhost
worker.worker2.port=8010
















Issue the command to save and quit

:wq

Ask Apache to use this worker 

vim /etc/apache2/mods-available/jk.conf

Change the JkWorkersFile property to;

/etc/apache2/workers.properties















Finally configure the URL so that Apache web server should pass through to Tomcat servlet requests

vim /etc/apache2/sites-enabled/000-default

and add the following line in your opened file in the terminal

<VirtualHost *:80>
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
JkMount /apps* worker1
JkMount /geoserver* worker2
</VirtualHost *:80>


















Now, restart the servers

/etc/init.d/tomcat7 restart
/etc/init.d/apache2 restart



Download a web archive file (*.war) from GeoServer downloads

Copy file to Tomcat7 Directory root folder

cp /home/administrator/Downloads/geserver-2.1.4.zip  /var/lib/tomcat7/webapps

Unzip the file by issuing the below command in the terminal.

unzip geoserver-2.1.4.zip

Immediately, your geoserver-2.1.4.war file is exploded by tomcat7 into a folder.The folder is called GeoServer. Test GeoServer by typing on your browser http://localhost/geoserver. An example can be shown from this link.

1 comment: