Installing the Samgrah ILS on Ubuntu 16.04.1

Samgrah is a freely available integrated library system (ILS) developed in India as a project for students of Ruby on Rails. Let me say at the outset that Samgrah is NOT a professional ILS. It leaves quite a bit to be desired (MARC-record, anyone? Serials? Acquisitions?) for actual library use, and more resembles an archival management tool than anything else.  But it’s a fun Rails project to play with. I will post more after I’ve had a chance to tweak and hack at it, but I thought I’d record the installation process with the solution to a small glitch I encountered along the way. First, install Ubuntu 16.04 (Xenial Xerus), the latest LTS (long-term support) version:

Then, if your Ubuntu installation didn’t already include it, install Rails:

Install PostgreSQL:, but it may already be installed as part of your Ubuntu installation package as well, as was the case for me.

 sudo apt-get install postgresql postgresql-contrib

Clone the Samgrah repository to your computer from GitHub:

cd ~
mkdir -p Code
cd Code
git clone Samgrah

Install PGAdmin III GUI for easy configuration if you wish:

sudo apt-get install pgadmin3

Setup the PostgreSQL server with a postgres user and password:

sudo -u postgres psql postgres

Configure PostgreSQL for Samgrah:

create user samgrah with encrypted password 'samgrah';
alter user samgrah createdb;
create database samgrah;
create database samgrah_dev;
create database samgrah_test;
alter database samgrah owner to samgrah;
alter database samgrah_dev owner to samgrah;
alter database samgrah_test owner to samgrah;

Exit PostgreSQL:


Install the Dependencies:

cd Samgrah
bundle install

Configure database applications:

cd config
mv database.example.yml database.yml
mv secrets.example.yml secrets.yml
rake secret

At this point I received an error indicating that I needed to install json-1.8.1 before continuing. The problem, however, is that json-1.8.3 was already installed as part of Ubuntu 16.04’s Ruby package. I tried updating all the Ruby gems to no avail. Here’s the fix if you encounter this same problem: delete gemfile.lock (find it search in the desktop file browser if needed) , run “bundle install” and voila – problem fixed. You will then need to again do “rake secret” to complete the actions from above.

A little more housekeeping:

rake db:reset
rake db:settings
rake db:history

You can now start the server:

rails server

Open a browser and go to to see Samgrah up and running.

To access the administrative pages, login using admin@samgrah.local as the email address and “samyukti” as the password. You can change this admin account or create others by selecting “Users” as the bottom of the list in the left-column.

Helpful Links: