Solr is a search platform which is built on Apache Lucene. It makes search easier and faster. Solr can be installed along with tomcat or jetty. This post explains the installation based on jetty.
First you should install java and jetty as mentioned in the link here.
We will install solr also in /opt. First download the latest version of solr from https://archive.apache.org/dist/lucene/solr/
I am going to download version 4.10.4. Once downloaded, uncompress it and copy the war file from dist directory to jetty webapps folder.
[root@test ~]#cd /opt
[root@test ~]# wget https://archive.apache.org/dist/lucene/solr/4.10.4/solr-4.10.4.tgz
[root@test ~]# tar -xzvf solr-4.10.4.tgz
[root@test ~]#cp solr-4.10.4/dist/solr-4.10.4.war /opt/jetty/webapps/solr.war
Now, a few more files need to be copied from the uncompressed solr-4.10.4 folder. Follow the steps below.
[root@test ~]# cp -r solr-4.10.4/example/solr /opt/
[root@test ~]# cp -r solr-4.10.4/dist/ /opt/solr/
[root@test ~]# cp -r solr-4.10.4/contrib/ /opt/solr/
[root@test ~]# cp -r solr-4.10.4/example/contexts/solr-jetty-context.xml /opt/jetty/webapps/solr.xml
[root@test ~]# cp -r solr-4.10.4/example/lib/ext/* /opt/jetty/lib/ext/
Now open the file /etc/default/jetty and add the following line to it.
[root@test ~]# vi /etc/default/jetty
JAVA_OPTIONS=”-Dsolr.solr.home=/opt/solr $JAVA_OPTIONS”
NExt open the file /opt/solr/collection1/conf/solrconfig.xml and make sure that the path to dist and contrib folders are set correct in it.
For example the following line needs to modified
<lib dir=”${solr.install.dir:../../..}/contrib/extraction/lib” regex=”.*\.jar” />
>> Modify it as
<lib dir=”${solr.install.dir:}/contrib/extraction/lib” regex=”.*\.jar” />
because our contrib folder is now in /opt/solar/contrib
Similarly modify all lib dir which are incorrect in path. Also comment out the ones which does not exist.
Now, correct the permission of all solr files to be owned by jetty and restart jetty.
[root@test ~]# chown -R jetty:jetty /opt/solr
[root@test ~]# /etc/init.d/jetty restart
Now you can access the solr admin console using the link http://localhost:8080/solr or from browser using http://1.2.3.4:8080/solr where 1.2.3.4 is your server’s IP Address. Make sure to whitelist the post 8080 in your firewall.
[…] Install solr with jetty in Ubuntu […]