Install SOLR multicore on debian

February 23, 2015

Ever wondered how you can install Apache Solr on a debian server? And on top of that making it multicore? Well wonder no more!

Install java

$ apt-get install sun-java6-jdk

In case it doesn’t work, you will have to update your sources.list

$ vim /etc/apt/sources.list


deb stable non-free

Update apt

$ apt-get update

Now it should work:

$ apt-get install sun-java6-jdk         

Set environment variables:

$ echo 'JAVA_HOME="/usr/lib/jvm/java-6-sun"' >> /etc/environment
$ echo 'JRE_HOME="/usr/lib/jvm/java-6-sun/jre"' >> /etc/environment

Install Tomcat 6.

$ apt-get install tomcat6 tomcat6-admin

Download the latest SOLR version and unzip on your server

$ wget
$ unzip -q
$ cd apache-solr-3.6.0/

Next you will copy SOLR to Tomcat.

$ cp dist/apache-solr-3.6.0.war /var/lib/tomcat6/webapps/solr.war
$ cp -fr example/solr /var/lib/tomcat6/
$ chown -R tomcat6:tomcat6 /var/lib/tomcat6/solr

edit solr.xml in /var/lib/tomcat6/solr

<solr persistent="true">
  <cores adminPath="/admin/cores">
    <core name="site1" instanceDir="site1" />
    <core name="site2" instanceDir="site2" />

Next we will create these cores on the server. We will have to copy the data and conf folder in each of them.

$ mkdir /var/lib/tomcat6/solr/site1
$ mkdir /var/lib/tomcat6/solr/site2
$ cp /var/lib/tomcat6/solr/data /var/lib/tomcat6/solr/site1/data –R
$ cp /var/lib/tomcat6/solr/conf /var/lib/tomcat6/solr/site1/conf –R
$ cp /var/lib/tomcat6/solr/data /var/lib/tomcat6/solr/site2/data –R
$ cp /var/lib/tomcat6/solr/conf /var/lib/tomcat6/solr/site2/conf –R
$ /etc/init.d/tomcat6 restart

Surf to localhost:8080/solr/ and be amazed! This is how easy it is to setup Apache Solr!

comments powered by Disqus