Install Tomcat
Setup tomcat manager
sudo apt-get install tomcat7 tomcat7-admin
Setup tomcat manager
sudo vim /etc/tomcat7/tomcat-users.xm
<tomcat-users>
<role rolename="manager"/>
<user username="tomcat" password="yourSecret" roles="manager"/>
</tomcat-users>
sudo service tomcat7 restart
Install Solr
Download solr 4.2.0 from the Apache archives, as sunspot support 4.2.0 version of solr up till now.
wget http://archive.apache.org/dist/lucene/solr/4.2.0/solr-4.2.0.tgz
Extract the solr-4.2.0
Now again go to http://youripaddress:8080/manager/index and check that solr tab on left side will be green, now more options will be appear to reload, stop and undeploy
tar -zxvf solr-4.2.0.tgzMove or copy solr to /usr/share/solr
sudo cp solr-4.2.0 /usr/share/solr/Now we have to copy solr.xml from example/webapps to example/solr
sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/solr/solr.war
Now again go to http://youripaddress:8080/manager/index and check that solr tab on left side will be green, now more options will be appear to reload, stop and undeploy
Integrating Solr with Sunspot
till today(27 Feb, 2014) sunspot is shipped with solr 4.2, default schema.xml file of 4.2 version of solr is not compatible with sunspot latest version 2.1.0 and sunspot_rails version 2.1.0
therefore we will take a backup of original schema.xml file on server and create schema.xml file which is shipped with sunspot_rails to server
taking backup
removing schema.xml
now copy schema.xml content from https://github.com/sunspot/sunspot/blob/master/sunspot_solr/solr/solr/conf/schema.xml
create new schema.xml file and paste the content in it
till today(27 Feb, 2014) sunspot is shipped with solr 4.2, default schema.xml file of 4.2 version of solr is not compatible with sunspot latest version 2.1.0 and sunspot_rails version 2.1.0
therefore we will take a backup of original schema.xml file on server and create schema.xml file which is shipped with sunspot_rails to server
taking backup
sudo cp /usr/share/solr/example/solr/collection1/conf/schema.xml /usr/share/solr/example/solr/collection1/conf/schema.xml-orig
removing schema.xml
sudo rm /usr/share/solr/example/solr/collection1/conf/schema.xml
now copy schema.xml content from https://github.com/sunspot/sunspot/blob/master/sunspot_solr/solr/solr/conf/schema.xml
create new schema.xml file and paste the content in it
sudo nano /usr/share/solr/example/solr/collection1/conf/schema.xml
ctrl + shift + vsave changes and restart Tomcat
sudo service tomcat7 restart
Now we have done with it, reindex your data and move on :)