Installing Solr nightly on Ubuntu 9.04
Saturday, August 15th, 2009Note: this is adapted from http://justin-hayes.com/2009-04-08/installing-apache-tomcat-6-and-solr-nightly-on-ubuntu-804.
Install Java 6 JDK:
First off, forget about using the Ubuntu packages of Tomcat and Solr, they’re broken, as well as outdated. Download the latest release of Tomcat from their site, and grab a nightly build of Solr from here using wget or whatever method you prefer. Untar both of them in your home directory.
tar xfzv apache-tomcat-6.0.20.tar.gz
wget http://people.apache.org/builds/lucene/solr/nightly/solr-2009-08-11.tgz
tar xfzv solr-2009-08-11.tgz
Now, move Tomcat to wherever you want to have it installed, I chose to put it in /usr/local/tomcat6.
Next, copy the Solr .war file from apache-solr-nightly/dist/ to the webapps/ directory of tomcat6/, and the example webapp from apache-solr-nightly/example/solr/ to the tomcat6/ root directory.
sudo cp -r apache-solr-nightly/example/solr/ /usr/local/tomcat6/solr/
Now that all the files are in place, we need to create a config file to run Solr.
sudo mkdir /usr/local/tomcat6/conf/Catalina/localhost/
sudo nano /usr/local/tomcat6/conf/Catalina/localhost/solr.xml
In this file, insert the following code:
<Environment name=”solr/home” type=”java.lang.String” value=”/usr/local/tomcat6/solr” override=”true” />
</Context>
Edit your .bashrc file in your home directory and add the following to it:
export JAVA_OPTS=”$JAVA_OPTS -Dsolr.solr.home=/usr/local/tomcat6/solr“
If all went well, you should be able to start Tomcat and browse to http://your.servers.ip:8080/solr/admin and see the Solr admin page.
If this worked, great, but now it’s time to get Tomcat to autostart itself when your server reboots. First, open a new script in your /etc/init.d/ directory.
Insert the following code:
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_OPTS=”$JAVA_OPTS -Dsolr.solr.home=/usr/local/tomcat6/solr“
case $1 in
start)
sh /usr/local/tomcat6/bin/startup.sh
;;
stop)
sh /usr/local/tomcat6/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat6/bin/shutdown.sh
sh /usr/local/tomcat6/bin/startup.sh
;;
esac
exit 0
Finally, to make sure it autostarts, run this command:
Congratulations! If you’ve followed this how-to exactly, you should have a working install of Apache Tomcat and Solr.
Links I got tips from:
http://wiki.apache.org/solr/SolrTomcat
http://www.tc.umn.edu/~brams006/solr_ubuntu.html
http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/
http://lethain.com/entry/2009/mar/06/solango-and-tomcat-6-on-ubuntu-intrepid/
http://markmail.org/message/2xxiyry4y42hpodd
http://ubuntuforums.org/showthread.php?t=194559