Ok, finally got it working here.
Here's what I did:
1) I downloaded Solr 4.8 again, untar'ed and moved to /usr/share/solr
.
2) I copied solr.war into the solr example instead of the multicore example:
sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/solr/solr.war
3) I then copied the jar and log files:
sudo cp -r solr/example/lib/ext/* /usr/share/tomcat7/lib
sudo cp -r solr/example/resources/log4j.properties /usr/share/tomcat7/lib
4) I set the log path in /usr/share/tomcat7/lib/log4j.properties to (and then created the file):
solr.log=/usr/share/solr
touch solr.log
(inside /usr/share/solr/)
5) I put the following in solr.xml
in /var/lib/tomcat7/conf/Catalina/localhost
:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/usr/share/solr/example/solr/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/usr/share/solr/example/solr" override="true" />
</Context>
6) I changed the hostPort to 8080 in /usr/share/solr/example/solr/solr.xml:
<int name="hostPort">8080</int>
7) Finally I set the user **tomcat7 as the owner of the /usr/share/solr folder:
sudo chown -R tomcat7 /usr/share/solr
This can probably be cleaned up a bit, removing unneccessary files and examples from the Solr distribution, but at least it got me up and running.
For those wanting to use it with the sunspot_rails gem then you need to replace the schema.xml
file inside /usr/share/solr/example/solr/collection1/conf
with the one from your Rails-project, and do something like this for your sunspot.yml
file:
production:
solr:
hostname: localhost
port: 8080
log_level: WARNING
path: /solr
UPDATE:
Adding my complete solr.xml file for reference:
<solr>
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">8080</int>
<str name="hostContext">${hostContext:solr}</str>
<int name="zkClientTimeout">${zkClientTimeout:30000}</int>
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
</solrcloud>
<shardHandlerFactory name="shardHandlerFactory"
class="HttpShardHandlerFactory">
<int name="socketTimeout">${socketTimeout:0}</int>
<int name="connTimeout">${connTimeout:0}</int>
</shardHandlerFactory>
</solr>