3 Installing prerequisites:
4 ========================
6 OpenSRF has a number of prerequisite packages that must be installed
7 before you can successfully configure, compile, and install OpenSRF.
8 On Debian and Ubuntu, the easiest way to install these prerequisites
9 is to use the Makefile.install prerequisite installer for Evergreen.
11 Issue the following commands as the root user to install prerequisites
12 using the Makefile.install prerequisite installer, substituting your
13 operating system identifier for <osname> below:
16 make -f src/extras/Makefile.install <osname>
18 Well-tested values for <osname> include:
19 * "debian-etch" for Debian 4.0
20 * "debian-lenny" for Debian 5.0
21 * "ubuntu-hardy" for Ubuntu 8.04
22 * "ubuntu-karmic" for Ubuntu 9.10
24 Less-tested values for <osname> include:
25 * "centos" for CentOS 5 and Red Hat Enterprise Linux 5
28 Patches and suggestions for improvement from users of these distributions,
29 or others, are welcome!
31 When the prerequisite installer reaches the Perl module stage, you may
32 be prompted for configuration of Comprehensive Perl Archive Network (CPAN)
33 on your mserver. You can just press <return> for all of the prompts, except
34 for the country configuration.
36 Note: If you are installing this using a copy of the source code that was
37 checked out directly from the OpenSRF Subversion repository rather
38 than from a downloaded release of the source code, there are a few
39 additional prerequisite tools and steps that you will need to follow.
40 See "Developer instructions" at the bottom of the file.
42 Configuration and compilation instructions:
43 ==========================================
45 Use the "configure" command to configure OpenSRF, and the "make" command to
46 build OpenSRF. The default installation prefix (PREFIX) for OpenSRF is
49 If you are building OpenSRF for Evergreen, pass the --prefix and --sysconfdir
52 ./configure --prefix=/openils --sysconfdir=/openils/conf
55 By default, OpenSRF includes C, Perl, and JavaScript support.
56 You can add the "--enable-python" option to the configure command
57 to build Python support, and "--enable-java" for Java support.
59 Installation instructions:
60 =========================
62 Once you have configured and compiled OpenSRF, issue the following
63 command as the root user to install OpenSRF:
67 This will install OpenSRF in the prefix directory that you specified in the
68 configuration step. This will also install example configuration files that
69 you can use as templates for your own configuration files.
71 Create and set up the opensrf Unix user environment:
72 ===================================================
74 This user is used to start and stop all OpenSRF processes, and must own all
75 files contained in the PREFIX directory hierarchy. Issue the following
76 commands as root to create the "opensrf" user and set up its environment,
77 substituting <PREFIX> with the value you passed to --prefix in your
80 # useradd -m -s /bin/bash opensrf
81 # echo "export PATH=\$PATH:/<PREFIX>/bin" >> /home/opensrf/.bashrc
84 Define your public and private OpenSRF domains:
85 ==============================================
87 For security purposes, OpenSRF uses Jabber domains to separate services
88 into public and private realms. Throughout these instructions, we will use
89 the example domains "public.localhost" and "private.localhost".
91 On a single-server system, the easiest way to define public and private
92 domains is to define separate hostnames by adding entries to the
93 /etc/hosts file. Here are entries that you could make to a stock /etc/hosts
94 file for our example domains:
96 127.0.1.2 public.localhost public
97 127.0.1.3 private.localhost private
99 Adjust the system dynamic library path:
100 ======================================
102 Add <PREFIX>/lib/ to the system's dynamic library path, and then run "ldconfig"
105 On Debian and Ubuntu systems, run the following commands as root:
107 # echo <PREFIX>/lib > /etc/ld.so.conf.d/opensrf.conf
110 On most other systems, you can add these entries to a /etc/ld.so.conf, or create
111 a file within the /etc/ld.so.conf.d/ directory, and then run "ldconfig" as root.
113 Configure the ejabberd server:
114 =============================
116 OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
117 the Jabber server of choice for the OpenSRF project. In most cases, you only
118 have to make a few changes to the default ejabberd.cfg file to make ejabberd
121 1. Stop ejabberd before making any changes to its configuration by issuing the
122 following command as root:
124 # /etc/init.d/ejabberd stop
126 2. Open /etc/ejabberd/ejabberd.cfg and make the following
129 a. Define your public and private domains in the "hosts" directive. For
132 {hosts, ["private.localhost", "public.localhost"]}
134 b. Comment out the "mod_offline" directive
135 c. Increase the "max_user_sessions" value to 1000
136 d. Change all "max_stanza_size" values to 200000
137 e. Change all "maxrate" values to 500000
139 3. Restart the ejabberd server to make the changes take effect:
141 # /etc/init.d/ejabberd start
143 Create the OpenSRF Jabber users:
144 ===============================
146 On each domain, you need two Jabber users to manage the OpenSRF communications:
148 * a "router" user, to whom all requests to connect to an OpenSRF service
149 will be routed; this Jabber user must be named "router"
150 * an "opensrf" user, which clients use to connect to OpenSRF services; this
151 user can be named anything you like
153 Create the Jabber users by issuing the following commands as root. Substitute
154 <password> for your chosen passwords for each user respectively:
156 # ejabberdctl register router private.localhost <password>
157 # ejabberdctl register opensrf private.localhost <password>
158 # ejabberdctl register router public.localhost <password>
159 # ejabberdctl register opensrf public.localhost <password>
161 Update the OpenSRF configuration files:
162 ======================================
164 There are two critical files that you must update to make OpenSRF work.
165 "SYSCONFDIR" is "/opensrf/etc" by default, or the value that you passed to
166 --sysconfdir during the configuration phase:
168 * SYSCONFDIR/opensrf.xml - this file lists the services that this
169 OpenSRF installation supports; if you create a new OpenSRF service,
170 you need to add it to this file.
171 * The <hosts> element at the bottom of the file lists the services
172 that should be started for each hostname. You can force the system
173 to use "localhost", so in most cases you will leave this section
175 * You must alter the <dbfile> element value for the "opensrf.persist"
176 service to point to a directory to which the opensrf user can write.
177 Note that the override in the <hosts> section takes precedence over
178 the general service definition value.
180 * SYSCONFDIR/opensrf_core.xml - this file lists the Jabber connection
181 information that will be used for the system, as well as determining
182 logging verbosity and defining which services will be exposed on the
183 HTTP gateway. There are four username/password pairs to update in this
185 1. <config><opensrf> = use the private Jabber "opensrf" user
186 2. <config><gateway> = use the public Jabber "opensrf" user
187 3. <config><routers><router> = use the public Jabber "router" user
188 4. <config><routers><router> = use the private Jabber "router" user
190 You should also create a .srfsh.xml file in the home directory of each user
191 that you want to enable to use the srfsh to communicate with OpenSRF services.
193 Copy <SYSCONFDIR>/srfsh.xml.example to ~/.srfsh.xml and update the password
194 to match the one for your Jabber "opensrf" user with the private.localhost
197 Starting and stopping OpenSRF services:
198 ======================================
200 To start all OpenSRF services with a hostname of "localhost", issue the
201 following command as the opensrf user:
203 $ osrf_ctl.sh -l -a start_all
205 To stop all OpenSRF services with a hostname of "localhost", issue the
206 following command as the opensrf user:
208 $ osrf_ctl.sh -l -a stop_all
210 Testing the default OpenSRF services:
211 ====================================
213 By default, OpenSRF ships with an opensrf.math service that performs basic
214 calculations involving two integers. Once you have started the OpenSRF
215 services, start srfsh and issue the following request:
217 srfsh# request opensrf.math add 2,2
219 You should receive the value "4".
221 Troubleshooting note for Python users:
222 =====================================
224 If you are running a Python client and trying to connect to OpenSRF running on
225 localhost rather than a hostname that can be resolved via DNS, you will
226 probably receive exceptions about "dns.resolver.NXDOMAIN". If this happens,
227 you need to install the dnsmasq package, configure it to serve up a DNS
228 entry for localhost, and point your local DNS resolver to dnsmasq. For example,
229 on Ubuntu you can issue the following commands as root:
231 # aptitude install dnsmasq
232 # echo "webserver=/localhost/127.0.0.1/" >> /etc/dnsmasq.conf
233 # /etc/init.d/dnsmasq restart
235 Then edit /etc/resolv.conf and ensure that "nameserver 127.0.0.1" is the first
238 Developer instructions:
239 ======================
241 Developers working directly with the source code from the Subversion
242 repository will also need to install some extra packages and perform
243 one more step before they can proceed with the "./configure" step.
245 Install the following packages:
250 Run the following command in the source directory to generate the configure
251 script and Makefiles:
258 Need help installing or using OpenSRF? Join the mailing lists at
259 http://evergreen-ils.org/listserv.php or contact us on the Freenode
260 IRC network on the #evergreen channel.