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:
sudo wget http://mirrors.gigenet.com/apache/lucene/solr/4.0.0/apache-solr-4.0.0.tgz
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 the solr.war file to Jetty's webapps directory:
sudo cp solr.war /opt/jetty/webapps/solr.war
Copy the Apache Solr example/solr directory to the Jetty directory:
sudo cp -R example/solr /opt/jetty/solr
Create data directory
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.
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:
The log messages aren't the prettiest, but they could give you valuable hints about the root of the problem.