Installing OpenSRF for Evergreen-ILS

I am installing Evergreen-ils and getting OpenSRF installed is the second step in the journey.

The Evergreen Project develops an open source ILS (integrated library system) used by approximately 800 libraries.  The software, also called Evergreen, is used by libraries to provide their public catalog interface as well as to manage back-of-house operations such as circulation (checkouts and checkins), acquisition of library materials, and (particularly in the case of Evergreen) sharing resources among groups of libraries.

The Evergreen Project was initiated by the Georgia Public Library System in 2006 to serve their need for a scalable catalog shared by (as of now) approximately 250 public libraries in the state of Georgia.  After Evergreen was released, it has since been adopted by a number of library consortia in the US and Canada as well as various individual libraries, and has started being adopted by libraries outside of North America.

This is a work in progress, but here is the saga so far:

Notes: Where I am using passwords, I will instead use the convention of <secret>, so instead of saying “My password is T^T87uugf7h,” I will say “My password is <secret>.”  Things behind a “#” sign are comments – either comments in the files themselves or notes to my readers


# openSRF
Evergreen install
As the root user, add the opensrf user. We set the default shell for the new user to /bin/bash to inherit a reasonable environment:
useradd -m -s /bin/bash opensrf       #

passwd opensrf
As the opensrf user, download and extract the source files for OpenSRF 2.0.0:
tar xzf opensrf-2.0.0.tar.gz
A new directory opensrf-2.0.0 is created.
As the root user, install the software prerequisites using the automatic prerequisite installer. Replace <distribution> below with the following value for your distribution:
debian-lenny for Debian Lenny (5.0)
debian-squeeze for Debian Squeeze (6.0)
fedora13 for Fedora 13
ubuntu-hardy for Ubuntu Hardy Heron (8.04)
ubuntu-lucid for Ubuntu Lucid Lynx (10.04)
centos for CentOS 5
rhel for Red Hat Enterprise Linux 5
aptitude install make
cd /path/to/OpenSRF
make -f src/extras/Makefile.install <distribution>

# This didn’t work for me, so I went on without it.  “They probably don’t have a config for Natty,” I thought.
check dependencies by going to openSRF directory, and:
$ ./configure
it said I was missing APXS and this was availiable in apache-prefork or apache-threaded
I chose threaded
# missing XMLADDID
can’t find with a search of packages
to add python support, which seemed useful
$ ./configure –prefix=/openils –sysconfdir=/openils/conf
#still missing xmlAddId
sudo aptitude install xml2
after some hunting around…
wolf@tangle-rock:~/opensrf-2.0.0$ sudo aptitude install libxml2-dev
This got me to the next deficiency..
libmemcached>= 0.8.0
which is not in the repos under that name

wolf@tangle-rock:~/opensrf-2.0.0$ sudo aptitude install memcached
not enough.. found a version at
cd to libmemchached directory
Configuration summary for libmemcached version 0.50

* Installation prefix:       /usr/local
* System type:               pc-linux-gnu
* Host CPU:                  i686
* C Compiler:                gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
* Assertions enabled:        yes
* Debug enabled:             no
* Warnings as failure:       no

now to make and make install
Well, there were no apparent errors.. so we move on back to openSVF and try the configure step again.

By the way,
cd  -
takes you back to the last directory you were in

# oops, I have to config as opensrf user…
# and opensrf has no rights in my home directory

wolf@tangle-rock:~/opensrf-2.0.0$ sudo chown -Rv opensrf *.*
now when I run the configure comand it should work…

./configure –prefix=/openils –sysconfdir=/openils/conf –enable-python

# ok – this failed, so I copied the content of the opensrf install folder to opensrf’s home, and changed the ownership of all to opensrf.

opensrf@tangle-rock:/home/wolf/opensrf-2.0.0$ exit
root@tangle-rock:~/opensrf-2.0.0# cd ..
root@tangle-rock:~# cp -R opensrf-2.0.0/ /home/opensrf/

root@tangle-rock:~# su – opensrf
opensrf@tangle-rock:~$ ls
examples.desktop  opensrf-2.0.0

opensrf@tangle-rock:~$ exit

root@tangle-rock:~# cd /home/opensrf/
root@tangle-rock:/home/opensrf# chown -R opensrf:opensrf opensrf-2.0.0/
root@tangle-rock:/home/opensrf# ls -lR opensrf-2.0.0/  # (shows everything is changed)

# I am using
sudo bash -i
# because then I don’t have to hunt all the users’ passwords to suwitch to that user.

root@tangle-rock:/home/opensrf# su – opensrf
opensrf@tangle-rock:~$ cd opensrf-2.0.0/
opensrf@tangle-rock:~/opensrf-2.0.0$ ./configure –prefix=/openils –sysconfdir=/openils/conf –enable-python

# it failed to find python setuptoold module

opensrf@tangle-rock:~/opensrf-2.0.0$ exit
root@tangle-rock:/home/opensrf# aptitude install python-setuptools
The following NEW packages will be installed:
python-setuptools # and so on…

root@tangle-rock:/home/opensrf# su – opensrf
opensrf@tangle-rock:~$ cd opensrf-2.0.0/
opensrf@tangle-rock:~/opensrf-2.0.0$ ./configure –prefix=/openils –sysconfdir=/openils/conf –enable-python

——————— Configuration options:  ———————–
OSRF install Java support?       no
OSRF install Python support?     yes
OSRF install chopchop?           no
Installation directory prefix:   /openils
Temporary directory:             /tmp
APXS2 location:                  /usr/bin/apxs2
Apache headers location:         /usr/include/apache2
APR headers location:            /usr/include/apr-1.0
libxml2 headers location:        /usr/include/libxml2/

opensrf@tangle-rock:~/opensrf-2.0.0$ make
# Seems to have succeeded.  At least no errors noted at the end

root@tangle-rock:/home/opensrf# cd opensrf-2.0.0/
root@tangle-rock:/home/opensrf/opensrf-2.0.0# make install
# Cross your fingers.  We are almost halfway home.

ext/xmlextra.c:1:20: fatal error: Python.h: No such file or directory
compilation terminated.
# oops/  What now!
# where is Python.h??

# suggests the error can be cleared by installing python2.x-dev – so in my case it would be
root@tangle-rock:/home/opensrf/opensrf-2.0.0# aptitude install python2.7-dev

# from the wiki..
# As the root user, add /openils/lib to the system dynamic library path and make your system recognize the newly installed libraries. For example, on Ubuntu or Debian you would perform the following steps:
Create a file named /etc/ containing the following line:

root@tangle-rock:/home/opensrf/opensrf-2.0.0# vi /etc/

# I just copied the internal lines into the file [esc] :wq

root@tangle-rock:/home/opensrf/opensrf-2.0.0# ldconfig

# ldconfig(8)                                                        ldconfig(8)
#        ldconfig – configure dynamic linker run-time bindings
#        ldconfig [OPTION...]
#        ldconfig  creates,  updates,  and removes the necessary links and cache (for use by the run-time linker,  to  the  most  recent  shared libraries  found  in  the directories specified on the command line, in the file /etc/, and in the trusted directories (/usr/lib  and /lib).   ldconfig  checks the header and file names of the libraries it encounters when determining which  versions  should  have  their  links updated.  ldconfig ignores symbolic links when scanning for libraries.

# Define your public and private OpenSRF domains. For security purposes, OpenSRF uses Jabber domains to separate services into public and private realms.

# Gee! I wonder if there is a jabber server on this box..
root@tangle-rock:/home/opensrf/opensrf-2.0.0# aptitude install jabberd
Couldn’t find package “jabberd”.  However, the following
packages contain “jabberd” in their name:
ejabberd jabberd2 libjabberd2-dev ejabberd-mod-shared-roster-ldap
libjabberd2 jabberd14
Couldn’t find package “jabberd”.  However, the following
packages contain “jabberd” in their name:
ejabberd jabberd2 libjabberd2-dev ejabberd-mod-shared-roster-ldap
libjabberd2 jabberd14
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

root@tangle-rock:/home/opensrf/opensrf-2.0.0# aptitude install ejabberd
The following NEW packages will be installed:
ejabberd erlang-asn1{a} erlang-odbc{a}
# and so on…

Here are the entries to add as root to a stock /etc/hosts file for our example domains:    public.localhost    public    private.localhost    private

root@tangle-rock:/home/opensrf/opensrf-2.0.0# vi /etc/hosts       tangle-rock     localhost.localdomain   localhost
::1              tangle-rock     localhost6.localdomain6 localhost6       tangle-rock       public.localhost        public          #added 20110714       private.localhost       private         #added 20110714

As the root user, change the ownership of the installed files to the opensrf user:
chown -R opensrf:opensrf /openils

root@tangle-rock:/home/opensrf/opensrf-2.0.0# chown -R opensrf:opensrf /openils

As the root user, stop the ejabberd service:
/etc/init.d/ejabberd stop
root@tangle-rock:/home/opensrf/opensrf-2.0.0# service ejabberd stop
Stopping jabber server: ejabberd.

As the root user, edit /etc/ejabberd/ejabberd.cfg to increase the default limits (meant for a small instant messaging server) to something reasonable for our use of XMPP as a message bus:
{hosts, ["localhost"]}.
{hosts, ["localhost", "private.localhost", "public.localhost"]}.

Increase the maximum number of times a user can log in concurrently:
Newer versions of ejabberd: {access, max_user_sessions, [{10, all}]}., then change it to {access, max_user_sessions, [{10000, all}]}. # This was what I found
Older versions of ejabberd: change {max_user_sessions, 10}. to {max_user_sessions, 10000}.
Change all three occurrences of max_stanza_size to 2000000.
Change both occurrences of maxrate to 500000.
Comment out the {mod_offline line by placing two % signs in front. # It was easier to find these occurrences in gedit than vi…

# Still as root, restart ejabberd
root@tangle-rock:/home/opensrf/opensrf-2.0.0# service ejabberd start
Starting jabber server: ejabberd.

As the root user, register your “router” and “opensrf” ejabber users for the OpenSRF router service on each domain. The users should have different passwords on each domain. These users will correspond to your configuration in opensrf_core.xml:
# Syntax for registering a user with ejabberdctl
# ejabberdctl register <user> <domain> <password>
ejabberdctl register router private.localhost <secret>
ejabberdctl register opensrf private.localhost <secret>
ejabberdctl register router public.localhost <secret>
ejabberdctl register opensrf public.localhost <secret>

# As the opensrf user, create the /openils/conf/opensrf_core.xml and /openils/conf/opensrf.xml configuration files from the example templates:
cp /openils/conf/opensrf.xml.example /openils/conf/opensrf.xml
cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
# Edit /openils/conf/opensrf_core.xml to change the Jabber usernames and passwords as follows. I’m using XPath syntax on the left-hand side to indicate the position in the XML file:
/config/opensrf/username = opensrf
/config/opensrf/passwd = password for private.localhost opensrf user
/config/gateway/username = opensrf
/config/gateway/passwd = password for public.localhost opensrf user
/config/routers/router/transport – first entry, where transport/server == public.localhost :
username = router
password = password for public.localhost router user
/config/routers/router/transport – second entry, where transport/server == private.localhost :
username = router
password = password for private.localhost router user
Copy /openils/conf/srfsh.xml.example to .srfsh.xml in the home directory of each user you want to use to run the srfsh command line client for testing OpenSRF, and edit .srfsh.xml as follows:
domain is the router hostname (following our domain examples, private.localhost will give your srfsh access to all OpenSRF services, while public.localhost will only give you access to those OpenSRF services that are publicly exposed)
username and password must match your opensrf ejabber user for the chosen domain
logfile is the full path for a log file to which that user has write access
<?xml version=”1.0″?>
<!– This file follows the standard bootstrap config file layout found in opensrf_core.xml –>

As the opensrf user, set the path of the opensrf user’s .bashrc file:
echo “export PATH=/openils/bin:\$PATH” >> ~/.bashrc

opensrf@tangle-rock:~$ echo “export PATH=/openils/bin:\$PATH” >> ~/.bashrc

Before starting OpenSRF, ensure that your Jabber and memcached daemons are running. As the root user:
/etc/init.d/ejabberd start
/etc/init.d/memcached start

root@tangle-rock:/home/opensrf/opensrf-2.0.0# /etc/init.d/ejabberd restart
Restarting jabber server: ejabberd.
root@tangle-rock:/home/opensrf/opensrf-2.0.0# /etc/init.d/memcached restart
Restarting memcached: memcached.
# Restart has less potential to damage anything, though it will drop active connections just like running start on a running service.

Starting OpenSRF with the start_all option starts the OpenSRF router, Perl services, and C services. As the opensrf user, start OpenSRF (NOTE: use the -l flag only if you wish to force the hostname for the <hosts> section in opensrf.xml to be localhost): -l -a start_all -a start_all

# Failed to start
opensrf@tangle-rock:~/opensrf-2.0.0$ -a start_all
Starting OpenSRF Router
Starting OpenSRF Perl
Can’t locate Unix/ in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.10.1/OpenSRF/Utils/ line 6.
BEGIN failed–compilation aborted at /usr/local/share/perl/5.10.1/OpenSRF/Utils/ line 6.
Compilation failed in require at /openils/bin/ line 20.
BEGIN failed–compilation aborted at /openils/bin/ line 20.

# Suggestion at to handle failed Perl issue

opensrf@tangle-rock:~/opensrf-2.0.0$ apt-cache search syslog | grep perl
libnet-server-perl – An extensible, general perl server engine
libunix-syslog-perl – Perl interface to the UNIX syslog(3) calls
libgetargs-long-perl – Perl module to parse long function arguments
liblog-dispatchouli-perl – simple wrapper around Log::Dispatch
liblogger-syslog-perl – Logger::Syslog — an simple wrapper over Sys::Syslog for Perl
libparse-syslog-perl – Perl module for parsing syslog entries
libsys-syslog-perl – Perl interface to the UNIX syslog(3) calls
perl – Larry Wall’s Practical Extraction and Report Language

root@tangle-rock:/home/opensrf/opensrf-2.0.0# aptitude install perl libnet-server-perl libunix-syslog-perl libgetargs-long-perl liblog-dispatchouli-perl liblogger-syslog-perl libparse-syslog-perl libsys-syslog-perl
The following NEW packages will be installed:
libcommon-sense-perl{a} libdata-optlist-perl{a} libgetargs-long-perl
libio-multiplex-perl{a} libjson-perl{a} libjson-xs-perl{a}
liblog-agent-perl{a} liblog-dispatch-array-perl{a}
liblog-dispatch-perl{a} liblog-dispatchouli-perl liblogger-syslog-perl
libnet-cidr-perl{a} libnet-server-perl libparams-util-perl{a}
libparams-validate-perl{a} libparse-syslog-perl libstring-flogger-perl{a}
libsub-exporter-perl{a} libsub-install-perl{a} libsys-syslog-perl
libtest-deep-perl{a} libtry-tiny-perl{a} libunix-syslog-perl
0 packages upgraded, 23 newly installed, 0 to remove and 0 not upgraded.
Need to get 933 kB of archives. After unpacking 3,826 kB will be used.
Do you want to continue? [Y/n/?]
# install follows.

# Now the failure is
Can’t locate UNIVERSAL/ in @INC ….
suggestion from

“See if UNIVERSAL is present
perl -MUNIVERSAL::require -e 1

# This has same error
apt-get install libuniversal-require-perl

# Now we can all wonder why something called “universal” is not installed with the big perl install I just did.
# error: Can’t locate in @INC
# Help from
/usr/bin/perl List::MoreUtils  # Failed
apt-get install libpq-dev        # already newest version
# Since I couldn’t exactly find the right datatime modulre, I just went to synaptic and searched for all perl-related stuff, and then filtered that by “date’  I am installing about 123 packages, but I am tired of hunting one at a time.

# Finally, it started right up – automagically

opensrf@tangle-rock:~/opensrf-2.0.0$ -a start_allOpenSRF Router already started : 9608 9609
Starting OpenSRF Perl
* starting all services for tangle-rock.TLC
Starting OpenSRF C (host=tangle-rock.TLC)

# Testing openSRF
# Once you have installed and started OpenSRF, test your connection to OpenSRF via srfsh:
Start srfsh and try calling the add method on the OpenSRF math service:
srfsh#  request opensrf.math add 2 2
# Fails!
opensrf@tangle-rock:~/opensrf-2.0.0$ /openils/bin/srfsh
srfsh# request opensrf.math add 2 2

Received no data from server

Request Time in seconds: 0.003072

srfsh# exit

# The evergreen folks say “Don’t Panic! gather log files and such from /openils/var/log and the configuration files and send them to the support lists.

#  That is where this is all going now.


Leave a Reply