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://evergreen-ils.org/downloads/opensrf-2.0.1.tar.gz tar xzf opensrf-2.0.1.tar.gz
A new directory opensrf-2.0.1 is created.
debian-lenny for Debian Lenny (5.0)debian-squeeze for Debian Squeeze (6.0)fedora13 for Fedora 13ubuntu-hardy for Ubuntu Hardy Heron (8.04)ubuntu-lucid for Ubuntu Lucid Lynx (10.04)centos for CentOS 5rhel for Red Hat Enterprise Linux 5aptitude 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. The first time you run CPAN, it will ask you whether you want it to automatically configure itself to download and install Perl modules from CPAN; in general, we suggest that you let CPAN auto-configure itself. Also, always allow the CPAN installer to install prerequisite modules when it asks.
–enable-python configure options if you want to include support for Python: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 /usr/local/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 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"]}.
to
{hosts, ["localhost", "private.localhost", "public.localhost"]}.
{access, max_user_sessions, [{10, all}]}., then change it to {access, max_user_sessions, [{10000, all}]}.{max_user_sessions, 10}. to {max_user_sessions, 10000}. 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>
Note: There appears to be a problem with ejabberdctl in that it does not escape input correctly, so a password like '0P3N$SRF' will be created as '0P3N'. A bug against ejabberd has been filed. To register a password using ejabberdctl with special shell characters until such time as that bug is resolved, the workaround is to specify a double-escaped character at the command line, for example, '0P3N\\\\$RF'
/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 (line 38*)/config/gateway/username = opensrf/config/gateway/passwd = password for public.localhost opensrf user (line 97*)/config/routers/router/transport - first entry, where transport/server == public.localhost :username = routerpassword = password for public.localhost router user (line 121*)/config/routers/router/transport - second entry, where transport/server == private.localhost :username = routerpassword = password for private.localhost router user (line 143*)/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
As the root user, before starting OpenSRF, ensure that your Jabber and memcached daemons are running.
/etc/init.d/ejabberd restart /etc/init.d/memcached restart # restarts are less disruptive to the system than 'start' when you are unsure of the service's current state
As the opensrf user, start OpenSRF. Starting OpenSRF with the start_all option starts the OpenSRF router, Perl services, and C services.
(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