Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Install Apache Solr on Server

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:04
    In this tutorial, I'd like to take a look at installing Solr
  • 0:07
    on a server that is more similar to what we'd likely use in production.
  • 0:12
    In a previous tutorial, we looked at how you could install Solr on your localhost
  • 0:16
    and just download the Solr binaries
  • 0:19
    and basically run the sample application that came with it using the Java command line.
  • 0:23
    And that works great if what you're doing is developing things on your laptop
  • 0:26
    or even probably for smaller sites.
  • 0:29
    However, if you're installing Solr on its own server
  • 0:33
    as part of your production infrastructure,
  • 0:35
    or on the same server that you're running your live Drupal site,

Install Apache Solr on Server

Loading...

If you're installing Solr on a production server there are some additional considerations you'll want to be aware of. The most important thing is that instead of just running the Solr application directly you'll likely want to run it inside of a J2EE server container like Tomcat or Jetty. In this tutorial we'll look a installing Solr on Ubuntu using the same process that we would recommend for a production installation. We'll do this by starting with a Vagrant VM with nothing but Ubuntu installed and walk through the steps required to get Solr up and running.

The steps are going to be similar, but different depending on your OS of choice, and it would be impossible for us to cover them all. So here's a general outline of what you'll want to do:

  1. Install Java. Note, you need the full JDK for Solr not just the JRE.
  2. Install a J2EE application server like Tomcat or Jetty.
  3. Download the version of Apache Solr you want to use.
  4. Configure your J2EE application server to run Apache Solr.
  5. Configure your system to automatically start/stop your application server.

We'll be following along with the instructions provided in this excellent blog post by Ben Chavet over on Lullabot.com, though some of the commands will be a little different since software versions have changed, etc. If you prefer to follow along with written instructions, or want to have the list of commands next to you when it comes time to set things up for real, give that post a read.

A note about security. We will NOT be going over how to restrict access to the Solr instance on the Ubuntu server as that's outside the scope of this tutorial. However, it's important that you do so. At a minimum you'll want to configure your firewall to prevent access to the Solr host from anything other then the web server where you Drupal site lives.

By the end of this tutorial you should be able to list the requirements and considerations that need to be evaluated when installing Solr on a production server.

Things you might want to copy/paste if you're following along:

Content of Tomcat context file - /usr/local/tomcat/conf/Catalina/localhost/solr.xml :


<Context docBase="/usr/local/tomcat/webapps/solr.war" debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/usr/local/tomcat/solr" override="true" />
</Context>

Content of the Solr definition file - /usr/local/tomcat/solr/solr.xml :


<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false">
  <cores adminPath="/admin/cores">
    <core name="drupal" instanceDir="drupal" />
  </cores>
</solr>
Downloads: 
Log in or sign up to download companion files.