Installing Blacklight and Solr on Ubuntu 16.04

Academic Commons is Columbia University’s digital research repository where faculty, students, and staff, and alumni deposit the results of their scholarly work and research. Academic Commons is a Fedora repository with a customized interface built on Blacklight, an open-source Ruby on Rails application designed to offer a next-generation user experience, including faceted searching. Repository content is indexed with Apache Solr, an open-source search platform. — http://www.duraspace.org/technologies/whats-the-repository-for-me

The Blacklight Welcome Screen

I decided to install Blacklight and Solr on a local Ubuntu machine in order to play around with the possibilities. Blacklight is an open source Ruby-on-Rails engine plugin for searching an Apache Solr index. Solr is a full-text search server that uses the Java search library for its indexing.  So, together, the two could provide some interesting possibilities as a platform for a text repository.

These installation steps are a modified version of those found on the project page: https://github.com/projectblacklight/blacklight/wiki/Quickstart

I suggest using Ubuntu 16.04, which as of today is the most recent long-term support version.  A full installation should include Ruby, Rails, and Java (or a java alternative) but check for them anyway on your Ubuntu version:

ruby --version

rails --version

java -version

Create the Rails application and navigate to the application’s directory. I choose to place all my Rails apps in the same parent directory for convenience, but create the rails app wherever you typically do:

rails new blacklightapp

cd blacklightapp

Edit your blacklightapp’s gemfile using gedit or your favorite editor (like nano or vi):

sudo gedit gemfile

Add this to the gemfile:

gem 'blacklight', '~> 6.0'

Note that tilde (~). It’s not a dash (-).  Also, add gem ‘therubyracer’ which was already in my gemfile but commented out. I just had to uncomment it. Save the file and close your editor.

Then, update the bundle:

bundle install

Next, Github suggests installing blacklight using Devise for user authentication:

rails generate blacklight:install --devise --marc --solr_version=latest

However, the above command resulted in a few errors in that not all the gems were installed and would not install automatically. If you receive this error, just install the indicated gems manually.  I had to install three gems:

sudo gem install solr_wrapper 

sudo gem install blacklight-marc 

sudo gem install devise-guests

Then, if you had to install gems manually, re-run:

rails generate blacklight:install --devise --marc --solr_version=latest

Run database migrations:

rake db:migrate

Check to see if Solr is running (this might take a few minutes):

bundle exec solr_wrapper

You should now be able to see Solr running at: http://localhost:8983/solr and  http://localhost:8983/solr/#/blacklight-core/query

Leave that terminal open and open another terminal. Then, navigate to the application directory and index the sample MARC data provided:

rake solr:marc:index_test_data

Github indicates that you might encounter an error at this point depending on which version of Solr you are using.  If so, that error can apparently be ignored. I, however, did not receive this error and proceeded immediately to starting the Rails server:

rails server

The blacklightapp should now be up and running with 30 indexed MARC records: http://localhost:3000/catalog

A post on importing additional or replacement MARC records is soon to follow.

The Blacklight Welcome Screen

 

Leave a Reply