How to Install Apache Solr in Ubuntu

Before you install Apache Solr, you will need to install Jetty Web Server.

In this article, I will walk you through all the steps necessary to install and test Apache Solr.

Download Apache Solr

First, you will need to download the latest version of Apache Solr. For the sake of this example I provide an actual working mirror as of the time I wrote this article, but you may want to use a different mirror:

cd /usr/local/src
sudo wget

Now, decompress the file you just downloaded:

sudo tar xfz apache-solr-4.0.0.tgz

Stop Jetty Web Server

sudo /etc/init.d/jetty stop

Copy Files

Copy the solr.war file to Jetty's webapps directory:

cd /usr/local/src/apache-solr-4.0.0/example/webapps
sudo cp solr.war /opt/jetty/webapps/solr.war

Copy the Apache Solr example/solr directory to the Jetty directory:

cd /usr/local/src/apache-solr-4.0.0
sudo cp -R example/solr /opt/jetty/solr

Create data directory

cd /opt/jetty/solr
sudo mkdir data
sudo chown -R jetty:jetty data

Modify Jetty Configuration File

Now, you will need to modify the following file:

sudo vim /opt/jetty/etc/jetty.conf

Add these lines to the end of the file:


Note: Do not put comments after the first non-commented line in this file.

Start Jetty

sudo /etc/init.d/jetty start

If all is well, you should see the Solr Admin page when you visit the following URL:



If you don't see the Solr admin page, or if Jetty failed to start, try checking the Jetty logs:

cd /opt/jetty/logs

The log messages aren't the prettiest, but they could give you valuable hints about the root of the problem.