Part 2: Installing Lenya

29 January 05

So here you are, ready to install the mysterious Lenya. If you haven't already, I encourage you to take a quick gander at Part I: Understanding Lenya to make sure you know what you are getting into before attempting this install. Also, some knowledge in the basics of using a UNIX/Linux operating system are assumed. So without further delay, let's kick it!

Requirements

OK, I do have to mention one thing: while you can install Lenya on Windows, I'm going to be taking you through a Linux installation. For Windows help, I'll have to direct you to the user mailing lists.

I also recommend a broadband connection, especially for downloading Cocoon (approx. 43 MB) and the Java SDK (approx. 35 MB), but if you want to sit around and wait while they download on a phone line, be my guest!

  1. Linux/UNIX (I'm using RedHat Enterprise AS, but any Linux will do)
  2. Java 1.4.2 SDK (I downloaded the RedHat RPM)
  3. Cocoon 2.1.6 (the TAR/GZ source version)
  4. Lenya 1.2.1 (the tar.gz source version is what I am using, under the SOURCES directory)
  5. (optional) Tomcat 5.0.28 (the binary tar.gz version)

Why is Tomcat optional? Well, because Lenya already comes with a servlet container called Jetty. Both Jetty and Tomcat are the servlet containers tested with Lenya, and since we're using Tomcat for Hiram's site, that's what I'll be taking you through. For brief instructions on using Jetty, read the tutorial on Lenya's site.

It's also assumed that the first steps before switching to our new user in step 5 are done with a user that has the capabilities of installing Java and the like. I used the root user to do the installs and moves, then switched to the our new user for the rest.

10 Steps to Lenya bliss

Step 1: Download!

Yeah, seems simple enough, doesn't it? Get 2-5 from above downloaded and on the server you'll be using.

Step 2: Install Java SDK

If you downloaded the RPM, you'll need to execute the file first. It spits out the Licensing Agreement, for which you must agree to, and then your RPM file is ready. To install on RedHat, type in the following:

rpm -ivh j2sdk-1_4_2_07-linux-i586.rpm

or whatever your RPM file happens to be named. This should install your Java files in /usr/java/ by default. You'll also need to setup some environment variables for Java in order for Tomcat to start up correctly later on. Again, these instructions are for RedHat, so consult documentation for your OS if need be.

cd /etc/profile.d/

Create a new file called java.sh and fill it with the following for now:

export JAVA_HOME=/usr/java/java
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib/ext

Save it and exit from the file. While we are here, let's add the rest of the environment variables for the other applications. So, for Tomcat, create a new file called tomcat.sh and add the following inside:

export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:$CATALINA_HOME/bin

Save and exit. Then, create a new file called webapps.sh and add the following inside:

export LENYA_HOME=/home/webapp/web_software/lenya-1.2.1
export COCOON_HOME=/home/webapp/web_software/cocoon-2.1.6
export COCOON_WEBAPP=/home/webapp/web_software/cocoon-2.1.6/build/webapp

Save and exit.

Step 3: Setup a new user

You'll want to create a new user that has access to all of the Cocoon, Tomcat, and Lenya files. I'll call the user "webapp". In most Linux distributions, you can use the graphical tools to add a new user, or if you are a die-hard command-line junkie, use the following command in RedHat to add our new user:

useradd -c "Web Applications" -m webapp

This basically sets up a new user with the name of "Web Applications", a username of "webapp" and creates a home directory (the -m switch) with the standard initialization files.

You may want to setup a password for this user. To do that, simply do this:

passwd webapp

It will prompt you for the new password twice. Assuming you typed it in the same way both times, you're all set! This is only basic, so if you want to add password expiration options, etc., go right ahead!

Step 4: Move downloads to right places

In most UNIX/Linux systems, webapp's home directory should be /home/webapp/. Inside webapp's home directory, we'll create a new directory to store our source files. Let's call it "web_software":

mkdir /home/webapp/web_software
chown -R webapp:webapp /home/webapp/web_software

Go ahead and move both Lenya's and Cocoon's zipped up files to that directory (you'll have to change to the directory that your downloaded files are stored first):

mv apache-lenya-1.2.1-src.tar.gz /home/webapp/web_software/
mv cocoon-2.1.6-src.tar.gz /home/webapp/web_software/

Tomcat needs to go in /usr/local/ (at least that's the typical place for it):

mv jakarta-tomcat-5.0.28.tar.gz /usr/local/

Step 5: Change permissions of files

Now that you created that webapp user, you'll want to assign permissions to the Lenya, Cocoon, and Tomcat files to webapp:

chown webapp:webapp /usr/local/jakarta-tomcat-5.0.28.tar.gz
chown -R webapp:webapp /home/webapp/web_software/

And then switch to that user:

su - webapp

Step 6: Unzip Lenya

Pretty easy stuff:

cd web_software
tar xzvf apache-lenya-1.2.1-src.tar.gz
mv apache-lenya-1.2.1-src lenya-1.2.1

Step 7: Unzip and build Cocoon

Same deal here:

tar xzvf cocoon-2.1.6-src.tar.gz
mv cocoon-2.1.6-src cocoon-2.1.6

Now, you'll need to copy some config files from Lenya into Cocoon's directory:

cp lenya-1.2.1/local.build.properties cocoon-2.1.6/
cp lenya-1.2.1/local.blocks.properties cocoon-2.1.6/

Then the all-important part, compiling Cocoon. It's this simple:

cd cocoon-2.1.6
./build.sh -Dinclude.webapp.libs=yes webapp

Step 8: Install Tomcat

Since we downloaded the binary version of Tomcat, there's not much to do except to unzip the files. So here we go again:

cd /usr/local/
tar xzvf jakarta-tomcat-5.0.28.tar.gz

Since that name is rather long, let's create a link to it:

ln -s jakarta-tomcat-5.0.28 tomcat

Step 9: Configure and install Lenya

OK, we need to let Lenya know where Tomcat is before we install it.

cd /home/webapp/web_software/lenya-1.2.1/
cp build.properties local.build.properties

Inside this file, you'll need to change a couple of things. Below are the lines you'll need to change in local.build.properties, so scope them out in the file, make the changes, and save them:

cocoon.src.dir=../cocoon-2.1.6
tomcat.home.dir=/usr/local/tomcat
enable.uploads=true

Once done, we'll need to compile:

./build.sh install

Step 10: Start up Tomcat

To start Tomcat, simply type in the following:

/usr/local/tomcat/bin/startup.sh

Getting your first access to Lenya

Now that Tomcat is up, you should be able to access Lenya pretty easily. Just go to the following URL: http://your.server.url:8080/lenya/. You should see a couple of publications listed on the left with general information about Lenya. From there, you can log into the Default Publication with the username "lenya" and the password "levi".

Next Article

Now that you have the basic installation done, play around and have some fun. In the next article, we'll take a look at how pages are created, published, and customized by changing some of the files in the Default Publication as well as creating our own pipeline. Feel free to post here if you run into any problems during the installation, and I'll try my best to help out.

Comments?

Ameya - Feb 4, 6:24am

Hi Jon!
Thanks much for your latest article on Lenya…Its helped us get started on our project. I look forward to your upcoming articles!

Thanks again!
Ameya

Fadi K. - Feb 17, 2:19pm

Jon,

This was definitely informative and also very refreshing to see others take a dive into lenya. Please keep me updated on when you release more articles that are lenya related. I’m in the middle of configuring it myself and its nice to see a resource on the net other than the documentation.

raja - Mar 2, 12:58am

Hi,
Let me know the latest realeas of lenya and Cocoon. I like to integrate these two.

kumar - Mar 4, 10:41pm

i have tomcat 4.1.31 , cocoon-2.0.4 (war file) and its working fine. How to install lenya 1.2.2 (src) for the same.

You are using cocoon src whereas the version i mentioned is war file.

thanks

Jon Linczak - Mar 5, 10:59am

Hi raja, indeed, the latest release for Lenya is 1.2.2, while the latest release for Cocoon is 2.1.6. I do not believe any of the instructions in this article need to be altered for the newest version.

While you can run older versions of Tomcat and Cocoon and kumar mentioned, I believe these are the recommended releases for the current Lenya version.

Sean - Mar 22, 5:14pm

Jon,
I’m researching Lenya for possible use in our doc dept. We use desktop authoring to create topic-based XML files, which are transformed to HTML; however, we do not deliver to the Web. Storing XML in a db may be in our future as well. I can certainly see where we could take advantage of many of Lenya’s features, but is it feasible to consider Lenya for our needs, given it is web-centric. I’m not looking for a code recipe, only for your informed opinion. -Thanks. BTW: Great Articles!

Jon Linczak - Mar 24, 9:29am

Hi Sean, I’m not sure how much my opinion will help here, but my guess is that you could use Lenya, but perhaps you might be better off just using Cocoon instead. Lenya is a nice GUI for Cocoon that is indeed focused on the web, but Cocoon can do everything you want it to do without all the web stuff built in. It easily handles custom XML documents (so does Lenya with doctypes), but it doesn’t add all the extra stuff of titles, descriptions, and a workflow for submission. However, you would have to write your own process for editing the documents, so perhaps just ignoring the web features for Lenya and using the editing features might be what you are looking for. It’s hard to say since I haven’t worked with just Cocoon, but you might want to post a question on either the Cocoon or Lenya user mailing lists and see what kinds of opinions you get there too. Thanks for reading! :)

Sean - Mar 24, 12:55pm

Thanks for the info. I’ll post the URLs here to any responses I may get on the mailing lists.

Bhavya Sharma - Jun 15, 5:31am

Sir could help me out please actually i was facing problem while integrating lenya with cocoon , i have made my project in cocoon now i want to transefr it into lenya , so how does it possible could u reply me as soon as possible
Thank you
Bhavya Sharma

commenting closed for this article

in this site