Most of high traffic or complex Drupal sites use Apache Solr as the search engine. It is much faster and more scaleable than Drupal's search module.

In a previous article on Drupal with Apache Solr 4.x, we described one way to install the latest stable Apache Solr 4.x. That article detailed a lot of manual steps involving downloading, extracting, setting permissions, creating a startup script, ...etc.

In this article, we describe another way for having a working Apache Solr installation for use with Drupal 7.x, on Ubunutu Server 12.04 LTS, as well as Ubuntu Server 14.04 LTS. This article uses an older version of Solr, 1.4 on the former, and 3.6 on the latter. But the methodology described uses the tried an tested apt dependency management system for Ubuntu, and other Debian based systems.


For this article, we focus on having an installation of Apache Solr with the following objectives:

  • Use the version of Apache Solr in Ubuntu's repositories, therefore no searching for software, or dependencies, start/stop scripts, ...etc.
  • Least amount of software dependencies, e.g. no need for 'heavy' components, such as a full Tomcat server
  • Least amount of necessary complexity
  • Least amount of software to install and maintain
  • A secure installation

This installation can be done on the same host that runs Drupal, if it has enough memory and CPU, or it can be on a separate server dedicated for search, which is the preferred approach.

Installing Java

We start by installing the Java Development Kit, whatever the default is for our version of the distro. This is guaranteed to work with Solr, using the Debian dependency magic.

sudo aptitude update
sudo aptitude install solr-jetty default-jdk

Configuring Jetty

Now, edit the file /etc/default/jetty, and change the following lines as follows:


For Ubuntu 12.04, also add the following line:


For Ubuntu 14.04, also add the following line:


Note that the JAVA_HOME line is dependent on your CPU architecture, and the JDK version that gets installed automatically by default, from the repositories. So if the above does not work, check what directories are installed under the directory /usr/lib/jvm, and choose a suitable version.

You can find out which JVM version and architecture is installed on your server by using the following command:

ls -l /usr/lib/jvm

Copying the Drupal schema and Solr configuration

We now have to copy the Drupal Solr configuration into Solr. Assuming your site is installed in /var/www, these commands achieve the tasks:
For Ubunutu 12.04, which installs Solr 1.4, use the following:

sudo cp /var/www/sites/all/modules/contrib/apachesolr/solr-conf/solr-1.4/* /etc/solr/conf

For Ubunutu 14.04, which installs Solr 3.6, use the following:

sudo cp /var/www/sites/all/modules/contrib/apachesolr/solr-conf/solr-3.x/* /etc/solr/conf

Then edit the file /etc/solr/conf/solrconfig.xml, and uncomment the following line:


Setting Apache Solr Authentication, using Jetty

By default, a Solr installation using Jetty, does not start at all, unless you configure /etc/default/jetty as above. The values above tells jetty to listen on the public Ethernet interface of a server, but has no protection whatsoever. Attackers can access Solr, and change its settings remotely. To prevent this, we set password authentication for Jetty, which in turn protest Solr.

Note: The following syntax is for Apache Solr 1.4 and 3.6 which depend on Jetty 6. Solr 4.x depends on Jetty 8, and use a different syntax described in our article linked above.

The following settings work well for a single core install, i.e. search for a single Drupal installation. If you want multi-core Solr, i.e. for many sites, then you want to fine tune this to add different roles to different cores.

First, edit the file: /etc/jetty/jetty.xml, and add this section before the last line:

<!-- ======= Securing Solr ===== -->
<Set name="UserRealms">
  <Array type="">
      <New class="">
        <Set name="name">Solr</Set>
        <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/</Set>

Then edit the file: /etc/jetty/webdefault.xml, and add this section, also before the last line:



Finally, edit the file: /etc/jetty/, and comment out all the existing lines, then add this line:

user: password, search-role

Note that "search-role" must match what you put in webdefault.xml above.

You can change "user" and "password" to suitable values.

Finally, make sure that the file containing passwords is not readable to anyone but the owner.

chmod 640 /opt/solr/example/etc/

Starting Solr

To start Solr, you need to start Jetty, which runs Solr for you automatically.

service jetty start

Now Solr is up and running.

Verify that it is running by accessing the following URL, where you can check the progress of indexing once you start it (see below):


Replace x.x.x.x by the IP address of the server that is running Solr, or its fully qualified domain name.

Viewing the logs

You can view the logs at:

tail -f /var/log/jetty/*.log

Configuring Drupal's Apache Solr module

After you have successfully installed, configured and started Solr, you should configure your Drupal site to interact with the Solr seserver. First, go to this URL: admin/config/search/apachesolr/settings/solr/edit, and enter the information for your Solr server. You should use the URL as follows:


Now you can proceed to reindex your site, by sending all the content to Solr.

Removing Solr

If you ever want to cleanly remove Apache Solr that you installed from the server using the above instructions, then use the sequence of the commands below:

sudo aptitude purge default-jdk solr-jetty

sudo rm -rf /var/lib/solr/ /etc/jetty /etc/solr


Thu, 2014/05/22 - 12:51

There is a good vagrant / ansible setup which I use to get a nice stack going with solr. It's called VLAD, stands for "The Vagrant LAMP Ansible Drupal development box" and it's here: and here:

I never took the time to see how it all gets installed, but it's really easy to fire up new VMs on a whim. Cheers, Jeff

Fri, 2014/08/01 - 07:40

I am gettting the following error
/etc/init.d/jetty: 16: /etc/default/jetty: not found

Wed, 2014/08/27 - 02:57

When I initially ran through this tutorial it work perfectly .. But now for some reasons I'm getting a 404 error when accessing solr/drupal

Problem accessing /solr/lgp.
Reason: Not Found
Powered by Jetty:// solr

I uninstalled everything and went through the tutorial again but cannot get it working again. I can still access the admin pages but not the cores.

Any Ideas?

Tue, 2015/06/02 - 08:57

I got a


Problem accessing /solr/index.jsp. Reason:

JSP support not configured

Powered by Jetty://

on url: http://x.x.x.x:8983/solr/admin/stats.jsp

anyone know what the error might be?

Tue, 2015/06/02 - 09:23

Try to go to http://x.x.x.x:8983/solr/ without anything after it, and see if you can navigate from there to other stuff.

If that does not work then you missed a step or did something differently.

Fri, 2015/09/18 - 08:45

I followed the same instruction above on an Ubuntu 14.04 (Trusty) server and got the same error.


[main] INFO org.mortbay.log - NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
[main] INFO org.mortbay.log - NO JSP Support for /solr, did not find org.apache.jasper.servlet.JspServlet

Could this have to do with /etc/solr/conf/solrconfig.xml or is the JSP support simply disabled for Jetty 6.x + SOLR 3.6.2?

Is your Drupal or Backdrop CMS site slow?
Is it suffering from server resources shortages?
Is it experiencing outages?
Contact us for Drupal or Backdrop CMS Performance Optimization and Tuning Consulting