======Installing OpenSRF 1.0.7====== The following steps have been tested on the x86 (32-bit) and x86-64 (64-bit) platforms. OpenSRF 1.0.7 has been tested on Debian Etch (4.0), Debian Lenny, Ubuntu Hardy Heron (8.04), and Ubuntu Intrepid Ibex (8.10). ---- In the following instructions, you are asked to perform certain steps as either the **root** user or the **opensrf** user. * **Debian** To become the **root** user, issue the ''su -'' command and enter the password of the root user. * **Ubuntu** To become the **root** user, issue the ''sudo su -'' command and enter the password of your current user. To switch from the **root** user to a different user, issue the ''su - '' 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. - 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 1.0.7: wget http://open-ils.org/downloads/OpenSRF-1.0.7.tar.gz tar xzf OpenSRF-1.0.7.tar.gz A new directory ''OpenSRF-1.0.7'' is created. - As the **root** user, install the software prerequisites using the automatic prerequisite installer. Replace //// below with the following value for your distribution: * ''debian-etch'' for Debian Etch (4.0) * ''debian-lenny'' for Debian Lenny * ''ubuntu-hardy'' for Ubuntu Hardy Heron (8.04) * ''ubuntu-intrepid'' for Ubuntu Intrepid Ibex (8.10) aptitude install make cd /path/to/OpenSRF make -f src/extras/Makefile.install 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". - Build OpenSRF: - As the **opensrf** user, configure and compile OpenSRF. You can include the ''--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 - As the **root** user, return to your OpenSRF build directory and install OpenSRF: cd /path/to/OpenSRF make install - 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/ld.so.conf.d/osrf.conf'' containing the following line: /openils/lib - Run the following command: ldconfig - Define your public and private OpenSRF domains. For security purposes, OpenSRF uses Jabber domains to separate services into public and private realms. Throughout these instructions, we will use the example domains ''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 - As the **root** user, change the ownership of the installed files to the opensrf user: chown -R opensrf:opensrf /openils - As the **root** user, stop the ejabberd service: /etc/init.d/ejabberd stop * If ejabberd reports that it is already stopped, it may have run into a problem starting back at the installation stage. One possible fix is to kill any remaining ''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 - As the **root** user, edit ''/etc/ejabberd/ejabberd.cfg'': * Change {hosts, ["localhost"]}. to {hosts, ["localhost", "private.localhost", "public.localhost"]}. * Change ''{max_user_sessions, 10}.'' to ''{max_user_sessions, 1000}.'' If you see something like this instead: ''{access, max_user_sessions, [{10, all}]}.'', then change it to ''{access, max_user_sessions, [{1000, all}]}.'' * 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. - As the **root** user, restart the ejabberd service to test the configuration changes and to register your users: /etc/init.d/ejabberd start - On each domain, you need two Jabber users to manage the OpenSRF communications: * a "router" user, to whom all requests to connect to an OpenSRF service will be routed; this Jabber user must be named "router" * an "opensrf" user, which clients use to connect to OpenSRF services; this user can be named anything you like, but we will use "opensrf" in our examples - 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 ejabberdctl register router private.localhost ejabberdctl register opensrf private.localhost ejabberdctl register router public.localhost ejabberdctl register opensrf public.localhost - 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 - We also need to specify the domains from which we'll accept and to which we'll make connections. If you are installing OpenSRF on a single server and using the "private.localhost" / "public.localhost" domains, these will already be set to the correct values. Otherwise, search and replace to match your values. - Edit ''/openils/conf/opensrf.xml'' to set the location of the persistent database in the '''' element near the end of the file: /tmp/persist.db - 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 router private.localhost opensrf privsrf 5222 /tmp/srfsh.log 3 - As the **opensrf** user, set the path of the opensrf user's ''.bashrc'' file: echo "export PATH=/openils/bin:\$PATH" >> ~/.bashrc exit =====Starting OpenSRF===== 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: osrf_ctl.sh -l -a start_all * If you receive the error message **bash: osrf_ctl.sh: command not found**, then your environment variable **PATH** does not include the ''/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 =====Testing connections to 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: /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 [[http://open-ils.org/listserv.php|Evergreen development mailing list]] for assistance before making any drastic changes to your system configuration. =====Stopping OpenSRF===== - As the **opensrf** user, stop OpenSRF: osrf_ctl.sh -l -a stop_all