cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@cocoon.apache.org
Subject [Cocoon Wiki] New: BeginnerInstallationDefaultHost
Date Mon, 17 May 2004 17:59:48 GMT
   Date: 2004-05-17T10:59:48
   Editor: 217.233.206.42 <>
   Wiki: Cocoon Wiki
   Page: BeginnerInstallationDefaultHost
   URL: http://wiki.apache.org/cocoon/BeginnerInstallationDefaultHost

   no comment

New Page:

== Installing Cocoon as Default Host on Tomcat ==

This description is created on a SuSE Linux 9.0 system with Tomcat 5.0.19 and j2sdk1.4.2_04
installed. As a good starting point for doing virtual hosting with Cocoon, Cocoon will be
the default host and will listen to [http://cocoon:8080/] instead of [http://localhost:8080/cocoon/].

Tomcat is already installed in /opt and Cocoon, as shown below, will be installed there as
well instead of being deployed to Tomcat's "webapps" directory. 

{{{
volkmar@linux:/opt> ls -al
total 3
drwxr-xr-x   14 root     root          400 May  5 16:25 .
drwxr-xr-x   21 root     root          488 May  5 13:28 ..
drwxr-xr-x    6 root     root          352 Apr  1 10:27 OpenOffice.org1.1.1
drwxr-xr-x    3 root     root           72 May  5 16:37 cocoon
drwxr-xr-x    9 root     root          216 Jan 15 07:51 gnome
drwxr-xr-x   12 root     root          376 May  5 17:34 jakarta-tomcat-5
drwxr-xr-x    6 root     root          144 Apr 17 06:37 kde3
volkmar@linux:/opt>
}}}

== Download Cocoon-2.1.4 ==
Go to the directory you are using for downloads and create a subdirectory "cocoon". Step into
this "cocoon" directory and WGET Cocoon an its MD5 hash from the download server.
{{{volkmar@linux:~> cd /tmp/
volkmar@linux:/tmp> mkdir cocoon
volkmar@linux:/tmp> cd cocoon/
volkmar@linux:/tmp/cocoon>
volkmar@linux:/tmp/cocoon> wget -nd http://www.apache.org/dist/cocoon/cocoon-2.1.4-src.tar.gz.md5
--15:33:55--  http://www.apache.org/dist/cocoon/cocoon-2.1.4-src.tar.gz.md5
           => `cocoon-2.1.4-src.tar.gz.md5'
volkmar@linux:/tmp/cocoon> wget -nd http://www.apache.org/dist/cocoon/cocoon-2.1.4-src.tar.gz
--15:33:56--  http://www.apache.org/dist/cocoon/cocoon-2.1.4-src.tar.gz
           => `cocoon-2.1.4-src.tar.gz'
}}}
== Test MD5SUM ==
After download is complete you should check MD5 sum of your download. "Either do md5sum -c
*.md5" or check it manually.
{{{
volkmar@linux:/tmp/cocoon> md5sum cocoon-2.1.4-src.tar.gz
65a099094217ef0621e832ad5aa1cfc9  cocoon-2.1.4-src.tar.gz
volkmar@linux:/tmp/cocoon> cat cocoon-2.1.4-src.tar.gz.md5
65A099094217EF0621E832AD5AA1CFC9  cocoon-2.1.4-src.tar.gz
volkmar@linux:/tmp/cocoon>
}}}
== Unpack tar.gz ==
Unpacking "cocoon-2.1.4-src.tar.gz" will create a new directory "cocoon-2.1.4".
{{{
volkmar@linux:/tmp/cocoon> tar xzf cocoon-2.1.4-src.tar.gz
volkmar@linux:/tmp/cocoon> ls -al
insgesamt 37717
drwxr-xr-x    3 volkmar  users         168 2004-05-05 15:48 .
drwxr-xr-x    5 volkmar  users         128 2004-02-22 11:03 ..
drwxr-xr-x    6 volkmar  users         648 2004-02-12 09:48 cocoon-2.1.4
-rw-r--r--    1 volkmar  users    38577140 2004-02-12 10:31 cocoon-2.1.4-src.tar.gz
-rw-r--r--    1 volkmar  users          59 2004-02-12 10:31 cocoon-2.1.4-src.tar.gz.md5
volkmar@linux:/tmp/cocoon>
}}}
== Enter and check the new directory ==
Step into "cocoon-2.1.4" and list its content. You might read the INSTALL.txt and README.txt
files, and check what's about the blocks.properties and build.properties. 
{{{
volkmar@linux:/tmp/cocoon> cd cocoon-2.1.4/
volkmar@linux:/tmp/cocoon/cocoon-2.1.4> ls -al
insgesamt 223
drwxr-xr-x    6 volkmar  users         648 2004-02-12 09:48 .
drwxr-xr-x    3 volkmar  users          80 2004-05-05 15:57 ..
-rw-r--r--    1 volkmar  users        5106 2004-02-12 09:48 blocks.properties
-rw-r--r--    1 volkmar  users        2149 2004-02-12 09:48 build.bat
-rw-r--r--    1 volkmar  users        4617 2004-02-12 09:48 build.properties
-rwxr-xr-x    1 volkmar  users         470 2004-02-12 09:48 build.sh
-rw-r--r--    1 volkmar  users        2970 2004-02-12 09:48 build.xml
-rw-r--r--    1 volkmar  users       12233 2004-02-12 09:48 cli.xconf
-rw-r--r--    1 volkmar  users        6193 2004-02-12 09:48 cocoon.bat
-rwxr-xr-x    1 volkmar  users        4597 2004-02-12 09:48 cocoon.sh
-rw-r--r--    1 volkmar  users        3444 2004-02-12 09:48 CREDITS.txt
-rw-r--r--    1 volkmar  users         277 2004-02-12 09:48 DESKTOP.INI
-rw-r--r--    1 volkmar  users        3524 2004-02-12 09:48 forrest.properties
-rw-r--r--    1 volkmar  users       34872 2004-02-12 09:48 gump.xml
-rw-r--r--    1 volkmar  users        4644 2004-02-12 09:48 INSTALL.txt
-rw-r--r--    1 volkmar  users        9329 2004-02-12 09:48 KEYS
drwxr-xr-x    2 volkmar  users        2080 2004-05-05 15:48 legal
drwxr-xr-x    6 volkmar  users         168 2004-05-05 15:48 lib
-rw-r--r--    1 volkmar  users        2710 2004-02-12 09:48 README.txt
drwxr-xr-x   12 volkmar  users         320 2004-02-12 09:48 src
-rw-r--r--    1 volkmar  users       93042 2004-02-12 09:48 status.xml
drwxr-xr-x   10 volkmar  users         248 2004-02-12 09:46 tools
volkmar@linux:/tmp/cocoon/cocoon-2.1.4>
}}}
== Build Cocoon ==
Normally it shouldn't be necessary to do any changes to the above files. You can directly
start the program building cocoon.
{{{
volkmar@linux:/tmp/cocoon/cocoon-2.1.4> ./build.sh webapp
}}}
Building Cocoon will take some time and generate some output on your screen. Finally it will
end up with
{{{
BUILD SUCCESSFUL
Total time: 4 minutes 37 seconds
volkmar@linux:/tmp/cocoon/cocoon-2.1.4>
}}}
== Check the newly created build/ directory ==
The building procedure should have created a new directory "build" within "cocoon-2.1.4".
You may check it. What we are going to use is the subdirectory "webapp".
{{{
volkmar@linux:/tmp/cocoon/cocoon-2.1.4> cd build/
volkmar@linux:/tmp/cocoon/cocoon-2.1.4/build> ls -al
insgesamt 1
drwxr-xr-x    4 volkmar  users         104 2004-05-05 16:10 .
drwxr-xr-x    7 volkmar  users         672 2004-05-05 16:02 ..
drwxr-xr-x   11 volkmar  users         392 2004-05-05 16:12 cocoon-2.1.4
drwxr-xr-x    8 volkmar  users         336 2004-05-05 16:13 webapp
}}}
== Become Root and create a cocoon directory in /opt ==
All steps until here should have been done without root privileges. Now become root "su root"
and create a "cocoon" directory within "/opt".
{{{
volkmar@linux:/tmp/cocoon/cocoon-2.1.4/build> su root
Password:
linux:/tmp/cocoon/cocoon-2.1.4/build # mkdir /opt/cocoon
}}}
== Move webapp into this new directory ==
Now move your /tmp/cocoon/cocoon-2.1.4/build/webapp/ directory into "/opt/cocoon/".
{{{
linux:/tmp/cocoon/cocoon-2.1.4/build # mv webapp/ /opt/cocoon/
linux:/tmp/cocoon/cocoon-2.1.4/build # ls -al /opt/cocoon/
insgesamt 0
drwxr-xr-x    3 root     root           72 2004-05-05 16:35 .
drwxr-xr-x   14 root     root          400 2004-05-05 16:25 ..
drwxr-xr-x    9 volkmar  users         360 2004-05-05 16:27 webapp
linux:/tmp/cocoon/cocoon-2.1.4/build #}}}
== Go there and rename it ROOT ==
Now, we want Cocoon to act as the Default Context of its own host that we are going to configure
in Tomcat. This sounds complicated? So let's do it. In Tomcat's configuration we'll make "/opt/cocoon"
the Appliation Base for a new host. Any host setup in Tomcat will check it's configured Appliation
Base for a subdirectory "ROOT" and regard this one as it's default context. So, let's simply
rename our "webapp" to "ROOT", spelt with four upper case letters.
{{{
linux:/tmp/cocoon/cocoon-2.1.4/build # cd /opt/cocoon/
linux:/opt/cocoon # ls -al
insgesamt 0
drwxr-xr-x    3 root     root           72 2004-05-05 16:35 .
drwxr-xr-x   14 root     root          400 2004-05-05 16:25 ..
drwxr-xr-x    9 volkmar  users         360 2004-05-05 16:27 webapp
linux:/opt/cocoon # mv webapp/ ROOT/
linux:/opt/cocoon # ls -al
insgesamt 0
drwxr-xr-x    3 root     root           72 2004-05-05 16:37 .
drwxr-xr-x   14 root     root          400 2004-05-05 16:25 ..
drwxr-xr-x    9 volkmar  users         360 2004-05-05 16:27 ROOT
linux:/opt/cocoon #
}}}
== Edit server.xml ==
If you happened to start Tomcat already, you should now stop it! 
Go to Tomcat's configuration directory
{{{
linux:/opt/cocoon # cd ../jakarta-tomcat-5/conf/
linux:/opt/jakarta-tomcat-5/conf # ls -al
insgesamt 101
drwxr-xr-x    3 root     root          496 2004-05-05 16:26 .
drwxr-xr-x   11 root     root          352 2004-02-25 08:57 ..
drwxr-xr-x    4 root     root           96 2004-02-25 09:09 Catalina
-rw-------    1 root     root         6804 2004-02-14 11:26 catalina.policy
-rw-------    1 root     root         2715 2004-02-14 11:26 catalina.properties
-rw-------    1 root     root          778 2004-02-14 11:26 jk2.properties
-rw-------    1 root     root         1128 2004-02-14 11:26 server-minimal.xml
-rw-r--r--    1 root     root         1756 2004-03-05 12:45 server.xml
-rw-r--r--    1 root     root          433 2004-05-05 16:26 tomcat-users.xml
-rw-------    1 root     root        37477 2004-02-14 11:26 web.xml
}}}
and with your favourite editor open the file "server.xml". Search for the starting tag of
Catalina Engine,
{{{
<Engine defaultHost="localhost" name="Catalina">
}}}
below it, add the following lines that create a new host "cocoon" with an Application Base
"../cocoon". The relative path used here starts  from $Catalinahome, which in our case is
"/opt/jakarta-tomcat-5/".
{{{
  <Host appBase="../cocoon" name="cocoon">
    <Logger className="org.apache.catalina.logger.FileLogger" 
            prefix="cocoon_log." suffix=".txt" timestamp="true"/>
  </Host>
}}}
and change Catalina's default host to cocoon
{{{
<Engine defaultHost="cocoon" name="Catalina">
}}}
so that, excluded all the comments, Catalina now looks like
{{{
<Engine defaultHost="cocoon" name="Catalina">

  <Host appBase="../cocoon" name="cocoon">
    <Logger className="org.apache.catalina.logger.FileLogger" 
            prefix="cocoon_log." suffix=".txt" timestamp="true"/>
  </Host>

  <Host appBase="webapps" name="localhost">
    <Logger className="org.apache.catalina.logger.FileLogger" 
            prefix="localhost_log." suffix=".txt" timestamp="true"/>
  </Host>

  <Logger className="org.apache.catalina.logger.FileLogger" 
          prefix="catalina_log." suffix=".txt" timestamp="true"/>

  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>

</Engine>
}}}
Save your changes, close "server.xml" and restart Tomcat
{{{
linux:/opt/jakarta-tomcat-5/conf # cd ..
linux:/opt/jakarta-tomcat-5 # bin/startup.sh
Using CATALINA_BASE:   /opt/jakarta-tomcat-5
Using CATALINA_HOME:   /opt/jakarta-tomcat-5
Using CATALINA_TMPDIR: /opt/jakarta-tomcat-5/temp
Using JAVA_HOME:       /usr/lib/java
linux:/opt/jakarta-tomcat-5 #
}}}
Now it's done. Become normal user and start your browser. If you follow the link [http://cocoon:8080/]
it should now take you to Cocoon's welcome page whereas [http://localhost:8080/] still will
go to Tomcat's welcome page with its docs and examples. 
But, as we changed Catalina's default host to Cocoon, now any other [http://anyhost:8080/]
will go to Cocoon as well. We will use this feature for doing virtual hosting with Cocoon
in a future description.

volkmar@pogatzki.net
----
CategoryCategory

Mime
View raw message