Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
How to upgrade to SOLR 5.3.1 on Debian jessie for use with CKAN


This is without any reasonable idea about SOLR configuration. It just happens to work here. It is also specific to my server, you might severly damage yours if you copy & paste this blindly!

All commands to be executed as root.

Remove Debian packaged solr 3.6.2 and jetty8

apt-get remove --purge solr-common

This also removes the index. I want to re-index anyway.

apt-get remove --purge jetty8    
rm -rf /var/lib/jetty8
apt-get autoremove

The last line removes also java here. I want this because I also update java.

Install java-1.8 and solr 5.3.1

Add this line to /etc/apt/sources.list if not already present:

deb jessie-backports main
apt-get update
apt-get install openjdk-8-jre-headless
apt-get install unzip     #This apparently needed for installation

In a temporary directory: (follow instructions on in solr 5.4 docu)

tar zxvf solr-5.3.1.tgz solr-5.3.1/bin/ --strip-components=2
sudo bash ./ solr-5.3.1.tgz    #using default installation into /opt

service solr status   #Should show its up and running

Check also http://<hostname>:8983/solr whether you see the admin-interface.

Minimum configuration

Edit /var/solr/
I just add SOLR_JAVA_MEM="-Xms2g -Xmx2g"for a little more RAM.

CKAN configuration

This was the trickier part because the config file layout is not well documented. Presumably you should figure out what all the files mean and edit them accordingly. The default used here just happens to work here.

mkdir /var/solr/data/ckan1    "ckan1" is an arbitrary name for the (single) solr-"core"
touch /var/solr/data/ckan1/
cp -a /opt/solr/server/solr/configsets/basic_configs/conf /var/solr/data/ckan1
mv /var/solr/data/ckan1/conf/schema.xml /var/solr/data/ckan1/conf/schema.xml.orig
ln -s /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml /var/solr/data/ckan1/conf/schema.xml
chown -R solr:solr /var/solr

# restart solr
service solr restart

The admin interface http://<hostname>:8983/solr should now indicate that core "ckan1" is available.

CKAN config / re-index

In the init-file, set

solr_url =

# Become user `ckan` (might be different for you)
su ckan

# activate virtualenv 
source /usr/lib/ckan/default/bin/activate

cd /usr/lib/ckan/default/src/ckan/ckan
paster search-index rebuild -c /etc/ckan/default/production.ini    #your init-file might be another one.

# As root, restart the httpd
systemctl restart apache2

Cool man, I've been stuck with this problem for 2 days now...

sovello commented Aug 3, 2016

So useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment