The following steps have been tested on the x86 (32-bit) and x86-64 (64-bit) platforms. OpenSRF 1.4.1 has been tested on Debian Etch (4.0), Debian Lenny (5.0), and Ubuntu Lucid Lynx (10.04).
NOTE: These instructions are also available in the Evergreen documentation at http://docs.evergreen-ils.org/1.6/draft/html/serversideinstallation.html#serversideinstallation-opensrf. In github: http://github.com/rsoulliere/Evergreen-DocBook/blob/master/1.6/admin/serversideinstallation.xml.
In the following instructions, you are asked to perform certain steps as either the root user or the opensrf user.
su - command and enter the password of the root user.sudo su - command and enter the password of your current user.
To switch from the root user to a different user, issue the su - <username> command; for example, su - opensrf. Once you have become a non-root user, to become the root user again simply issue the exit command.
Also, in the following instructions, /path/to/OpenSRF/ represents the path to the OpenSRF source directory.
/bin/bash to inherit a reasonable environment:useradd -m -s /bin/bash opensrf passwd opensrf
wget http://open-ils.org/downloads/OpenSRF-1.4.1.tar.gz tar xzf OpenSRF-1.4.1.tar.gz
A new directory OpenSRF-1.4.1 is created.
debian-etch for Debian Etch (4.0)debian-lenny for Debian Lennyubuntu-hardy for Ubuntu Hardy Heron (8.04)ubuntu-karmic for Ubuntu Karmic Koala (9.10)ubuntu-lucid for Ubuntu Lucid Lynx (10.04)aptitude install make cd /path/to/OpenSRF make -f src/extras/Makefile.install <distribution>
This will install a number of packages required by OpenSRF on your system, including some Perl modules from CPAN. You can say "no" to the initial CPAN configuration prompt to allow it to automatically configure itself to download and install Perl modules from CPAN. The CPAN installer will ask you a number of times whether it should install prerequisite modules - say "yes".
–enable-python and –enable-java configure options if you want to include support for Python and Java, respectively:cd /path/to/OpenSRF ./configure --prefix=/openils --sysconfdir=/openils/conf make
cd /path/to/OpenSRF make install
/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:/etc/ld.so.conf.d/osrf.conf containing the following line:/openils/lib
ldconfig
public.localhost for the public domain and private.localhost for the private domain. On a single-server system, the easiest way to define public and private domains is to define separate hostnames by adding entries to the /etc/hosts file. Here are the entries to add as root to a stock /etc/hosts file for our example domains: 127.0.1.2 public.localhost public 127.0.1.3 private.localhost private
chown -R opensrf:opensrf /openils
/etc/init.d/ejabberd stop
beam and epmd processes, then edit /etc/default/ejabberd to hardcode a domain:epmd -kill killall beam; killall beam.smp rm /var/lib/ejabberd/* echo 'ERLANG_NODE=ejabberd@localhost' >> /etc/default/ejabberd
/etc/ejabberd/ejabberd.cfg:{hosts, ["localhost"]}.
to
{hosts, ["localhost", "private.localhost", "public.localhost"]}.
{max_user_sessions, 10}. to {max_user_sessions, 10000}. If you see something like this instead: {access, max_user_sessions, [{10, all}]}., then change it to {access, max_user_sessions, [{10000, all}]}.max_stanza_size to 2000000.maxrate to 500000.{mod_offline line by placing two % signs in front./etc/init.d/ejabberd start
opensrf_core.xml:# Syntax for registering a user with ejabberdctl # ejabberdctl register <user> <domain> <password> ejabberdctl register router private.localhost <password> ejabberdctl register opensrf private.localhost <password> ejabberdctl register router public.localhost <password> ejabberdctl register opensrf public.localhost <password>
/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
/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 = routerpassword = password for public.localhost router user/config/routers/router/transport - second entry, where transport/server == private.localhost :username = routerpassword = password for private.localhost router user/openils/conf/opensrf.xml to set the location of the persistent database in the <dbfile> element near the end of the file:<!-- Example of an app-specific setting override --> <opensrf.persist> <app_settings> <dbfile>/tmp/persist.db</dbfile> </app_settings> </opensrf.persist>
/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 domainlogfile 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 --> <srfsh> <router_name>router</router_name> <domain>private.localhost</domain> <username>opensrf</username> <passwd>privsrf</passwd> <port>5222</port> <logfile>/tmp/srfsh.log</logfile> <loglevel>3</loglevel> </srfsh>
.bashrc file:echo "export PATH=/openils/bin:\$PATH" >> ~/.bashrc exit
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
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):
osrf_ctl.sh -l -a start_all
/openils/bin directory; this should have been set by .bashrc when you logged in as the opensrf user, but you can manually set it using the following command:export PATH=$PATH:/openils/bin
Once you have installed and started OpenSRF, test your connection to OpenSRF via srfsh:
srfsh and try calling the add method on the OpenSRF math service:/openils/bin/srfsh srfsh# request opensrf.math add 2 2
You should see a result like:
Received Data: 4 ------------------------------------ Request Completed Successfully Request Time in seconds: 0.007519 ------------------------------------ srfsh#
If this does not work, it's time to do some troubleshooting. Please do not make any significant changes to your configuration. If you have followed the entire set of installation steps listed here closely, you are probably extremely close to a working system. Gather your configuration files and log files in /openils/var/log and contact the Evergreen development mailing list for assistance before making any drastic changes to your system configuration.
osrf_ctl.sh -l -a stop_all