Solr 4, Jetty 9 and Search API on Ubuntu
Tech Notes
I've just had to do this three times so let's write it down. First let me say I love the new UI for the Solr Admin pages. They've made it out of the nineties!
Much of this is taken from http://dcvan24.wordpress.com/2013/05/16/how-to-deploy-solr-4-3-on-jetty-9/
- Lets put all this in /opt
# cd /opt - Let's make a Solr user
# adduser solr - Get some files
# wget http://apache.mirror.serversaustralia.com.au/lucene/solr/4.10.2/solr-4.10.2.tgz# wget http://download.eclipse.org/jetty/9.2.5.v20141112/dist/jetty-distribution-9.2.5.v20141112.tar.gz# wget http://ftp.drupal.org/files/projects/search_api_solr-7.x-1.6.tar.gz - Copy the start up script into place
# cp /opt/jetty/bin/jetty.sh /etc/init.d/solr# chmod +x /etc/init.d/solr - Copy the Solr application into Jetty (this is how we do it in Jetty 9)
# cp -a solr-4.10.2/dist/solr-4.10.0.war /opt/jetty/webapps/solr.war# cp -a solr-4.10.2/example/contexts/solr-jetty-context.xml /opt/jetty/# cp -a solr-4.10.2/example/lib/ext/* /opt/jetty/lib/ext/ - Make a place for Solr
# mkdir /opt/solr - Copy the Solr config into place
# cp -a solr-4.10.2/example/solr /opt/solr# cp -a solr-4.10.2/dist/ /opt/solr# cp -a solr-4.10.2/contrib/ /opt/solr - Make a place for logs
# mkdir /opt/solr/logs - Everything is owned by Solr
# chown solr /opt/solr/logs - Start up configuration for Solr
# vi /etc/default/solr
DEBUG=0
JAVA_HOME=/usr/java/default
JAVA_OPTIONS="-Dsolr.solr.home=/opt/solr/solr $JAVA_OPTIONS"
JETTY_HOME=/opt/jetty
JETTY_USER=solr
JETTY_LOGS=/opt/solr/logs
JETTY_ARGS="jetty.port=8983 jetty.spdy.port=8443 jetty.secure.port=443" - Solr is now one directory closer to Jetty than the default configuration shipped with Solr
# vi solr/solr/collection1/conf/solrconfig.xml
<!-- modify the path as following as we are a directory closer now -->
...
<lib dir="../../contrib/extraction/lib" regex=".*\.jar" />
<lib dir="../../dist/" regex="solr-cell-\d.*\.jar" />
<lib dir="../../contrib/clustering/lib/" regex=".*\.jar" />
<lib dir="../../dist/" regex="solr-clustering-\d.*\.jar" />
<lib dir="../../contrib/langid/lib/" regex=".*\.jar" />
<lib dir="../../dist/" regex="solr-langid-\d.*\.jar" />
<lib dir="../../contrib/velocity/lib" regex=".*\.jar" />
<lib dir="../../dist/" regex="solr-velocity-\d.*\.jar" />
...
<!-- <lib dir="/non/existent/dir/yields/warning" /> --> - Start Solr
# service solr start - View the Solr admin interface
http://solr.example.com:8983/solr/ - Add a core for a Drupal Search API project
# mkdir -p /opt/solr/solr/[corename]/data - Copy the search_api_solr config into place
# cp -a /opt/search_api_solr/solr-conf/4.x/ /opt/solr/solr/[corename]# chown -R solr:solr /opt/solr/solr/[corename] - Visit the Solr admin page
http://solr.example.com:8983/solr/#/~cores/[corename]