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-gutsy" for Ubuntu 7.10
22 * "ubuntu-hardy" for Ubuntu 8.04
23 * "ubuntu-intrepid" for Ubuntu 8.10
25 Less-tested values for <osname> include:
26 * "centos" for CentOS 5 and Red Hat Enterprise Linux 5
29 Patches and suggestions for improvement from users of these distributions,
30 or others, are welcome!
32 When the prerequisite installer reaches the Perl module stage, you may
33 be prompted for configuration of Comprehensive Perl Archive Network (CPAN)
34 on your mserver. You can just press <return> for all of the prompts, except
35 for the country configuration.
37 Note: If you are installing this using a copy of the source code that was
38 checked out directly from the OpenSRF Subversion repository rather
39 than from a downloaded release of the source code, there are a few
40 additional prerequisite tools and steps that you will need to follow.
41 See "Developer instructions" at the bottom of the file.
43 Configuration and compilation instructions:
44 ==========================================
46 Use the "configure" command to configure OpenSRF, and the "make" command to
47 build OpenSRF. The default installation prefix (PREFIX) for OpenSRF is
50 If you are building OpenSRF for Evergreen, pass the --prefix and --sysconfdir
53 ./configure --prefix=/openils --sysconfdir=/openils/conf
56 By default, OpenSRF includes C, Perl, and JavaScript support.
57 You can add the "--enable-python" option to the configure command
58 to build Python support, and "--enable-java" for Java support.
60 Installation instructions:
61 =========================
63 Once you have configured and compiled OpenSRF, issue the following
64 command as the root user to install OpenSRF:
68 This will install OpenSRF in the prefix directory that you specified in the
69 configuration step. This will also install example configuration files that
70 you can use as templates for your own configuration files.
72 Create and set up the opensrf Unix user environment:
73 ===================================================
75 This user is used to start and stop all OpenSRF processes, and must own all
76 files contained in the PREFIX directory hierarchy. Issue the following
77 commands as root to create the "opensrf" user and set up its environment,
78 substituting <PREFIX> with the value you passed to --prefix in your
81 # useradd -m -s /bin/bash opensrf
82 # echo "export PATH=\$PATH:/<PREFIX>/bin" >> /home/opensrf/.bashrc
85 Define your public and private OpenSRF domains:
86 ==============================================
88 For security purposes, OpenSRF uses Jabber domains to separate services
89 into public and private realms. Throughout these instructions, we will use
90 the example domains "public.localhost" and "private.localhost".
92 On a single-server system, the easiest way to define public and private
93 domains is to define separate hostnames by adding entries to the
94 /etc/hosts file. Here are entries that you could make to a stock /etc/hosts
95 file for our example domains:
97 127.0.1.2 public.localhost public
98 127.0.1.3 private.localhost private
100 Adjust the system dynamic library path:
101 ======================================
103 Add <PREFIX>/lib/ to the system's dynamic library path, and then run "ldconfig"
106 On Debian and Ubuntu systems, run the following commands as root:
108 # echo <PREFIX>/lib > /etc/ld.so.conf.d/opensrf.conf
111 On most other systems, you can add these entries to a /etc/ld.so.conf, or create
112 a file within the /etc/ld.so.conf.d/ directory, and then run "ldconfig" as root.
114 Configure the ejabberd server:
115 =============================
117 OpenSRF requires an XMPP (Jabber) server. For performance reasons, ejabberd is
118 the Jabber server of choice for the OpenSRF project. In most cases, you only
119 have to make a few changes to the default ejabberd.cfg file to make ejabberd
122 1. Stop ejabberd before making any changes to its configuration by issuing the
123 following command as root:
125 # /etc/init.d/ejabberd stop
127 2. Open /etc/ejabberd/ejabberd.cfg and make the following
130 a. Define your public and private domains in the "hosts" directive. For
133 {hosts, ["private.localhost", "public.localhost"]}
135 b. Comment out the "mod_offline" directive
136 c. Increase the "max_user_sessions" value to 1000
137 d. Change all "max_stanza_size" values to 200000
138 e. Change all "maxrate" values to 500000
140 3. Restart the ejabberd server to make the changes take effect:
142 # /etc/init.d/ejabberd start
144 Create the OpenSRF Jabber users:
145 ===============================
147 On each domain, you need two Jabber users to manage the OpenSRF communications:
149 * a "router" user, to whom all requests to connect to an OpenSRF service
150 will be routed; this Jabber user must be named "router"
151 * an "opensrf" user, which clients use to connect to OpenSRF services; this
152 user can be named anything you like
154 Create the Jabber users by issuing the following commands as root. Substitute
155 <password> for your chosen passwords for each user respectively:
157 # ejabberdctl register router private.localhost <password>
158 # ejabberdctl register opensrf private.localhost <password>
159 # ejabberdctl register router public.localhost <password>
160 # ejabberdctl register opensrf public.localhost <password>
162 Update the OpenSRF configuration files:
163 ======================================
165 There are two critical files that you must update to make OpenSRF work.
166 "SYSCONFDIR" is "/opensrf/etc" by default, or the value that you passed to
167 --sysconfdir during the configuration phase:
169 * SYSCONFDIR/opensrf.xml - this file lists the services that this
170 OpenSRF installation supports; if you create a new OpenSRF service,
171 you need to add it to this file.
172 * The <hosts> element at the bottom of the file lists the services
173 that should be started for each hostname. You can force the system
174 to use "localhost", so in most cases you will leave this section
176 * You must alter the <dbfile> element value for the "opensrf.persist"
177 service to point to a directory to which the opensrf user can write.
178 Note that the override in the <hosts> section takes precedence over
179 the general service definition value.
181 * SYSCONFDIR/opensrf_core.xml - this file lists the Jabber connection
182 information that will be used for the system, as well as determining
183 logging verbosity and defining which services will be exposed on the
184 HTTP gateway. There are four username/password pairs to update in this
186 1. <config><opensrf> = use the private Jabber "opensrf" user
187 2. <config><gateway> = use the public Jabber "opensrf" user
188 3. <config><routers><router> = use the public Jabber "router" user
189 4. <config><routers><router> = use the private Jabber "router" user
191 You should also create a .srfsh.xml file in the home directory of each user
192 that you want to enable to use the srfsh to communicate with OpenSRF services.
194 Copy <SYSCONFDIR>/srfsh.xml.example to ~/.srfsh.xml and update the password
195 to match the one for your Jabber "opensrf" user with the private.localhost
198 Starting and stopping OpenSRF services:
199 ======================================
201 To start all OpenSRF services with a hostname of "localhost", issue the
202 following command as the opensrf user:
204 $ osrf_ctl.sh -l -a start_all
206 To stop all OpenSRF services with a hostname of "localhost", issue the
207 following command as the opensrf user:
209 $ osrf_ctl.sh -l -a stop_all
211 Testing the default OpenSRF services:
212 ====================================
214 By default, OpenSRF ships with an opensrf.math service that performs basic
215 calculations involving two integers. Once you have started the OpenSRF
216 services, start srfsh and issue the following request:
218 srfsh# request opensrf.math add 2,2
220 You should receive the value "4".
222 Troubleshooting note for Python users:
223 =====================================
225 If you are running a Python client and trying to connect to OpenSRF running on
226 localhost rather than a hostname that can be resolved via DNS, you will
227 probably receive exceptions about "dns.resolver.NXDOMAIN". If this happens,
228 you need to install the dnsmasq package, configure it to serve up a DNS
229 entry for localhost, and point your local DNS resolver to dnsmasq. For example,
230 on Ubuntu you can issue the following commands as root:
232 # aptitude install dnsmasq
233 # echo "webserver=/localhost/127.0.0.1/" >> /etc/dnsmasq.conf
234 # /etc/init.d/dnsmasq restart
236 Then edit /etc/resolv.conf and ensure that "nameserver 127.0.0.1" is the first
239 Developer instructions:
240 ======================
242 Developers working directly with the source code from the Subversion
243 repository will also need to install some extra packages and perform
244 one more step before they can proceed with the "./configure" step.
246 Install the following packages:
251 Run the following command in the source directory to generate the configure
252 script and Makefiles:
259 Need help installing or using OpenSRF? Join the mailing lists at
260 http://evergreen-ils.org/listserv.php or contact us on the Freenode
261 IRC network on the #evergreen channel.