Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Install tomcat. This is with help from the guide on https://wiki.apache.org/solr/SolrTomcat:
yum install -y tomcat6
Download latest solr version:
cd tmp
wget http://archive.apache.org/dist/lucene/solr/4.5.1/solr-4.5.1.tgz
Extract your tgz file
tar -xvf solr-4.5.1.tgz
Create a directory for you solr installation and move the example solr site to there:
mkdir -p /opt/solr/drupal/
mv solr-4.5.1/example/solr /opt/solr/drupal/solr
mv solr-4.5.1/dist/solr-4.5.1.war /opt/solr/drupal/solr/solr.war
mv solr-4.5.1/example/lib/ext/* /usr/share/tomcat6/lib/
mv solr-4.5.1/example/resources/log4j.properties /usr/share/tomcat6/lib/
Set log and data directory and other configurations:
sed -i 's/=logs/=\/var\/log\/tomcat6/g' /usr/share/java/tomcat6/log4j.properties
sed -i 's/data.dir:/data.dir:\/opt\/solr\/drupal\/solr\/data/g' /opt/solr/drupal/solr/collection1/conf/solrconfig.xml
mkdir /opt/solr/drupal/solr/collection1/data
chown tomcat:tomcat /opt/solr/drupal/solr/collection1/data
Checkout search_api_solr project and copy drupal solr configuration from there
git clone --branch 7.x-1.x http://git.drupal.org/project/search_api_solr.git
cp search_api_solr/solr-conf/4.x/* /opt/solr/drupal/solr/collection1/conf/
Create tomcat configuration for this solr instance:
tee /etc/tomcat6/Catalina/localhost/solr-drupal.xml <<EOF
<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/opt/solr/drupal/solr/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/opt/solr/drupal/solr" override="true"/>
</Context>
EOF
Start tomcat and make sure it is started on server restart:
/sbin/chkconfig --levels 235 tomcat6 on
/etc/init.d/tomcat6 start