Integrating sunspot solr in rails with tomcat7
At a first glance it seems too easy to integrate a gem in rails but when it comes to Tomcat7 and java dependencies it always end up in tricky part so here it is follow these simple steps to integrate solr with all it's dependencies.
first you need to have java environment
Tomcat will not actually use your JAVA_HOME environmente variable, but look in some predefined locations and in the JAVA_HOME variable set inside the startup script, as other answers point out. If you don't like messing with the tomcat startup script, you could create a symlink for your preferred java installation, which will be picked up by tomcat.
first you need to have java environment
sudo apt-get -y install openjdk-7-jdkInstall tomcat
sudo mkdir /usr/java
sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/java/default
Then download solr (check for a newer version if you want)sudo apt-get install tomcat7 sudo apt-get install tomcat7-admin
Set Solr with Tomcat:sudo wget http://archive.apache.org/dist/lucene/solr/4.8.1/solr-4.8.1.tgz sudo tar -xvf solr-4.8.1.tgz sudo cp -R solr-4.8.1/example/ /opt/solr
if you find this errorsudo cp -R /opt/solr/lib/ext/* /usr/share/tomcat7/lib/ sudo cp /opt/solr/webapps/solr.war /var/lib/tomcat7/webapps/solr.war sudo cp -R /opt/solr /var/lib/tomcat7 sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7/solr service tomcat7 restart
* no JDK found - please set JAVA_HOME
When the file opens, uncomment the line that sets the JAVA_HOME variablesudo gedit /etc/default/tomcat7
Tomcat will not actually use your JAVA_HOME environmente variable, but look in some predefined locations and in the JAVA_HOME variable set inside the startup script, as other answers point out. If you don't like messing with the tomcat startup script, you could create a symlink for your preferred java installation, which will be picked up by tomcat.
then follow your gem procedures:ln -s /usr/lib/jvm/java-8-oracle /usr/lib/jvm/default-java
Comments
Post a Comment