Install Tomcat 5.5 and Solr 1.4 on Debian 5 (lenny)

1.Installation of Java 

First you have to install SUN JRE and JDK on your system. Version 6 is the current version. The following entries in /etc/apt/sources.list are necessary to download Java directly from the repository

 

# in non-free are the Java packages
deb http://ftp.de.debian.org/debian/lenny main non-free contrib

 

 
#Security updates for all debian packages
deb http://security.debian.org/ etch/updates main non-free contrib
 
Install Java 6 JRE und JDK packages:


apt-get install sun-java6-jre sun-java6-jdk

2. Activate and test Java

update-alternatives --config java
update-alternatives --config javac
 
and then check the java version:
 
java -version
and
javac -version
 

3. Change environment variables

The variable JAVA_HOME has to be set. Else Tomcat won't find the Java environment and hence will not start. Add the following lines to /etc/profile:
 
# Setup Jave environment 6
export PATH=$PATH:/usr/lib/jvm/java-6-sun/bin
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JRE_HOME=/usr/lib/jvm/java-6-sun/jre
 

4. Installation Tomcat

After changing the environment variables, please log off and login as root to benefit from the new settings.
 
Then start the installation of Tomcat with apt-get:
 
apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps
 
Then install solr:
 
apt-get install solr-tomcat5.5
 
Under /etc/default/tomcat5.5 JAVA_HOME set the JAVA_HOME directory:
 
# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat55.
#TOMCAT5_USER=tomcat55
# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.4. If JAVA_HOME is not set, some common directories for
# the Sun JDK, various J2SE 1.4 versions, and the free runtimes
# java-gcj-compat-dev and kaffe are tried.
JAVA_HOME=/usr/lib/jvm/java-6-sun
 

5. Test Tomcat

Check is Tomcat ist running smoothly by open the following page in your favourite browser:
 
http://localhost:8180
 
The login details for the tomcat administrator you can find and change in:
 
$TOMCAT_HOME/etc/tomcat-users.xml
 
Create a new user with the roles "admin, manager".
Attention: You can only access from localhost by default.
 

6. Update solr to the newest version

  • Open solr.xml in /etc/tomcat5.5/Catalina/localhost folder and write down the install path of solr (docBase)
  • Untar the solr.war from the dist folder and move it to the noted folder
  • Copy the /conf folder from the folder /example/solr/conf to the docBase.
Change into the folder /usr/share/tomcat5.5/bin:
cd /usr/share/tomcat5.5/bin
 
Start Tomcat manually in the current window to check any possible error messages:
./catalina.sh run
 
This is helpful for a error search. You can alternatively check the logfiles.