Skip to main content
Home
badllama.com
  • Search
  • Log In

RHEL6: Apache Solr

Thu, 09/29/2011 - 23:59 by bchavet

  1. Enable the rhel-x86_64-server-supplementary-6 RHN channel. This is where the java-1.6.0-sun packages reside, which work much better than openjdk.
    rhn-channel -a -c rhel-x86_64-server-supplementary-6 -u $RHN_USERNAME -p $RHN_PASSWORD
  2. Install java and tomcat, then make sure tomcat starts on boot
    yum install java-1.6.0-sun tomcat6
    chkconfig tomcat6 on
  3. Download Solr from http://www.apache.org/dyn/closer.cgi/lucene/solr/. This example assumes version 1.4.1, so make any necessary adjustments if you use a different version.
  4. Create a location to store the Solr application and data files, and extract the required files from the Solr tarball downloaded above. There are only a few files needed in order to have a functioning solr instance.
    mkdir -p /var/lib/tomcat6/solr/solr
    tar --strip 2 -zxf apache-solr-1.4.1.tgz --wildcards "apache-solr-*/dist/apache-solr-*.war" -O > /var/lib/tomcat6/solr/solr.war
    tar -C /var/lib/tomcat6/solr/solr --strip 3 -zxf apache-solr-1.4.1.tgz --wildcards "apache-solr-*/example/solr/"
  5. If Solr needs to be on a different port than 8080, edit /usr/share/tomcat6/conf/server.xml. For example, if port 8983 is required
    sed -i s/\"8080\"/\"8983\"/g /usr/share/tomcat6/conf/server.xml
  6. Create the solr application instance file at /usr/share/tomcat6/conf/Catalina/localhost/solr.xml with the following contents
    <Context docBase="/var/lib/tomcat6/solr/solr.war" debug="0" crossContext="true" >
      <Environment name="solr/home" type="java.lang.String" value="/var/lib/tomcat6/solr/solr" override="true" />
    </Context>
  7. Either create or copy existing schema.xml and solrconfig.xml files into /var/lib/tomcat6/solr/solr/conf. Drupal, for example, provides these configuration files in the apachesolr module found at http://drupal.org/project/apachesolr. Creating these configuration files is outside of the scope of this document.
  8. Ensure the file permissions are correct on the new Solr installation
    chown -R tomcat: /var/lib/tomcat6/solr/
  9. Start Tomcat
    /etc/init.d/tomcat6 start

This configuration allows you to create multiple Solr indexes in /var/lib/tomcat6/solr. If another index is needed, extract another copy of the /examples directory from the Apache Solr tarball to /var/lib/tomcat6/solr/indexname, create/copy new schema.xml and solrconfig.xml to this directory, and create a new instance file at /usr/share/tomcat6/conf/Catalina/localhost/indexname.xml with the correct paths.

If you are interested in recording usage statistics from the JVM, you can do so with the Java SNMP service

Tags: 
rhel6
linux
redhat
solr
tomcat

Book Navigation

  • ‹ Red Hat Enterprise Linux 6
  • up
Powered by Backdrop CMS