4 Preamble: referenced user accounts
5 ----------------------------------
7 In subsequent sections, we will refer to a number of different accounts, as
10 * Linux user accounts:
11 ** The *user* Linux account is the account that you use to log onto the
12 Linux system as a regular user.
13 ** The *root* Linux account is an account that has system administrator
14 privileges. On Debian and Fedora you can switch to this account from
15 your *user* account by issuing the `su -` command and entering the
16 password for the *root* account when prompted. On Ubuntu you can switch
17 to this account from your *user* account using the `sudo su -` command
18 and entering the password for your *user* account when prompted.
19 ** The *opensrf* Linux account is an account that you will create as part
20 of installing OpenSRF. You can switch to this account from the *root*
21 account by issuing the `su - opensrf` command.
23 Installing prerequisites
24 ------------------------
26 OpenSRF has a number of prerequisite packages that must be installed
27 before you can successfully configure, compile, and install OpenSRF.
28 On Debian and Ubuntu, the easiest way to install these prerequisites
29 is to use the Makefile.install prerequisite installer for Evergreen.
31 Issue the following commands as the root user to install prerequisites
32 using the Makefile.install prerequisite installer, substituting your
33 operating system identifier for <osname> below:
35 ---------------------------------------------------------------------------
37 make -f src/extras/Makefile.install <osname>
38 ---------------------------------------------------------------------------
40 Well-tested values for <osname> include:
42 * `debian-squeeze` for Debian 6.0
43 * `ubuntu-lucid` for Ubuntu 10.04
44 * `ubuntu-precise` for Ubuntu 12.04
45 * `fedora` for Fedora 16
47 Patches and suggestions for improvement from users of these distributions,
48 or others, are welcome!
50 When the prerequisite installer reaches the Perl module stage, you may
51 be prompted for configuration of Comprehensive Perl Archive Network (CPAN)
52 on your server. You can generally accept the defaults by pressing <return>
53 for all of the prompts, except for the country configuration.
55 Preamble: Developer instructions
56 --------------------------------
59 Skip this section if you are using an official release tarball downloaded
60 from http://evergreen-ils.org/downloads
62 Developers working directly with the source code from the Git repository,
63 rather than an official release tarball, must install some extra packages
64 and perform one step before they can proceed with the `./configure` step.
66 As the *root* Linux account, install the following packages:
72 As the *user* Linux account, issue the following command in the OpenSRF
73 source directory to generate the configure script and Makefiles:
76 ------------------------------------------------------------------------------
78 ------------------------------------------------------------------------------
80 Configuration and compilation instructions
81 ------------------------------------------
83 Use the `configure` command to configure OpenSRF, and the `make` command to
84 build OpenSRF. The default installation prefix (PREFIX) for OpenSRF is
87 If you are building OpenSRF for Evergreen, issue the following commands as
88 the *user* Linux account to configure and build OpenSRF:
90 ---------------------------------------------------------------------------
91 ./configure --prefix=/openils --sysconfdir=/openils/conf
93 ---------------------------------------------------------------------------
95 By default, OpenSRF includes C, Perl, and JavaScript support.
96 You can add the `--enable-python` option to the configure command
97 to build Python support and `--enable-java` for Java support.
99 Installation instructions
100 -------------------------
102 1. Once you have configured and compiled OpenSRF, issue the following
103 command as the *root* Linux account to install OpenSRF:
106 ---------------------------------------------------------------------------
108 ---------------------------------------------------------------------------
110 Create and set up the opensrf Unix user environment
111 ---------------------------------------------------
113 This user is used to start and stop all OpenSRF processes, and must own all
114 files contained in the PREFIX directory hierarchy. Issue the following
115 commands as the *root* Linux account to create the `opensrf` user and set up
116 its environment, substituting <PREFIX> with the value you passed to `--prefix`
117 in your configure command:
119 .Creating the `opensrf` user
121 ---------------------------------------------------------------------------
122 useradd -m -s /bin/bash opensrf
123 echo "export PATH=\$PATH:/<PREFIX>/bin" >> /home/opensrf/.bashrc
125 chown -R opensrf:opensrf /<PREFIX>
126 ---------------------------------------------------------------------------
128 Define your public and private OpenSRF domains
129 ----------------------------------------------
131 For security purposes, OpenSRF uses Jabber domains to separate services
132 into public and private realms. Throughout these instructions, we will use
133 the example domains `public.localhost` and `private.localhost`.
135 On a single-server system, the easiest way to define public and private
136 domains is to define separate hostnames by adding entries to the `/etc/hosts`
137 file. Here are entries that you could add to a stock `/etc/hosts` file for our
140 .Example added entries for `/etc/hosts`
141 ---------------------------------------------------------------------------
142 127.0.1.2 public.localhost public
143 127.0.1.3 private.localhost private
144 ---------------------------------------------------------------------------
146 Adjust the system dynamic library path
147 --------------------------------------
149 Add `<PREFIX>/lib/` to the system's dynamic library path, and then run
150 `ldconfig` as the *root* Linux account.
152 On Debian, Ubuntu, and Fedora systems, run the following commands as the *root*
155 .Adjusting the system dynamic library path
157 ---------------------------------------------------------------------------
158 echo <PREFIX>/lib > /etc/ld.so.conf.d/opensrf.conf
160 ---------------------------------------------------------------------------
162 On most other systems, you can add these entries to `/etc/ld.so.conf`, or
163 create a file within the `/etc/ld.so.conf.d/` directory, and then run
164 `ldconfig` as the *root* Linux account.
166 Configure the ejabberd server
167 -----------------------------
169 OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
170 the Jabber server of choice for the OpenSRF project. In most cases, you only
171 have to make a few changes to the default `ejabberd.cfg` file to make ejabberd
174 1. Stop ejabberd before making any changes to its configuration by issuing the
175 following command as the *root* Linux account:
177 .(Debian / Ubuntu) Stopping ejabberd
179 ---------------------------------------------------------------------------
180 /etc/init.d/ejabberd stop
181 ---------------------------------------------------------------------------
183 .(Fedora) Stopping ejabberd
185 ---------------------------------------------------------------------------
186 systemctl stop ejabberd.service
187 ---------------------------------------------------------------------------
189 2. Open `/etc/ejabberd/ejabberd.cfg` and make the following
191 a. Define your public and private domains in the `hosts` directive. For
194 ---------------------------------------------------------------------------
195 {hosts, ["localhost", "private.localhost", "public.localhost"]}.
196 ---------------------------------------------------------------------------
198 b. Comment out the `mod_offline` directive
199 c. Increase the `max_user_sessions` value to 10000
200 d. Change all `max_stanza_size` values to 2000000
201 e. Change all `maxrate` values to 500000
203 3. Restart the ejabberd server to make the changes take effect:
205 .(Debian / Ubuntu) Starting ejabberd
207 ---------------------------------------------------------------------------
208 /etc/init.d/ejabberd start
209 ---------------------------------------------------------------------------
211 .(Fedora) Starting ejabberd
213 ---------------------------------------------------------------------------
214 systemctl start ejabberd.service
215 ---------------------------------------------------------------------------
217 Create the OpenSRF Jabber users
218 -------------------------------
220 On each domain, you need two Jabber users to manage the OpenSRF communications:
222 * a `router` user, to whom all requests to connect to an OpenSRF service
223 will be routed; this Jabber user must be named `router`
224 * an `opensrf` user, which clients use to connect to OpenSRF services; this
225 user can be named anything you like
227 Create the Jabber users by issuing the following commands as the *root* Linux
228 account. Substitute `<password>` for your chosen passwords for each user
231 .Creating the OpenSRF Jabber users
233 ---------------------------------------------------------------------------
234 ejabberdctl register router private.localhost <password>
235 ejabberdctl register opensrf private.localhost <password>
236 ejabberdctl register router public.localhost <password>
237 ejabberdctl register opensrf public.localhost <password>
238 ---------------------------------------------------------------------------
240 Update the OpenSRF configuration files
241 --------------------------------------
243 About the OpenSRF configuration files
244 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245 There are several configuration files that you must update to make OpenSRF
246 work. SYSCONFDIR is `/opensrf/etc` by default, or the value that you passed to
247 `--sysconfdir` during the configuration phase.
249 * `SYSCONFDIR/opensrf.xml` - this file lists the services that this
250 OpenSRF installation supports; if you create a new OpenSRF service,
251 you need to add it to this file.
252 ** The `<hosts>` element at the bottom of the file lists the services
253 that should be started for each hostname. You can force the system
254 to use `localhost`, so in most cases you will leave this section
257 * `SYSCONFDIR/opensrf_core.xml` - this file lists the Jabber connection
258 information that will be used for the system, as well as determining
259 logging verbosity and defining which services will be exposed on the
262 * `~/.srfsh.xml` - this file gives a Linux account the ability to use
263 the `srfsh` interpreter to communicate with OpenSRF services.
265 Updating the OpenSRF configuration files
266 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
267 1. As the *opensrf* Linux account, copy the example configuration files
268 to create your locally customizable OpenSRF configuration files:
270 .Copying the example OpenSRF configuration files
272 ---------------------------------------------------------------------------
274 cp opensrf_core.xml.example opensrf_core.xml
275 cp opensrf.xml.example opensrf.xml
276 ---------------------------------------------------------------------------
278 2. Edit the `SYSCONFDIR/opensrf_core.xml` file to update the four username
279 / password pairs to match the Jabber user accounts you just created:
281 a. `<config><opensrf>` = use the private Jabber `opensrf` user
282 b. `<config><gateway>` = use the public Jabber `opensrf` user
283 c. `<config><routers><router>` = use the public Jabber `router` user
284 d. `<config><routers><router>` = use the private Jabber `router` user
285 3. Create a `.srfsh.xml` file in the home directory of each user
286 that you want to use `srfsh` to communicate with OpenSRF services. For
287 example, to enable the *opensrf* Linux account to use `srfsh`:
288 a. `cp SYSCONFDIR/srfsh.xml.example ~/.srfsh.xml`
289 b. Open `~/.srfsh.xml` in your text editor of choice and update the
290 password to match the password you set for the Jabber `opensrf` user
291 at the `private.localhost` domain.
293 Starting and stopping OpenSRF services
294 --------------------------------------
296 To start all OpenSRF services with a hostname of `localhost`, issue the
297 following command as the *opensrf* Linux account:
300 ---------------------------------------------------------------------------
301 osrf_ctl.sh -l -a start_all
302 ---------------------------------------------------------------------------
304 To stop all OpenSRF services with a hostname of `localhost`, issue the
305 following command as the *opensrf* Linux account:
308 ---------------------------------------------------------------------------
309 osrf_ctl.sh -l -a stop_all
310 ---------------------------------------------------------------------------
312 Testing the default OpenSRF services
313 ------------------------------------
315 By default, OpenSRF ships with an `opensrf.math` service that performs basic
316 calculations involving two integers. Once you have started the OpenSRF
317 services, test the services as follows:
319 1. Start the `srfsh` interactive OpenSRF shell by issuing the following
320 command as the *opensrf* Linux account:
322 .Starting the `srfsh` interactive OpenSRF shell
324 ---------------------------------------------------------------------------
326 ---------------------------------------------------------------------------
328 2. Issue the following request to test the `opensrf.math` service:
330 ---------------------------------------------------------------------------
331 srfsh# request opensrf.math add 2,2
332 ---------------------------------------------------------------------------
334 You should receive the value `4`.
336 Troubleshooting note for Python users
337 -------------------------------------
339 If you are running a Python client and trying to connect to OpenSRF running on
340 localhost rather than a hostname that can be resolved via DNS, you will
341 probably receive exceptions about `dns.resolver.NXDOMAIN`. If this happens,
342 you need to install the `dnsmasq` package, configure it to serve up a DNS
343 entry for localhost, and point your local DNS resolver to `dnsmasq`. For example,
344 on Ubuntu you can issue the following commands as the *root* Linux account:
346 .(Debian / Ubuntu) Installing and starting `dnsmasq`
348 ---------------------------------------------------------------------------
349 aptitude install dnsmasq
350 /etc/init.d/dnsmasq restart
351 ---------------------------------------------------------------------------
353 Then edit `/etc/resolv.conf` and ensure that `nameserver 127.0.0.1` is the
354 first entry in the file.
359 Need help installing or using OpenSRF? Join the mailing lists at
360 http://evergreen-ils.org/listserv.php or contact us on the Freenode
361 IRC network on the #evergreen channel.