1 README for OpenSRF 2.0.0
2 ============================
4 Installing prerequisites:
5 -------------------------
7 OpenSRF has a number of prerequisite packages that must be installed
8 before you can successfully configure, compile, and install OpenSRF.
9 On Debian and Ubuntu, the easiest way to install these prerequisites
10 is to use the Makefile.install prerequisite installer for Evergreen.
12 Issue the following commands as the root user to install prerequisites
13 using the Makefile.install prerequisite installer, substituting your
14 operating system identifier for <osname> below:
16 ---------------------------------------------------------------------------
18 make -f src/extras/Makefile.install <osname>
19 ---------------------------------------------------------------------------
21 Well-tested values for <osname> include:
23 * `debian-lenny` for Debian 5.0
24 * `debian-squeeze` for Debian 6.0.0
25 * `ubuntu-hardy` for Ubuntu 8.04
26 * `ubuntu-lucid` for Ubuntu 10.04
27 * `ubuntu-precise` for Ubuntu 12.04
28 * `fedora15` for Fedora 15
30 Less-tested values for <osname> include:
32 * `centos` for CentOS 5
33 * `rhel` for Red Hat Enterprise Linux 5
35 Patches and suggestions for improvement from users of these distributions,
36 or others, are welcome!
38 When the prerequisite installer reaches the Perl module stage, you may
39 be prompted for configuration of Comprehensive Perl Archive Network (CPAN)
40 on your server. You can generally accept the defaults by pressing <return>
41 for all of the prompts, except for the country configuration.
44 If you are installing this using a copy of the source code that was
45 checked out directly from the OpenSRF git repository rather
46 than from a downloaded release of the source code, there are a few
47 additional prerequisite tools and steps that you will need to follow.
48 See "Developer instructions" at the bottom of the file.
50 Configuration and compilation instructions:
51 -------------------------------------------
53 Use the `configure` command to configure OpenSRF, and the `make` command to
54 build OpenSRF. The default installation prefix (PREFIX) for OpenSRF is
57 If you are building OpenSRF for Evergreen, pass the `--prefix` and
58 `--sysconfdir` options as follows:
60 ---------------------------------------------------------------------------
61 ./configure --prefix=/openils --sysconfdir=/openils/conf
63 ---------------------------------------------------------------------------
65 By default, OpenSRF includes C, Perl, and JavaScript support.
66 You can add the `--enable-python` option to the configure command
67 to build Python support, and `--enable-java` for Java support.
69 Installation instructions:
70 --------------------------
72 Once you have configured and compiled OpenSRF, issue the following
73 command as the root user to install OpenSRF:
75 ---------------------------------------------------------------------------
77 ---------------------------------------------------------------------------
79 This will install OpenSRF in the prefix directory that you specified in the
80 configuration step. This will also install example configuration files that
81 you can use as templates for your own configuration files.
83 Create and set up the opensrf Unix user environment:
84 ----------------------------------------------------
86 This user is used to start and stop all OpenSRF processes, and must own all
87 files contained in the PREFIX directory hierarchy. Issue the following
88 commands as root to create the `opensrf` user and set up its environment,
89 substituting <PREFIX> with the value you passed to `--prefix` in your
92 ---------------------------------------------------------------------------
93 # useradd -m -s /bin/bash opensrf
94 # echo "export PATH=\$PATH:/<PREFIX>/bin" >> /home/opensrf/.bashrc
96 # chown -R opensrf:opensrf /<PREFIX>
97 ---------------------------------------------------------------------------
99 Define your public and private OpenSRF domains:
100 -----------------------------------------------
102 For security purposes, OpenSRF uses Jabber domains to separate services
103 into public and private realms. Throughout these instructions, we will use
104 the example domains `public.localhost` and `private.localhost`.
106 On a single-server system, the easiest way to define public and private
107 domains is to define separate hostnames by adding entries to the `/etc/hosts`
108 file. Here are entries that you could make to a stock `/etc/hosts` file for our
111 ---------------------------------------------------------------------------
112 127.0.1.2 public.localhost public
113 127.0.1.3 private.localhost private
114 ---------------------------------------------------------------------------
116 Adjust the system dynamic library path:
117 ---------------------------------------
119 Add `<PREFIX>/lib/` to the system's dynamic library path, and then run
122 On Debian and Ubuntu systems, run the following commands as root:
124 ---------------------------------------------------------------------------
125 # echo <PREFIX>/lib > /etc/ld.so.conf.d/opensrf.conf
127 ---------------------------------------------------------------------------
129 On most other systems, you can add these entries to `/etc/ld.so.conf`, or
130 create a file within the `/etc/ld.so.conf.d/` directory, and then run
133 Configure the ejabberd server:
134 ------------------------------
136 OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
137 the Jabber server of choice for the OpenSRF project. In most cases, you only
138 have to make a few changes to the default `ejabberd.cfg` file to make ejabberd
141 1. Stop ejabberd before making any changes to its configuration by issuing the
142 following command as root:
144 ---------------------------------------------------------------------------
145 # /etc/init.d/ejabberd stop
146 ---------------------------------------------------------------------------
148 2. Open `/etc/ejabberd/ejabberd.cfg` and make the following
150 a. Define your public and private domains in the `hosts` directive. For
153 ---------------------------------------------------------------------------
154 {hosts, ["private.localhost", "public.localhost"]}
155 ---------------------------------------------------------------------------
157 b. Comment out the `mod_offline` directive
158 c. Increase the `max_user_sessions` value to 1000
159 d. Change all `max_stanza_size` values to 2000000
160 e. Change all `maxrate` values to 500000
162 3. Restart the ejabberd server to make the changes take effect:
163 ---------------------------------------------------------------------------
164 # /etc/init.d/ejabberd start
165 ---------------------------------------------------------------------------
167 Create the OpenSRF Jabber users:
168 --------------------------------
170 On each domain, you need two Jabber users to manage the OpenSRF communications:
172 * a `router` user, to whom all requests to connect to an OpenSRF service
173 will be routed; this Jabber user must be named `router`
174 * an `opensrf` user, which clients use to connect to OpenSRF services; this
175 user can be named anything you like
177 Create the Jabber users by issuing the following commands as root. Substitute
178 <password> for your chosen passwords for each user respectively:
180 ---------------------------------------------------------------------------
181 # ejabberdctl register router private.localhost <password>
182 # ejabberdctl register opensrf private.localhost <password>
183 # ejabberdctl register router public.localhost <password>
184 # ejabberdctl register opensrf public.localhost <password>
185 ---------------------------------------------------------------------------
187 Update the OpenSRF configuration files:
188 ---------------------------------------
190 There are two critical files that you must update to make OpenSRF work.
191 SYSCONFDIR is `/opensrf/etc` by default, or the value that you passed to
192 `--sysconfdir` during the configuration phase:
194 * `SYSCONFDIR/opensrf.xml` - this file lists the services that this
195 OpenSRF installation supports; if you create a new OpenSRF service,
196 you need to add it to this file.
197 * The `<hosts>` element at the bottom of the file lists the services
198 that should be started for each hostname. You can force the system
199 to use `localhost`, so in most cases you will leave this section
202 * `SYSCONFDIR/opensrf_core.xml` - this file lists the Jabber connection
203 information that will be used for the system, as well as determining
204 logging verbosity and defining which services will be exposed on the
205 HTTP gateway. There are four username/password pairs to update in this
207 1. `<config><opensrf>` = use the private Jabber `opensrf` user
208 2. `<config><gateway>` = use the public Jabber `opensrf` user
209 3. `<config><routers><router>` = use the public Jabber `router` user
210 4. `<config><routers><router>` = use the private Jabber `router` user
212 You should also create a `.srfsh.xml` file in the home directory of each user
213 that you want to enable to use the srfsh to communicate with OpenSRF services.
215 Copy `SYSCONFDIR/srfsh.xml.example` to `~/.srfsh.xml` and update the password
216 to match the one for your Jabber `opensrf` user with the private.localhost
219 Starting and stopping OpenSRF services:
220 ---------------------------------------
222 To start all OpenSRF services with a hostname of `localhost`, issue the
223 following command as the opensrf user:
225 ---------------------------------------------------------------------------
226 $ osrf_ctl.sh -l -a start_all
227 ---------------------------------------------------------------------------
229 To stop all OpenSRF services with a hostname of `localhost`, issue the
230 following command as the opensrf user:
233 ---------------------------------------------------------------------------
234 $ osrf_ctl.sh -l -a stop_all
235 ---------------------------------------------------------------------------
237 Testing the default OpenSRF services:
238 -------------------------------------
240 By default, OpenSRF ships with an `opensrf.math` service that performs basic
241 calculations involving two integers. Once you have started the OpenSRF
242 services, start srfsh and issue the following request:
244 ---------------------------------------------------------------------------
245 srfsh# request opensrf.math add 2,2
246 ---------------------------------------------------------------------------
248 You should receive the value `4`.
250 Troubleshooting note for Python users:
251 --------------------------------------
253 If you are running a Python client and trying to connect to OpenSRF running on
254 localhost rather than a hostname that can be resolved via DNS, you will
255 probably receive exceptions about `dns.resolver.NXDOMAIN`. If this happens,
256 you need to install the `dnsmasq` package, configure it to serve up a DNS
257 entry for localhost, and point your local DNS resolver to `dnsmasq`. For example,
258 on Ubuntu you can issue the following commands as root:
260 ---------------------------------------------------------------------------
261 # aptitude install dnsmasq
262 # /etc/init.d/dnsmasq restart
263 ---------------------------------------------------------------------------
265 Then edit `/etc/resolv.conf` and ensure that `nameserver 127.0.0.1` is the
266 first entry in the file.
268 Developer instructions:
269 -----------------------
271 Developers working directly with the source code from the git
272 repository will also need to install some extra packages and perform
273 one more step before they can proceed with the `./configure` step.
275 Install the following packages:
281 Run the following command in the source directory to generate the configure
282 script and Makefiles:
284 ---------------------------------------------------------------------------
286 ---------------------------------------------------------------------------
291 Need help installing or using OpenSRF? Join the mailing lists at
292 http://evergreen-ils.org/listserv.php or contact us on the Freenode
293 IRC network on the #evergreen channel.