Before Starting let us assume requirement as per below

Operating System  : Ubuntu 12.04.4 LTS (Precise Pangolin)
Oracle Java (JDK) : Version 1.6.0 update 7
Apache Tomcat     : Version 7
Apache Solr       : Version 4.4.0

Let’s assume that you have successfully installed Ubuntu 12.04 and logged in to Konsole with root user.


Configure Oracle Java

Now download and install Oracle Java, make sure you downloading proper bit version else it will fail to install in Ubuntu, We had made that mistake, so we hope you don’t.

NOTE : if you have installed another Java versions (like Openjdk) and you want to install and set Oracle Java as your default Java lib then this guide will be useful.


Install Tomcat7

Now if you have installed Oracle Java successfully its time to move to install Tomcat. Fire below command in Konsole with root permission and it will do automatically

sudo apt-get install tomcat7 tomcat7-admin

This command will install Tomcat7 and other dependency bundle automatically, so you don’t have to worry about other support packages.

Hurray!!! Tomcat7 successfully installed in below directories you can view

Installed on  : /usr/share/tomcat7
etc path      : /etc/tomcat7

Now since we had installed Tomcat7 successfully its time to configure Tomcat7 user role, edit “tomcat-users.xml” file as per below

sudo kate /etc/tomcat7/tomcat-users.xml

And Add / Edit Lines as per below

    <role rolename="manager-gui"/>
    <user username="tomcat" password="secret" roles="manager-gui"/>

Now again in command line fire below command

sudo service tomcat7 restart

This will restart Tomcat7, go to your browser and open url


and you are done with Tomcat7 successfully


Install Apache Solr

  1. Download Apache Solr version 4.4.0
  2. Unzip the package and move the solr unser /usr/share/solr as per below command
  3. We are assuming that you have download solr on /home/digitize/Downloads/solr/solr4.4.0
sudo rsync -avrt /home/digitize/Downloads/solr/solr4.4.0/ /usr/share/solr

NOTE : We haven’t used copy (cp) command over here as sometimes they are not able to copy whole directory structure if previously not created!

Now solr is successfully copied to “/usr/share/solr” directory. Next we setup the tomcat application, first issue the following command to copy solr.war into the application root

sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/solr/solr.war

Most Important

One of the things about running Solr in a container other than the embedded Jetty is that we need to setup the logging. This step is crucial, without doing this solr will never start and you will pull all of your hair out trying to figure out why. Based on the instructions from the Apache Solr Wiki, copy all the jar files from /usr/share/solr/example/lib/ext to /usr/share/tomcat7/lib. and also copy /usr/share/solr/example/resources/ to /usr/share/tomcat7/lib. Now after restarting logs of solr will be visibal unser /var/logs/tomcat7 directory
sudo rsync /usr/share/solr/example/lib/ext/ /usr/share/tomcat7/lib
sudo rsync /usr/share/solr/example/resources/ /usr/share/tomcat7/lib

Next we add solr to the Catalina config

cd /etc/tomcat7/Catalina/localhost
sudo kate solr.xml

The config file “solr.xml” should look like this:

<Context docBase="/usr/share/solr/example/solr/solr.war" debug="0" crossContext="true">
    <Environment name="solr/home" type="java.lang.String" value="/usr/share/solr/example/solr" override="true" />

Now restart Tomcat7 and see Solar is successfully installed and running.

sudo service tomcat7 restart

Open browser and navigate to “http://localhost:8189/” and you can find solr in tomcat manager option..!