Install Apache Solr on Ubuntu

1.  Install Tomcat on ubuntu

sudo apt-get update && apt-get upgrade

sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples

sudo apt-get install libmysql-java

2) Download apache-solr-1.4.1.tar.gz

cd /home/<user-name>/Desktop/

wget -c http://apache.tradebit.com/pub/lucene/solr/1.4.1/apache-solr-1.4.1.zip

unzip apache-solr-1.4.1.zip

sudo cp apache-solr-1.4.1/dist/apache-solr-1.4.1.war /var/lib/tomcat6/webapps/solr.war

sudo cp -R apache-solr-1.4.1/example/solr/ /var/lib/tomcat6/solr/

3) Establish new Solr configuration in Tomcat6

sudo vim /etc/tomcat6/Catalina/localhost/solr.xml

and paste the below given code

<Context docBase=”/var/lib/tomcat6/webapps/solr.war” debug=”0″ privileged=”true” allowLinking=”true” crossContext=”true”>
<Environment name=”solr/home” type=”java.lang.String” value=”/var/lib/tomcat6/solr” override=”true” />
</Context>

4. Create Folder data and Change Solrconfig.xml (For single core) .  create folder in solr in /var/lib/tomcat6/solr/

mkdir data

Change path data in solr/conf/solrconfig.xml

<dataDir>/var/lib/tomcat6/solr/data</dataDir>

5. And at last restart Tomcat

sudo service tomcat6 restart

6) Load  http://localhost:8080/solr/ in your browser

Leave a Reply

Your email address will not be published. Required fields are marked *