modify section "Install Staff Client", "Automatic Updates", and "Other Tips";
[working/Evergreen.git] / 1.6 / admin / ServersideInstallation.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <chapter xml:id="ServersideInstallation" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xl="http://www.w3.org/1999/xlink">
3         <info>
4                 <title>Server-side Installation of Evergreen Software</title>
5                 <abstract>
6                         <para>This section describes installation of the Evergreen server-side software and its associated components. Installation, configuration, testing and verification of the software is straightforward if you follow some simple directions.</para>
7                 </abstract>
8         </info>
9         <section xml:id="serversideinstallation-overview">
10                 <title>Overview</title>
11                 <para>Installing, configuring and testing the Evergreen server-side software is straightforward with the current stable software release. See the section <link linkend="serversideinstallation-all">"Installation of Server-Side Software"</link> for instructions tailored to installing on some particular distributions of the Linux operating system. Earlier software distributions are described in the section <link linkend="serversideinstallation-previousversions">"Installing Previous Versions of Evergreen"</link>.</para>
12                 <para>The current version of the Evergreen server-side software runs as a native application on any of several well-known Linux distributions (e.g., <emphasis>Ubuntu</emphasis> and <emphasis>Debian</emphasis>). It does not currently run as a native application on the Windows operating system (e.g., WindowsXP, WindowsXP Professional, Windows7), but the software can still be installed and run on Windows via a so-called <emphasis>virtualized</emphasis> Unix-guest Operating System (using, for example, VirtualBox, or VMware, or VirtualPC to emulate a Linux environment). It can also be installed to run on other Linux systems via virtualized environments (using, for example, VirtualBox or VMware). More information on virtualized environments can be found in the section <link linkend="serversideinstallation-virtual">"Installing Evergreen in Virtualized Unix Environments"</link>.</para>
13                 <para>Installation of some sub-components of the Evergreen server-side software is mentioned only in abbreviated form in this section. More detailed information is available in the accompanying sections:
14 <link linkend="serversideinstallation-postgresql">"Installing PostgreSQL"</link>, 
15 <link linkend="serversideinstallation-apache">"Apache"</link> and
16 <link linkend="serversideinstallation-memcached">"memcached Servers"</link>.
17 </para>
18                 <para>Finally, installation of the Evergreen Staff Client software is reviewed in the section <link linkend="serversideinstallation-staffclient">"Installing the Evergreen Staff Client"</link>. </para>
19                 <section>
20                         <title>Evergreen Software Dependencies</title>
21                         <para>The Evergreen server-side software has dependencies on particular versions of certain major software sub-components. Successful installation of Evergreen software requires that software versions agree with those listed here:</para>
22                         <table>
23                                 <title>Evergreen Software Dependencies</title>
24                                 <tgroup align="left" cols="3" colsep="1" rowsep="1">
25                                         <thead>
26                                                 <row>
27                                                         <entry>Evergreen</entry>
28                                                         <entry>OpenSRF</entry>
29                                                         <entry>PostgreSQL</entry>
30                                                 </row>
31                                         </thead>
32                                         <tbody>
33                                                 <row>
34                                                         <entry>1.6.x</entry>
35                                                         <entry>1.2</entry>
36                                                         <entry>8.2 / 8.3</entry>
37                                                 </row>
38                                                 <row>
39                                                         <entry>1.4.x</entry>
40                                                         <entry>1.0</entry>
41                                                         <entry>8.1 / 8.2</entry>
42                                                 </row>
43                                                 <row>
44                                                         <entry>1.2.x</entry>
45                                                         <entry>0.9</entry>
46                                                         <entry>8.1 / 8.2</entry>
47                                                 </row>
48                                         </tbody>
49                                 </tgroup>
50                         </table>
51                         <caution fileref="media/caution.png">VERIFY THE DEPENDENCIES IN THIS TABLE </caution>
52                 </section>
53                 <section>
54                         <title>Current Stable Software Release</title>
55                         <para>The current stable release of Evergreen is version <emphasis><emphasis role="bold">1.6.0.7</emphasis></emphasis>. Instructions for installing, configuring and testing that version on the <emphasis>Ubuntu</emphasis> or <emphasis>Debian</emphasis> Linux systems are found in the section <link linkend="serversideinstallation-ubuntudebian">"Installing Evergreen on Ubuntu or Debian"</link> .
56                         </para>
57                         <para>This release of Evergreen software is dependent on the Open Service Request Framework (OpenSRF). The current stable release of OpenSRF is version <emphasis><emphasis role="bold">1.2.2</emphasis></emphasis>. Instructions for installing, configuring and testing that version are found in the section <link linkend="serversideinstallation-opensrf">"Installing OpenSRF On Ubuntu or Debian"</link> .</para>
58                 </section>
59                 <section>
60                         <title>Previous Software Releases</title>
61                         <para>Earlier releases of Evergreen are also available. Instructions for installing, configuring and testing earlier versions are found in the section <link linkend="serversideinstallation-previousversions">"Installing Previous Versions of Evergreen"</link> .</para>
62                         <para>The next most recent previous release of Evergreen is version <emphasis><emphasis role="bold">1.4.0.6</emphasis></emphasis>. Instructions for installing, configuring and testing that version are found in the section <link linkend="serversideinstallation-ubuntudebian-previous">"Installing Evergreen 1.4.0.6 on Ubuntu or Debian"</link> .</para>
63                         <para>The accompanying previous release of OpenSRF is version <emphasis><emphasis role="bold">1.0.x</emphasis></emphasis>. Instructions for installing, configuring and testing that version are found in the section <link linkend="serversideinstallation-opensrf-previous">"Installing OpenSRF 1.0.x"</link> .</para>
64                 </section>
65                 <section>
66                         <title>System Hardware Requirements</title>
67                         <para>This section describes various requirements of the hardware and software environment that must be fulfilled to support a successful Evergreen installation. The system requirements for running Evergreen really depend on what you want to do with it. For just evaluating the software, or for a very small library (for example, 1 circulation station, a few thousand items, and infrequent online catalog use), any modern desktop or laptop made within the last few years capable of running Linux, FreeBSD, etc. should suffice. We recommend at least 512mb of RAM.</para>
68                         <caution fileref="media/caution.png"> ADD FURTHER CONTENT ON HARDWARE AND SOFTWARE REQUIREMENTS </caution>
69                         <figure>
70                                 <title>Conversation on mailing-list about system requirements</title>
71                                 <screen>
72                                 >>>From Dan Scott on [http://list.georgialibraries.org/pipermail/
73                                   open-ils-general/2007-July/000316.html|OPEN-ILS-GENERAL]:
74                                 On 8/11/07, lan ye &lt;lye at mail.slcl.org> wrote:
75                                 > We've been researching the Evergreen Open Source Library system, and would
76                                 > like to have a list of hardware requirements for the installation of a small
77                                 > test server. To keep things within a small budget, I would like to just use
78                                 > an ordinary PC. Could you send some information to us?
79
80                                 For system requirements, it depends on how extensive you want your tests to
81                                 be. Evergreen and all of the pieces it depends on (PostgreSQL, Apache, Ejabberd) run
82                                 happily in a VMWare image allocated 512MB of RAM on my laptop with just the Project
83                                 Gutenberg e-books loaded, and that's enough to evaluate the OPAC interface / try out the
84                                 staff client / make some local changes and generally experiment. But I'm not going to
85                                 load one million bib records into that system and expect it to perform. So, probably any
86                                 hardware you have lying around would be adequate for a small test server.
87
88                                 > It looks like Evergreen has been successfully installed on two Linux
89                                 > systems: Gentoo and Ubuntu. Which one is the best for us to test using
90                                 > what's already in place at other libraries? Are there any differences /
91                                 > Advantages in functionality between Gentoo and Ubuntu?
92
93                                 As John said, GPLS is running on Debian, and that's the only Evergreen system that is in
94                                 production at the moment. However, the documentation for installing on Debian is a bit
95                                 scattered right now. The developers themselves used Gentoo originally, and that's what
96                                 I'm using at the moment &amp; have documented in the wiki; the install process on Ubuntu
97                                 is very thoroughly documented and Ubuntu is reasonably close to Debian.  See
98                                 http://open-ils.org/dokuwiki/doku.php?id=server_installation for the list of install
99                                 instructions for various distributions.
100         
101                                 As for advantages / disadvantages of particular distributions, that's a religious war
102                                 that I don't want to step into... We'll try to help you out no matter what distribution
103                                 you choose; just please choose a current release :)
104
105                                 --
106                                 Dan Scott
107                                 Laurentian University
108
109                                 >>>And from James Fournie in that same [http://list.georgialibraries.org/
110                                   pipermail/open-ils-general/2007-July/000317.html|thread]:
111
112                                 We are running a test Ubuntu server on a ~1ghz Celeron PC with 512mb RAM.  It seems to
113                                 be ok handling the Gutenberg samples, and our collection of about 8000 records. We did
114                                 have serious problems using anything less than 512mb RAM. Also, I tried Evergreen on a
115                                 K6 II 350, but it wasn't pretty.
116
117                                 James Fournie
118                                 Digitization Librarian
119                                 Union of B.C. Indian Chiefs
120                                 </screen>
121                         </figure>
122                 </section>
123                 <section>
124                         <title>System Architectures</title>
125                         <para>This sections describes examples of some working Evergreen system architectures, including both server-side software and Staff Client software.</para>
126                         <para>A bare-minimum system requires only a single Evergreen Server and a single Evergreen Staff Client, both residing on a single server machine. In fact, that is a reasonable architecture for simple experiments or as a proof of concept in a conference-room pilot. But typical real-world systems will probably consist of at least one or two Evergreen Servers plus multiple Staff Clients.</para>
127                         <para>Another simple system may require only that you install one or more instances of the Staff Client software. For instance, if your consortium already provides the Evergreen server software or if you are using the hosted version provided by Equinox, you do not need to install the Evergreen server-side software at all; you need only the Staff Client.</para>
128                         <section xml:id="serversideinstallation-example-pines">
129                                 <title>PINES</title>
130                                 <para>In order to provide load balancing and high-availability at the OPAC and Staff Client level, PINES has implemented a Linux Virtual Server environment with five independent mini-clusters. This allows live updates of the entire system with no perceived downtime or interruption in service.</para>
131                                 <caution fileref="media/caution.png"> ADD FURTHER INFORMATION ON PINES </caution>
132                         </section>
133                         <section xml:id="serversideinstallation-example-sitka">
134                                 <title>Sitka</title>
135                                 <caution fileref="media/caution.png"> ADD FURTHER INFORMATION ON SITKA </caution>
136                         </section>
137                         <section xml:id="serversideinstallation-example-other">
138                                 <title>Other Working Systems</title>
139                                 <caution fileref="media/caution.png"> ADD FURTHER INFORMATION ON OTHER WORKING SYSTEMS </caution>
140                         </section>
141                 </section>
142         </section>
143         <section xml:id="serversideinstallation-all">
144                 <title>Installation of Server-Side Software</title>
145                 <para>This section describes the installation of the major components of Evergreen server-side software.</para>
146                 <para>As far as possible, you should perform the following steps in the exact order given since the success of many steps relies on the successful completion of earlier steps. You should make backup copies of files and environments when you are instructed to do so. In the event of installation problems those copies can allow you to back out of a step gracefully and resume the installation from a known state. See the section on <link linkend="adminmisc-backingup">"Backing Up"</link>  for further information.</para>
147                 <para>Of course, after you successfully complete and test the entire Evergreen installation you should take a final snapshot backup of your system(s). This can be the first in the series of regularly scheduled system backups that you should probably also begin.</para>
148                 <section xml:id="serversideinstallation-opensrf">
149                         <title>Installing OpenSRF On Ubuntu or Debian</title>
150                         <para>This section describes the installation of the latest version of the Open Service Request Framework (OpenSRF), a major component of the Evergreen server-side software, on Ubuntu or Debian systems. Evergreen software is integrated with and depends on the OpenSRF software system.</para>
151                         <para>Follow the steps outlined here and run the specified tests to ensure that OpenSRF is properly installed and configured. Do not continue with any further Evergreen installation steps until you have verified that OpenSRF has been successfully installed.</para>
152                         <note>
153                                 <para>The following steps have been tested on the x86 (32-bit) and x86-64 (64-bit) platforms. OpenSRF 1.2.0 has been tested on Debian Etch (4.0), Debian Lenny, Ubuntu Hardy Heron (8.04), and Ubuntu Intrepid Ibex (8.10).</para>
154                                 <para>In the following instructions, you are asked to perform certain steps as either the <emphasis role="bold">root</emphasis> user, the <emphasis role="bold">opensrf</emphasis> user, or the <emphasis role="bold">postgres</emphasis> user.</para>
155                                 <itemizedlist>
156                                         <listitem><emphasis role="bold">Debian</emphasis> -- To become the <emphasis>root</emphasis> user, issue the command <emphasis role="bold">"su -"</emphasis> and enter the password of the root user.</listitem>
157                                         <listitem><emphasis role="bold">Ubuntu</emphasis> -- To become the <emphasis>root</emphasis> user, issue the command <emphasis role="bold">"sudo su -"</emphasis> and enter the password of your current user.</listitem>
158                                 </itemizedlist>
159                                 <para>To switch from the <emphasis role="bold">root</emphasis> user to a different user, issue the command <emphasis role="bold">"su - USERNAME"</emphasis>. For example, to switch from the <emphasis role="bold">root</emphasis> user to the <emphasis role="bold">opensrf</emphasis> user, issue the command <emphasis role="bold">"su - opensrf"</emphasis>. Once you have become a non-root user, to become the <emphasis role="bold">root</emphasis> user again, simply issue the command <emphasis role="bold">"exit"</emphasis>.</para>
160                         </note>
161                         <section>
162                                 <title>Add the OpenSRF User</title>
163                                 <para>As the <emphasis role="bold">root</emphasis> user, add the opensrf user to the system. The default shell for the new user is automatically set to <emphasis role="bold">/bin/bash</emphasis> to inherit a reasonable environment:</para>
164                                 <figure>
165                                         <title>Commands to add "opensrf" user</title>
166                                         <screen>
167                                         $ su - opensrf
168                                         $ useradd -m -s /bin/bash opensrf
169                                         $ passwd opensrf
170                                         Enter new UNIX password: ******
171                                         Retype new UNIX password: ******
172                                         passwd: password updated successfully
173                                         $
174                                         </screen>
175                                 </figure>
176                         </section>
177                         <section>
178                                 <title>Download and Unpack Latest OpenSRF Version</title>
179                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, download and extract the latest version of OpenSRF. The latest version can be found here: <emphasis><emphasis role="bold"><ulink url="http://evergreen-ils.org/downloads/OpenSRF-1.2.2.tar.gz"></ulink></emphasis></emphasis></para>
180                                 <figure>
181                                         <title>Commands to download and unpack OpenSRF</title>
182                                         <screen>
183                                         $ su - opensrf
184                                         $ wget http://evergreen-ils.org/downloads/OpenSRF-1.2.2.tar.gz
185                                         $ tar zxf OpenSRF-1.2.2.tar.gz
186                                         </screen>
187                                 </figure>
188                                 <para>The new directory <emphasis>/home/opensrf/OpenSRF-1.2.2</emphasis> will be created.</para>
189                         </section>
190                         <section>
191                                 <title>Install Prerequisites to Build OpenSRF</title>
192                                 <para>In this section you will install and configure a set of prerequisites that will be used to build OpenSRF. In a following step you will actually build the software using the <emphasis>make</emphasis> utility.</para>
193                                 <para>As the <emphasis role="bold">root</emphasis> user, enter the commands show below to build the prerequisites from the software distribution that you just downloaded and unpacked. Remember to replace <emphasis>[distribution]</emphasis> in the example with the keyword corresponding to the actual Linux distribution listed in the <link linkend="serversideinstallation-keywords-figure-1">"Keywords"</link> figure below.</para>
194                                 <figure>
195                                         <title>Commands to install prerequisites for OpenSRF</title>
196                                         <screen>
197                                         $ su - root
198                                         $ cd /home/opensrf/OpenSRF-1.2.2
199                                         $ make -f src/extras/Makefile.install [distribution]
200                                         ...
201                                         </screen>
202                                 </figure>
203                                 <table xml:id="serversideinstallation-keywords-figure-1">
204                                         <title>Keywords Targets for "make"</title>
205                                         <tgroup align="left" cols="2" colsep="1" rowsep="1">
206                                                 <colspec colnum="1" colwidth="1*"/>
207                                                 <colspec colnum="2" colwidth="3*"/>
208                                                 <thead>
209                                                         <row>
210                                                                 <entry>Keyword</entry>
211                                                                 <entry>Description</entry>
212                                                         </row>
213                                                 </thead>
214                                                 <tbody>
215                                                         <row>
216                                                                 <entry>debian-lenny</entry>
217                                                                 <entry>for Debian Lenny (5.0)</entry>
218                                                         </row>
219                                                         <row>
220                                                                 <entry>debian-etch</entry>
221                                                                 <entry>for Debian Etch (4.0)</entry>
222                                                         </row>
223                                                         <row>
224                                                                 <entry>ubuntu-karmic</entry>
225                                                                 <entry>for Ubuntu Karmic (9.10)</entry>
226                                                         </row>
227                                                         <row>
228                                                                 <entry>ubuntu-intrepid</entry>
229                                                                 <entry>for Ubuntu Jaunty (9.04) or Intrepid (8.10)</entry>
230                                                         </row>
231                                                         <row>
232                                                                 <entry>ubuntu-hardy</entry>
233                                                                 <entry>for Ubuntu Hardy (8.04)</entry>
234                                                         </row>
235                                                 </tbody>
236                                         </tgroup>
237                                 </table>
238                                 <caution fileref="media/caution.png"> ADD INFO FOR OTHER LINUX DISTRIBUTIONS </caution>
239                                 <para>This will install a number of packages on the system that are required by OpenSRF, 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".</para>
240                         </section>
241                         <section>
242                                 <title>Configure OpenSRF</title>
243                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, return to the OpenSRF build directory and use the utility "configure" to prepare for the next step of compiling and linking the software. You can include the <emphasis>--enable-python</emphasis> and <emphasis>--enable-java</emphasis> configuration options if you wish to include support for Python and Java, respectively:</para>
244                                 <figure>
245                                         <title>Commands to configure OpenSRF</title>
246                                         <screen>
247                                         $ su - opensrf
248                                         $ cd /home/opensrf/OpenSRF-1.2.2
249                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf
250                                         $ make
251                                         ...
252                                         </screen>
253                                 </figure>
254                         </section>
255                         <section>
256                                 <title>Compile, Link and Install OpenSRF</title>
257                                 <para>As the <emphasis role="bold">root</emphasis> user, return to the OpenSRF build directory and use the <emphasis>make</emphasis> command to compile, link and install OpenSRF:</para>
258                                 <figure>
259                                         <title>Commands to build, link and install OpenSRF</title>
260                                         <screen>
261                                         $ su - opensrf
262                                         $ cd /home/opensrf/OpenSRF-1.2.2
263                                         $ make install
264                                         ...
265                                         </screen>
266                                 </figure>
267                         </section>
268                         <section>
269                                 <title>Update the System Dynamic Library Path</title>
270                                 <para>As the <emphasis role="bold">root</emphasis> user, you must update the system dynamic library path to make your system recognize the newly installed libraries. Do this by creating a new file named <emphasis role="bold">/etc/ld.so.conf.d/osrf.conf</emphasis> containing a new library path, then run the command <emphasis role="bold">ldconfig</emphasis> to automatically read the file and modify the system dynamic library path:</para>
271                                 <figure>
272                                         <title>Commands to modify system dynamic library path</title>
273                                         <screen>
274                                         $ su - root
275                                         $ echo "/openils/lib" > /etc/ld.so.conf.d/osrf.conf
276                                         $ ldconfig
277                                         </screen>
278                                 </figure>
279                         </section>
280                         <section>
281                                 <title>Define Public and Private OpenSRF Domains</title>
282                                 <para>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 <emphasis>public.localhost</emphasis> for the public domain and <emphasis>private.localhost</emphasis> 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 file <emphasis>/etc/hosts</emphasis>.</para>
283                                 <para>As the <emphasis role="bold">root</emphasis> user, edit the file <emphasis>/etc/hosts</emphasis> and add the following entries for our example domains:</para>
284                                 <figure>
285                                         <title>Example public and private domains in /etc/hosts</title>
286                                         <screen>
287                                         127.0.1.2       public.localhost        public
288                                         127.0.1.3       private.localhost       private
289                                         </screen>
290                                 </figure>
291                         </section>
292                         <section>
293                                 <title>Change File Ownerships</title>
294                                 <para>As the <emphasis role="bold">root</emphasis> user, change the ownership of files installed in the directory <emphasis>/openils</emphasis> to the user "opensrf":</para>
295                                 <figure>
296                                         <title>Commands to change file ownerships</title>
297                                         <screen>
298                                         $ chown -R opensrf:opensrf /openils
299                                         </screen>
300                                 </figure>
301                         </section>
302                         <section>
303                                 <title>Stop the "ejabberd" Service</title>
304                                 <para>As the <emphasis role="bold">root</emphasis> user, stop the "ejabberd" service:</para>
305                                 <figure>
306                                         <title>Commands to stop the "ejabberd" service</title>
307                                         <screen>
308                                         $ /etc/init.d/ejabberd stop
309                                         </screen>
310                                 </figure>
311                                 <para>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 <emphasis>beam</emphasis> and <emphasis>epmd</emphasis> processes, then edit the <emphasis>ejabberd</emphasis> configuration file to hardcode a domain:</para>
312                                 <figure>
313                                         <title>Commands to recover from "ejabberd" error</title>
314                                         <screen>
315                                         $ su - root
316                                         $ epmd -kill
317                                         $ killall beam; killall beam.smp
318                                         $ rm /var/lib/ejabberd/*
319                                         $ echo 'ERLANG_NODE=ejabberd@localhost' >> /etc/default/ejabberd
320                                         </screen>
321                                 </figure>
322                         </section>
323                         <section>
324                                 <title>Edit the "ejabberd" configuration</title>
325                                 <para>As the <emphasis role="bold">root</emphasis> user, edit the file <emphasis>/etc/ejabberd/ejabberd.cfg</emphasis> and make the following changes:</para>
326                                 <itemizedlist>
327                                         <listitem>Change <emphasis role="bold">{hosts, ["localhost"]}.</emphasis> to <emphasis role="bold">{hosts, ["localhost", "private.localhost", "public.localhost"]}.</emphasis></listitem>
328                                         <listitem>Change <emphasis role="bold">{max_user_sessions, 10}.</emphasis> to <emphasis role="bold">{max_user_sessions, 10000}.</emphasis> If you see something like this instead: <emphasis role="bold">{access, max_user_sessions, [{10, all}]}.</emphasis>, then change it to <emphasis role="bold">{access, max_user_sessions, [{10000, all}]}.</emphasis></listitem>
329                                         <listitem>Change all three occurrences of <emphasis role="bold">max_stanza_size</emphasis> to <emphasis role="bold">2000000</emphasis>.</listitem>
330                                         <listitem>Change both occurrences of <emphasis role="bold">maxrate</emphasis> to <emphasis role="bold">500000</emphasis>.       </listitem>
331                                         <listitem>Comment out the line <emphasis role="bold">{mod_offline, []}</emphasis> by placing two <emphasis role="bold">%</emphasis> comment signs in front.</listitem>
332                                 </itemizedlist>
333                         </section>
334                         <section>
335                                 <title>Restart the "ejabberd" service</title>
336                                 <para>As the <emphasis role="bold">root</emphasis> user, restart the <emphasis>ejabberd</emphasis> service to test the configuration changes and to register your users:</para>
337                                 <figure>
338                                         <title>Commands to restart the "ejabberd" service</title>
339                                         <screen>
340                                         $ /etc/init.d/ejabberd start
341                                         </screen>
342                                 </figure>
343                         </section>
344                         <section>
345                                 <title>Register "router" and "ejabberd" users</title>
346                                 <para>On each domain, you need two "ejabberd" users to manage the OpenSRF communications:</para>
347                                 <itemizedlist>
348                                         <listitem>a "router" user, to whom all requests to connect to an OpenSRF service will be routed; this "ejabberd" user must be named "router"</listitem>
349                                         <listitem>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</listitem>
350                                 </itemizedlist>
351                                 <para>As the <emphasis role="bold">root</emphasis> user, use the utility "ejabberdctl" to register your ejabber users <emphasis>router</emphasis> and <emphasis>opensrf</emphasis> for the OpenSRF router service on each domain. The users should have different passwords on each domain. These users will correspond to those configured in the file <emphasis>/openils/conf/opensrf_core.xml</emphasis>:</para>
352                                 <figure>
353                                         <title>Commands to registe "router" and "ejabberd" users</title>
354                                         <screen>
355                                         # Syntax for registering a user with ejabberdctl:
356                                         #    ejabberdctl register &lt;user> &lt;domain> &lt;password>
357                                         #
358                                         $ ejabberdctl register router private.localhost &lt;password>
359                                         $ ejabberdctl register opensrf private.localhost &lt;password>
360                                         $ ejabberdctl register router public.localhost &lt;password>
361                                         $ ejabberdctl register opensrf public.localhost &lt;password>
362                                         </screen>
363                                 </figure>
364                         </section>
365                         <section>
366                                 <title>Create configuration files</title>
367                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, use the example templates to create the configuration files <emphasis>/openils/conf/opensrf_core.xml</emphasis> and <emphasis>/openils/conf/opensrf.xml</emphasis>:</para>
368                                 <figure>
369                                         <title>Commands to create configuration files</title>
370                                         <screen>
371                                         $ su - root
372                                         $ cd /openils/conf
373                                         $ cp opensrf.xml.example      opensrf.xml
374                                         $ cp opensrf_core.xml.example opensrf_core.xml
375                                         </screen>
376                                 </figure>
377                         </section>
378                         <section>
379                                 <title>Edit opensrf_core.xml</title>
380                                 <para>Edit the file <emphasis>/openils/conf/opensrf_core.xml</emphasis> to change the "ejabberd" usernames and passwords as follows.</para>
381                                 <note>
382                                         <para>
383                                                 <emphasis>The following example uses common XPath syntax on the left-hand side to indicate the aproximage position needing changes within the XML file.</emphasis>
384                                         </para>
385                                 </note>
386                                 <figure>
387                                         <title>Updates needed in the file "/openils/conf/opensrf_core.xml"</title>
388                                         <screen>
389                                         /config/opensrf/username = opensrf
390
391                                         /config/opensrf/passwd = password for "private.localhost" opensrf user
392
393                                         /config/gateway/username = opensrf
394
395                                         /config/gateway/passwd = password for "public.localhost" opensrf user
396
397                                         # first entry, where "transport/server" == "public.localhost" :
398                                         /config/routers/router/transport 
399                                             username = router
400                                             password = password for "public.localhost" router user
401
402                                         # second entry, where "transport/server" == "private.localhost" :
403                                         /config/routers/router/transport
404                                             username = router
405                                             password = password for "private.localhost" router user
406                                         </screen>
407                                 </figure>
408                                 <para>You also need to specify the domains from which OpenSRF will accept and to which OpenSRF will 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.</para>
409                         </section>
410                         <section>
411                                 <title>Modify the file "opensrf.xml"</title>
412                                 <para>Modify the file <emphasis>/openils/conf/opensrf.xml</emphasis>.</para>
413                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, edit the file to set the location of the persistent database in the <emphasis role="bold">&lt;dbfile></emphasis> element near the end of the file:</para>
414                                 <figure>
415                                         <title>Example of the file "opensrf.xml"</title>
416                                         <screen>
417                                         &lt;!-- Example of an app-specific setting override -->
418                                         &lt;opensrf.persist>
419                                           &lt;app_settings>
420                                             &lt;dbfile>/tmp/persist.db&lt;/dbfile>
421                                           &lt;/app_settings>
422                                         &lt;/opensrf.persist>
423                                         </screen>
424                                 </figure>
425                         </section>
426                         <section>
427                                 <title>Create Configuration Files for Users Needing srfsh</title>
428                                 <para>In this section you will set up a special configuration file for each user who will need to run the <emphasis>srfsh</emphasis> (surf shell) utility.</para>
429                                 <para>The software installation will automatically create <emphasis>srfsh</emphasis>. This is a command line diagnostic tool for testing and interacting with the OpenSRF network software. It will be used in a future step to complete and test the Evergreen installation. See the section <link linkend="serversideinstallation-testing">"Testing the Installation"</link> for further information.</para>
430                                 <para>As the <emphasis role="bold">root</emphasis> user, copy the short sample configuration file <emphasis>/openils/conf/srfsh.xml.example</emphasis> to the file <emphasis>.srfsh.xml</emphasis> (note the leading dot!) in the home directory of each user who will use <emphasis role="bold">srfsh</emphasis>. Finally, edit each file <emphasis>.srfsh.xml</emphasis> and make the following changes. When you finish, remember to change the owner of the file to match the owner of the home directory.</para>
431                                 <itemizedlist>
432                                         <listitem>Modify <emphasis role="bold">domain</emphasis> to be the router hostname (following our domain examples, <emphasis role="bold">private.localhost</emphasis> will give <emphasis>srfsh</emphasis> access to all OpenSRF services, while <emphasis role="bold">public.localhost</emphasis> will only allow access to those OpenSRF services that are publicly exposed).</listitem>
433                                         <listitem>Modify <emphasis role="bold">username</emphasis> and <emphasis role="bold">password</emphasis> to match the <emphasis role="bold">opensrf</emphasis> Jabber user for the chosen domain</listitem>
434                                         <listitem>Modify <emphasis role="bold">logfile</emphasis> to be the full path for a log file to which the user has write access</listitem>
435                                         <listitem>Modify <emphasis role="bold">loglevel</emphasis> as needed for testing</listitem>
436                                 </itemizedlist>
437                                 <figure>
438                                         <title>Example of the file "/openils/conf/srfsh.xml.example"</title>
439                                         <screen>
440                                         &lt;?xml version="1.0"?>
441                                         &lt;!-- This file follows the standard bootstrap config file layout -->
442                                         &lt;!-- found in opensrf_core.xml -->
443                                         &lt;srfsh>
444                                         &lt;router_name>router&lt;/router_name>
445                                         &lt;domain>private.localhost&lt;/domain>
446                                         &lt;username>opensrf&lt;/username>
447                                         &lt;passwd>privsrf&lt;/passwd>
448                                         &lt;port>5222&lt;/port>
449                                         &lt;logfile>/tmp/srfsh.log&lt;/logfile>
450                                         &lt;!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->
451                                         &lt;loglevel>4&lt;/loglevel>
452                                         &lt;/srfsh>
453                                         </screen>
454                                 </figure>
455                         </section>
456                         <section>
457                                 <title>Modify Environmental Variable PATH for "opensrf" User</title>
458                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, modify the environmental variable PATH by adding a new file path to the <emphasis>opensrf</emphasis> user's shell configuration file <emphasis>.bashrc</emphasis>:</para>
459                                 <figure>
460                                         <title>Commands to add path to ".bashrc" configuration file</title>
461                                         <screen>
462                                         $ su - opensrf
463                                         $ echo "export PATH=/openils/bin:\$PATH" >> ~/.bashrc
464                                         </screen>
465                                 </figure>
466                         </section>
467                         <section>
468                                 <title>Starting OpenSRF</title>
469                                 <para>As the <emphasis role="bold">root</emphasis> user, start the "ejabberd" and "memcached" services:</para>
470                                 <figure>
471                                         <title>Commands to start "ejabberd" and "memcached" services</title>
472                                         <screen>
473                                         $ su - root
474                                         $ /etc/init.d/ejabberd start
475                                         $ /etc/init.d/memcached start
476                                         </screen>
477                                 </figure>
478                                 <para/>
479                                 <para>Finally, as the <emphasis role="bold">opensrf</emphasis> user, start OpenSRF:</para>
480                                 <figure>
481                                         <title>Commands to start OpenSRF</title>
482                                         <screen>
483                                         $ su - opensrf
484
485                                         # ensure you have the needed path
486                                         $ export PATH=$PATH:/openils/bin
487
488                                         # start the OpenSRF service:
489                                         # use "-l" to force hostname to be "localhost"
490                                         $ osrf_ctl.sh -l -a start_all     
491                                         </screen>
492                                 </figure>
493                                 <note>
494                                         <para>
495                                                 <emphasis>You can also start Evergreen <emphasis role="bold">without</emphasis> the <emphasis>-l</emphasis> flag, but <emphasis>osrf_ctl.sh</emphasis> must know the fully qualified domain name for the system on which it will execute. That hostname may have been specified in the configuration file <emphasis>opensrf.xml</emphasis>, which you configured in a previous step.</emphasis>
496                                         </para>
497                                 </note>
498                         </section>
499                         <section>
500                                 <title>Testing connections to OpenSRF</title>
501                                 <para>Once you have installed and started OpenSRF, as the <emphasis role="bold">root</emphasis> user, test your connection to OpenSRF using the utility <emphasis>srfsh</emphasis> and trying to call the <emphasis>add</emphasis> method on the OpenSRF "math" service:</para>
502                                 <figure>
503                                         <title>Commands to test OpenSRF with "srfsh"</title>
504                                         <screen>
505                                         $ su - opensrf
506                                         $ /openils/bin/srfsh
507                                         srfsh#  request opensrf.math add 2 2
508                                         Received Data: 4
509                                         ------------------------------------
510                                         Request Completed Successfully
511                                         Request Time in seconds: 0.007519
512                                         ------------------------------------
513                                         srfsh#
514                                         </screen>
515                                 </figure>
516                                 <caution fileref="media/caution.png"> VERIFY THIS TEST </caution>
517                                 <para>For other srfsh commands, type 'help' in at the prompt.</para>
518                         </section>
519                         <section>
520                                 <title>Stopping OpenSRF</title>
521                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, stop OpenSRF:</para>
522                                 <figure>
523                                         <title>Commands to stop OpenSRF</title>
524                                         <screen>
525                                         $ su - opensrf
526                                         $ osrf_ctl.sh -l -a stop_all
527                                         </screen>
528                                 </figure>
529                         </section>
530                 </section>
531                 <section xml:id="serversideinstallation-ubuntudebian">
532                         <title>Installing Evergreen On Ubuntu or Debian</title>
533                         <para>This section outlines the installation process for the latest stable version of Evergreen (1.6.0.7).</para>
534                         <para>In this section you will download, unpack, install, configure and test the Evergreen system, including the Evergreen server and the PostgreSQL database system. You will make several configuration changes and adjustments to the software, including updates to configure the system for your own locale, and some updates needed to work around a few known issues.</para>
535                         <note>
536                                 <para>The following steps have been tested on the x86 (32-bit) and x86-64 (64-bit) architectures. There may be differences between the Desktop and Server editions of Ubuntu. These instructions assume the Server edition.</para>
537                                 <para>In the following instructions, you are asked to perform certain steps as either the <emphasis role="bold">root</emphasis> user, the <emphasis role="bold">opensrf</emphasis> user, or the <emphasis role="bold">postgres</emphasis> user.</para>
538                                 <itemizedlist>
539                                         <listitem><emphasis role="bold">Debian</emphasis> -- To become the <emphasis>root</emphasis> user, issue the command <emphasis role="bold">"su -"</emphasis> and enter the password of the root user.</listitem>
540                                         <listitem><emphasis role="bold">Ubuntu</emphasis> -- To become the <emphasis>root</emphasis> user, issue the command <emphasis role="bold">"sudo su -"</emphasis> and enter the password of your current user.</listitem>
541                                 </itemizedlist>
542                                 <para>To switch from the <emphasis role="bold">root</emphasis> user to a different user, issue the command <emphasis role="bold">"su - USERNAME"</emphasis>. For example, to switch from the <emphasis role="bold">root</emphasis> user to the <emphasis role="bold">opensrf</emphasis> user, issue the command <emphasis role="bold">"su - opensrf"</emphasis>. Once you have become a non-root user, to become the <emphasis role="bold">root</emphasis> user again, simply issue the command <emphasis role="bold">"exit"</emphasis>.</para>
543                         </note>
544                         <section xml:id="serversideinstallation-opensrf-overview">
545                                 <title>Installing OpenSRF</title>
546                                 <para>Evergreen software is integrated with and depends on the Open Service Request Framework (OpenSRF) software system. For further information on installing, configuring and testing OpenSRF, see the section <link linkend="serversideinstallation-opensrf">"Installing OpenSRF"</link>.</para>
547                                 <para>Follow the steps outlined in that section and run the specified tests to ensure that OpenSRF is properly installed and configured. Do not continue with any further Evergreen installation steps until you have verified that OpenSRF has been successfully installed.</para>
548                         </section>
549                         <section>
550                                 <title>Download and Unpack Latest Evergreen Version</title>
551                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, download and extract the latest version of Evergreen. The latest version can be found here: <emphasis><emphasis role="bold"><ulink url="http://evergreen-ils.org/downloads/Evergreen-ILS-1.6.0.7.tar.gz"></ulink></emphasis></emphasis></para>
552                                 <figure>
553                                         <title>Commands to download and unpack Evergreen</title>
554                                         <screen>
555                                         $ su - opensrf
556                                         $ wget http://evergreen-ils.org/downloads/Evergreen-ILS-1.6.0.7.tar.gz
557                                         $ tar zxf Evergreen-ILS-1.6.0.7.tar.gz
558                                         </screen>
559                                 </figure>
560                                 <para>The new directory <emphasis>/home/opensrf/Evergreen-ILS-1.6.0.1</emphasis> will be created.</para>
561                         </section>
562                         <section>
563                                 <title>Install Prerequisites to Build Evergreen</title>
564                                 <para>In this section you will install and configure a set of prerequisites that will be used to build Evergreen. In a following step you will actually build the software using the <emphasis>make</emphasis> utility.</para>
565                                 <para>As the <emphasis role="bold">root</emphasis> user, enter the commands show below to build the prerequisites from the software distribution that you just downloaded and unpacked. Remember to replace <emphasis>[distribution]</emphasis> in the example with the keyword corresponding to the actual Linux distribution listed in the <link linkend="serversideinstallation-keywords-figure-2">"Keywords"</link> figure below.</para>
566                                 <figure>
567                                         <title>Commands to install prerequisites for Evergreen</title>
568                                         <screen>
569                                         $ su - root
570                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
571                                         $ make -f Open-ILS/src/extras/Makefile.install [distribution]
572                                         ...
573                                         </screen>
574                                 </figure>
575                                 <table xml:id="serversideinstallation-keywords-figure-2">
576                                         <title>Keywords Targets for "make"</title>
577                                         <tgroup align="left" cols="2" colsep="1" rowsep="1">
578                                                 <colspec colnum="1" colwidth="1*"/>
579                                                 <colspec colnum="2" colwidth="3*"/>
580                                                 <thead>
581                                                         <row>
582                                                                 <entry>Keyword</entry>
583                                                                 <entry>Description</entry>
584                                                         </row>
585                                                 </thead>
586                                                 <tbody>
587                                                         <row>
588                                                                 <entry>debian-lenny</entry>
589                                                                 <entry>for Debian Lenny (5.0), the most recent version</entry>
590                                                         </row>
591                                                         <row>
592                                                                 <entry>debian-etch</entry>
593                                                                 <entry>for Debian Etch (4.0)</entry>
594                                                         </row>
595                                                         <row>
596                                                                 <entry>ubuntu-karmic</entry>
597                                                                 <entry>for Ubuntu Lucid (10.04) [same as for Karmic]</entry>
598                                                         </row>
599                                                         <row>
600                                                                 <entry>ubuntu-karmic</entry>
601                                                                 <entry>for Ubuntu Karmic (9.10)</entry>
602                                                         </row>
603                                                         <row>
604                                                                 <entry>ubuntu-intrepid</entry>
605                                                                 <entry>for Ubuntu Intrepid (8.10)</entry>
606                                                         </row>
607                                                         <row>
608                                                                 <entry>ubuntu-hardy</entry>
609                                                                 <entry>for Ubuntu Hardy (8.04)</entry>
610                                                         </row>
611                                                         <row>
612                                                                 <entry>ubuntu-gutsy</entry>
613                                                                 <entry>for Ubuntu Gutsy (7.10)</entry>
614                                                         </row>
615                                                         <row>
616                                                                 <entry>gentoo</entry>
617                                                                 <entry>generic for Gentoo versions</entry>
618                                                         </row>
619                                                         <row>
620                                                                 <entry>centos</entry>
621                                                                 <entry>generic for Centos versions</entry>
622                                                         </row>
623                                                 </tbody>
624                                         </tgroup>
625                                 </table>
626                                 <caution fileref="media/caution.png"> ADD INFO FOR OTHER LINUX DISTRIBUTIONS </caution>
627                         </section>
628                         <section>
629                                 <title>(OPTIONAL) Install the PostgreSQL Server</title>
630                                 <para>Since the PostgreSQL server is usually a standalone server in multi-server production systems, the prerequisite installer Makefile in the previous step does not automatically install PostgreSQL. If your PostgreSQL server is on a different system, just skip this step.</para>
631                                 <para>For further information on installing PostgreSQL, see the section <link linkend="serversideinstallation-postgresql">"Installing PostgreSQL"</link>.</para>
632                                 <para>If your PostgreSQL server will be on the same system as your Evergreen software, then as the <emphasis role="bold">root</emphasis> user install the required PostgreSQL server packages:</para>
633                                 <figure>
634                                         <title>Commands to install the PostgreSQL server</title>
635                                         <screen>
636                                         $ su - root
637         
638                                         # Debian Lenny and Ubuntu Hardy (8.04)
639                                         $ make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_83
640                                         ...
641
642                                         # Ubuntu Karmic (9.10) and Ubuntu Lucid (10.04)
643                                         $ make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_84
644                                         ...
645                                         </screen>
646                                 </figure>
647                                 <note>
648                                         <para>
649                                                 <emphasis>PostgreSQL 8.1 is deprecated and will become unsupported in a future release, though existing installations upgrading from Evergreen 1.4 or before will work fine. However, consider upgrading your Postgres soon!</emphasis>
650                                         </para>
651                                 </note>
652                                 <caution fileref="media/caution.png"> VERIFY: IS THIS STILL TRUE? </caution>
653                                 <caution fileref="media/caution.png"> ADD INFO ON HOW TO DETERMINE WHICH VERSION OF POSTGRESQL YOU HAVE </caution>
654                         </section>
655                         <section>
656                                 <title>(OPTIONAL) Install Perl Modules on PostgreSQL Server</title>
657                                 <para>If PostgreSQL is running on the same system as your Evergreen software, then the Perl modules will automatically be available. Just skip this step.</para>
658                                 <para>Otherwise, if your PostgreSQL server is running on another system, then as the <emphasis role="bold">root</emphasis> user install the following Perl modules on that system:</para>
659                                 <figure>
660                                         <title>Commands to install Perl modules</title>
661                                         <screen>
662                                         # ensure the gcc compiler is installed
663                                         $ su - root
664                                         $ aptitude install gcc
665         
666                                         # install the Perl modules
667                                         $ perl -MCPAN -e shell
668                                         cpan> install JSON::XS
669                                         cpan> install MARC::Record
670                                         cpan> install MARC::File::XML
671                                         </screen>
672                                 </figure>
673                                 <caution fileref="media/caution.png"> ADD INFO ON HOW TO INSTALL THE PERL MODULES </caution>
674                                 <caution fileref="media/caution.png"> ADD INFO ON HOW TO VERIFY THAT THE PERL MODULES ARE INSTALLED </caution>
675                         </section>
676                         <section>
677                                 <title>Update the System Dynamic Library Path</title>
678                                 <para>As the <emphasis role="bold">root</emphasis> user, you must update the system dynamic library path to make your system recognize the newly installed libraries. Do this by creating a new file named <emphasis role="bold">/etc/ld.so.conf.d/eg.conf</emphasis> containing two new library paths, then run the command <emphasis role="bold">ldconfig</emphasis> to automatically read the file and modify the system dynamic library path:</para>
679                                 <figure>
680                                         <title>Commands to modify system dynamic library path</title>
681                                         <screen>
682                                         $ su - root
683                                         $ cat > /etc/ld.so.conf.d/eg.conf &lt;&lt; ENDOFFILE
684                                         /usr/local/lib
685                                         /usr/local/lib/dbd
686                                         ENDOFFILE
687                                         $ ldconfig
688                                         </screen>
689                                 </figure>
690                         </section>
691                         <section>
692                                 <title>(OPTIONAL) Restart the PostgreSQL Service</title>
693                                 <para>If PostgreSQL is running on the same system as the rest of Evergreen, as the <emphasis role="bold">root</emphasis> user you must restart the PostgreSQL service to avoid a problem where the library <emphasis role="bold">plperl.so</emphasis> cannot be found. If your PostgreSQL server is running on another system, just skip this step.</para>
694                                 <caution fileref="media/caution.png"> ADD INFO ON OTHER VERSIONS OF POSTGRESQL </caution>
695                                 <figure>
696                                         <title>Commands to restart PostgreSQL service</title>
697                                         <screen>
698                                         $ su - root
699                                         $ /etc/init.d/postgresql-8.3 restart
700                                         </screen>
701                                 </figure>
702                         </section>
703                         <section xml:id="serversideinstallation-configure">
704                                 <title>Configure Evergreen</title>
705                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, return to the Evergreen build directory and use the utility "configure" to prepare for the next step of compiling and linking the software:</para>
706                                 <figure>
707                                         <title>Commands to configure Evergreen</title>
708                                         <screen>
709                                         $ su - opensrf
710                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
711                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf
712                                         $ make
713                                         ...
714                                         </screen>
715                                 </figure>
716                         </section>
717                         <section xml:id="serversideinstallation-compilingevergreen">
718                                 <title>Compile, Link and Install Evergreen</title>
719                                 <para>In this step you will actually compile, link and install Evergreen and the default Evergreen Staff Client.</para>
720                                 <para>As the <emphasis role="bold">root</emphasis> user, return to the Evergreen build directory and use the <emphasis>make</emphasis> command as shown below. The Staff Client will also be automatically built, but you must remember to set the variable <emphasis role="bold">STAFF_CLIENT_BUILD_ID</emphasis> to match the version of the Staff Client you will use to connect to the Evergreen server.</para>
721                                 <para>For further information on manually building the Staff Client, see the section <link linkend="serversideinstallation-staffclient">"Installing the Evergreen Staff Client"</link>.</para>
722                                 <figure>
723                                         <title>Commands to build, link and install Evergreen</title>
724                                         <screen>
725                                         $ su - root
726                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
727                                         $ make STAFF_CLIENT_BUILD_ID=rel_1_6_0_7 install
728                                         ...
729                                         </screen>
730                                         <para>The above commands will create a new subdirectory <emphasis>/openils/var/web/xul/rel_1_6_0_7</emphasis> containing the Staff Client.</para>
731                                 </figure>
732                                 <para>To complete the Staff Client installation, as the <emphasis role="bold">root</emphasis> user, create a symbolic link named <emphasis>server</emphasis> in the head of the Staff Client directory <emphasis>/openils/var/web/xul</emphasis> that points to the <emphasis>/server</emphasis> subdirectory of the new Staff Client build:</para>
733                                 <figure>
734                                         <title>Commands to create symbolic link</title>
735                                         <screen>
736                                         $ su - root
737                                         $ cd /openils/var/web/xul
738                                         $ ln -sf rel_1_6_0_7/server server
739                                         </screen>
740                                 </figure>
741                         </section>
742                         <section>
743                                 <title>Copy the OpenSRF Configuration Files</title>
744                                 <para>As the <emphasis role="bold">root</emphasis> user, copy the example OpenSRF configuration files into place. This replaces the configuration files that you set up in a previous step when you installed and tested OpenSRF. You should also create backup copies of the old files for troubleshooting purposes. Finally, change the ownership on the installed files to the user <emphasis role="bold">opensrf</emphasis>:</para>
745                                 <figure>
746                                         <title>Commands to copy OpenSRF configuration files</title>
747                                         <screen>
748                                         $ su - root
749                                         $ cp /openils/conf/opensrf.xml.example      /openils/conf/opensrf.xml
750                                         $ cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
751                                         $ cp /openils/conf/oils_web.xml.example     /openils/conf/oils_web.xml
752                                         $ chown -R opensrf:opensrf /openils/
753                                         </screen>
754                                 </figure>
755                         </section>
756                         <section>
757                                 <title>Create and Configure PostgreSQL Database</title>
758                                 <para>As the <emphasis role="bold">postgres</emphasis> user on your PostgreSQL server, create the Evergreen database.</para>
759                                 <para>Remember to adjust the path for the <emphasis role="bold">contrib</emphasis> repository to match your PostgreSQL server layout. For example, if you built PostgreSQL from source following the cheat sheet, the contrib directory will be located here: <emphasis role="bold">/usr/local/share/contrib</emphasis> . If you installed the PostgreSQL 8.3 server packages on Ubuntu 8.04, the directory will be located here: <emphasis role="bold">/usr/share/postgresql/8.3/contrib/</emphasis> .</para>
760                                 <orderedlist>
761                                         <listitem>
762                                                 <para>
763                                                         <emphasis role="bold">Create and configure the database</emphasis>
764                                                 </para>
765                                                 <para>As the <emphasis role="bold">postgres</emphasis> user on the PostgreSQL system create the PostgreSQL database, then set some internal paths:</para>
766                                                 <figure>
767                                                         <title>Commands to create database and adjust the path</title>
768                                                         <screen>
769                                                         # create the database
770                                                         $ su - postgres
771                                                         $ createdb -E UNICODE evergreen
772                                                         $ createlang plperl   evergreen
773                                                         $ createlang plperlu  evergreen
774                                                         $ createlang plpgsql  evergreen
775                 
776                                                         # adjust the paths
777                                                         $ psql -f /usr/share/postgresql/8.3/contrib/tablefunc.sql evergreen
778                                                         $ psql -f /usr/share/postgresql/8.3/contrib/tsearch2.sql  evergreen
779                                                         $ psql -f /usr/share/postgresql/8.3/contrib/pgxml.sql     evergreen
780                                                         </screen>
781                                                 </figure>
782                                         </listitem>
783                                         <listitem>
784                                                 <para><emphasis role="bold">Create new Evergreen superuser</emphasis> </para>
785                                                 <para>As the <emphasis role="bold">postgres</emphasis> user on the PostgreSQL system, create the new user <emphasis role="bold">evergreen</emphasis>:</para>
786                                                 <figure>
787                                                         <title>Commands to create the "evergreen" user</title>
788                                                         <screen>
789                                                         # create superuser 'evergreen' and set the password
790                                                         $ su - postgres
791                                                         $ createuser -P -s evergreen
792                                                         Enter password for new role:  mynewpassword
793                                                         Enter it again:  mynewpassword
794                                                         </screen>
795                                                 </figure>
796                                         </listitem>
797                                 </orderedlist>
798                         </section>
799                         <section>
800                                 <title>Create Database Schema</title>
801                                 <para>As the <emphasis role="bold">root</emphasis> user, create the database schema and configure your system with the corresponding database authentication details for the database user 'evergreen' that you created in the previous step.</para>
802                                 <para>Enter the commands and replace <emphasis>[HOSTNAME], [PORT], [USER], [PASSWORD]</emphasis> and <emphasis>[DATABASENAME]</emphasis> with appropriate values.</para>
803                                 <para>On most systems <emphasis>[HOSTNAME]</emphasis> will be <emphasis role="bold">localhost</emphasis>, and <emphasis>[PORT]</emphasis> will be <emphasis role="bold">5432</emphasis>.</para>
804                                 <figure>
805                                         <title>Commands to create Evergreen database schema</title>
806                                         <screen>
807                                         $ su - root
808                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
809                                         $ perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
810                                                 --service all --create-schema --create-bootstrap --create-offline \
811                                                 --hostname [HOSTNAME] --port [PORT] \
812                                                 --user [USER] --password [PASSWORD] --database [DATABASENAME]
813                                         </screen>
814                                 </figure>
815                                 <note>
816                                         <para>
817                                                 <emphasis>If you are entering the above command on a single line, do not include the <emphasis><emphasis role="bold">\</emphasis></emphasis> (backslash) characters. If you are using the <emphasis role="bold">bash</emphasis> shell, these should only be used at the end of a line at a bash prompt to indicate that the command is continued on the next line.</emphasis>
818                                         </para>
819                                 </note>
820                         </section>
821                         <section>
822                                 <title>Configure the Apache Server</title>
823                                 <para>As the <emphasis role="bold">root</emphasis> user, configure the Apache server and copy several new configuration files to the Apache server directories:</para>
824                                 <figure>
825                                         <title>Commands to configure the Apache server</title>
826                                         <screen>
827                                         # configure the Apache server
828                                         $ su - root
829                                         $ a2enmod ssl        # enable mod_ssl
830                                         $ a2enmod rewrite    # enable mod_rewrite
831                                         $ a2enmod expires    # enable mod_expires
832                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
833         
834                                         # copy files
835                                         $ cp Open-ILS/examples/apache/eg.conf       /etc/apache2/sites-available/
836                                         $ cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/
837                                         $ cp Open-ILS/examples/apache/startup.pl    /etc/apache2/
838                                         </screen>
839                                 </figure>
840                         </section>
841                         <section>
842                                 <title>Create a Security Certificate (SSL Key)</title>
843                                 <para>Use the command <emphasis role="bold">openssl</emphasis> to create a new SSL key for your Apache server. For a public production server you should configure or purchase a signed SSL certificate, but for now you can just use a self-signed certificate and accept the warnings in the Staff Client and browser during testing and development:</para>
844                                 <figure>
845                                         <title>Commands to create an SSL key</title>
846                                         <screen>
847                                         $ mkdir /etc/apache2/ssl
848                                         $ cd /etc/apache2/ssl
849                                         $ openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
850                                         </screen>
851                                 </figure>
852                                 <warning>
853                                         <para>
854                                                 <emphasis>This is only a temporary measure to expedite testing. You <emphasis role="bold">must</emphasis> get a proper SSL certificate for a public production system. See this section for further comments on setting up a properly signed SSL certificate:</emphasis>
855                                         </para>
856                                 </warning>
857                                 <caution fileref="media/caution.png"> ADD INFO ON HOW TO GET A SIGNED SSL CERTIFICATE </caution>
858                         </section>
859                         <section xml:id="serversideinstallation-modify-apache">
860                                 <title>Modify the Apache Configuration File</title>
861                                 <para>As the <emphasis role="bold">root</emphasis> user, edit the Apache configuration file <emphasis>/etc/apache2/sites-available/eg.conf</emphasis> and make the following changes:</para>
862                                 <itemizedlist>
863                                         <listitem>
864                                                 <para>Comment out the line <emphasis role="bold">Allow from 10.0.0.0/8</emphasis>, then uncomment the line <emphasis role="bold">Allow from all</emphasis>.</para>
865                                                 <para>
866                                                         <emphasis>This change allows access to your configuration CGI scripts from <emphasis role="bold">any</emphasis> workstation on <emphasis role="bold">any</emphasis> network. This is only a temporary change to expedite testing and should be removed after you have finished and successfully tested the Evergreen installation.</emphasis>
867                                                 </para>
868                                                 <warning>
869                                                         <para>
870                                                                 <emphasis>You must remove these changes after testing is completed. See the section <link linkend="serversideinstallation-postinstallation">"Post-Installation Chores"</link> for further details on removing this change after the Evergreen installation is complete.</emphasis>
871                                                         </para>
872                                                 </warning>
873                                         </listitem>
874                                         <listitem>
875                                                 <para>Comment out the line <emphasis role="bold">Listen 443</emphasis> as it conflicts with the same declaration in the configuration file: <emphasis role="bold">/etc/apache2/ports.conf</emphasis> . Debian <emphasis>etch</emphasis> users should not do this.</para>
876                                                 <caution fileref="media/caution.png"> ADD INFO ON WHY DEBIAN ETCH USERS SHOULD NOT DO THIS </caution>
877                                         </listitem>
878                                         <listitem>
879                                                 <para>The following updates are needed to allow the logs to function properly, but it may break other Apache applications on your server. We hope to make this unnecessary soon.</para>
880                                                 <caution fileref="media/caution.png"> ADD INFO ON WHETHER THIS IS STILL NECESSARY </caution>
881                                                 <orderedlist>
882                                                         <listitem>
883                                                                 <para>For the Linux distributions <emphasis>Ubuntu Hardy</emphasis> or <emphasis>Debian Etch</emphasis>, as the <emphasis role="bold">root</emphasis> user, edit the Apache configuration file <emphasis role="bold">/etc/apache2/apache2.conf</emphasis> and change the user:</para>
884                                                                 <screen>www-data</screen>
885                                                                 <para>to the user:</para>
886                                                                 <screen>opensrf</screen>
887                                                         </listitem>
888                                                         <listitem>
889                                                                 <para>For the Linux distributions <emphasis>Ubuntu Karmic</emphasis> or <emphasis>Ubuntu Lucid</emphasis> or <emphasis>Debian Lenny</emphasis>, as the <emphasis role="bold">root</emphasis> user, edit the Apache configuration file <emphasis role="bold">/etc/apache2/envvars</emphasis> and change the phrase:</para>
890                                                                 <screen>export APACHE_RUN_USER=www-data</screen>
891                                                                 <para>to the phrase:</para>
892                                                                 <screen>export APACHE_RUN_USER=opensrf</screen>
893                                                         </listitem>
894                                                 </orderedlist>
895                                         </listitem>
896                                         <listitem>
897                                                 <para>As the <emphasis role="bold">root</emphasis> user, edit the Apache configuration file <emphasis>/etc/apache2/apache2.conf</emphasis> and add the line <emphasis role="bold">KeepAliveTimeout 1</emphasis>, or modify an existing line if it already exists.</para>
898                                         </listitem>
899                                 </itemizedlist>
900                         </section>
901                         <section>
902                                 <title>(OPTIONAL) Performance Modifications for Apache</title>
903                                 <para>Some further configuration changes to Apache may be necessary for busy systems. These changes increase the number of Apache server processes that can be started to support additional browser connections, and are made to the <emphasis>prefork configuration</emphasis> section of the Apache configuration file.</para>
904                                 <itemizedlist>
905                                         <listitem>As the <emphasis role="bold">root</emphasis> user, edit the Apache configuration file <emphasis>/etc/apache2/apache2.conf</emphasis> and add the line <emphasis role="bold">MaxKeepAliveRequests 100</emphasis>, or modify an existing line if it already exists.</listitem>
906                                         <listitem>
907                                                 <para>As the <emphasis role="bold">root</emphasis> user, edit the Apache configuration file <emphasis>/etc/apache2/apache2.conf</emphasis>, locate and modify the section related to <emphasis>prefork configuration</emphasis> to suit the load on your system.</para>
908                                                 <figure>
909                                                         <title>(OPTIONAL) Example of updates to Apache configuration</title>
910                                                         <screen>
911                                                         &lt;IfModule mpm_prefork_module>
912                                                            StartServers           20
913                                                            MinSpareServers         5
914                                                            MaxSpareServers        15
915                                                            MaxClients            150
916                                                            MaxRequestsPerChild 10000
917                                                         &lt;/IfModule>
918                                                         
919                                                         MaxKeepAliveRequests 100
920                                                         </screen>
921                                                 </figure>
922                                         </listitem>
923                                 </itemizedlist>
924                         </section>
925                         <section>
926                                 <title>Enable the Evergreen Site</title>
927                                 <para>You must run additional Apache configuration commands to enable the Evergreen web site. As the <emphasis role="bold">root</emphasis> user, run these commands:</para>
928                                 <figure>
929                                         <title>Commands to enable the Evergreen Web Site</title>
930                                         <screen>
931                                         $ su - root
932         
933                                         # disables the default site (i.e., the "It Works" page).
934                                         $ a2dissite default
935         
936                                         # enables the Evergreen web site
937                                         $ a2ensite eg.conf
938                                         </screen>
939                                 </figure>
940                         </section>
941                         <section>
942                                 <title>Modify the OpenSRF Configuration File</title>
943                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, edit the OpenSRF configuration file <emphasis>/openils/conf/opensrf_core.xml</emphasis> to update various usernames and passwords, and to specify the domains from which we will accept and to which we will make connections.</para>
944                                 <para>If you are installing Evergreen on a single server and using the <emphasis>private.localhost</emphasis> / <emphasis>public.localhost</emphasis> domains, these will already be set to the correct values. Otherwise, search and replace to match your customized values.</para>
945                                 <note>
946                                         <para>
947                                                 <emphasis>The following example uses common XPath syntax on the left-hand side to indicate the aproximage position needing changes within the XML file.</emphasis>
948                                         </para>
949                                 </note>
950                                 <caution fileref="media/caution.png"> ADD A BETTER DIAGRAM HERE </caution>
951                                 <figure>
952                                         <title>Updates needed in the file "/openils/conf/opensrf_core.xml"</title>
953                                         <screen>
954                                         /config/opensrf/username = opensrf
955         
956                                         /config/opensrf/passwd = password for "private.localhost" opensrf user
957         
958                                         /config/gateway/username = opensrf
959         
960                                         /config/gateway/passwd = password for "public.localhost" opensrf user
961         
962                                         # first entry, where "transport/server" == "public.localhost" :
963                                         /config/routers/router/transport 
964                                             username = router
965                                             password = password for "public.localhost" router user
966
967                                         # second entry, where "transport/server" == "private.localhost" :
968                                         /config/routers/router/transport
969                                             username = router
970                                             password = password for "private.localhost" router user
971                                         </screen>
972                                 </figure>
973                         </section>
974                         <section>
975                                 <title>Create Configuration Files for Users Needing srfsh</title>
976                                 <para>The software installation will automatically create a utility named <emphasis>srfsh</emphasis> (surf shell). This is a command line diagnostic tool for testing and interacting with the OpenSRF network software. It will be used in a future step to complete and test the Evergreen installation. See the section <link linkend="serversideinstallation-testing">"Testing the Installation"</link> for further information.</para>
977                                 <para>In this section you will set up a special configuration file for each user who will need to run the utility. Copy the short sample configuration file <emphasis>/openils/conf/srfsh.xml.example</emphasis> to the file <emphasis>.srfsh.xml</emphasis> (note the leading dot!) in the home directory of each user who will use <emphasis role="bold">srfsh</emphasis>. Finally, edit each file <emphasis>.srfsh.xml</emphasis> and make the following changes:</para>
978                                 <itemizedlist>
979                                         <listitem>Modify <emphasis role="bold">domain</emphasis> to be the router hostname (following our domain examples, <emphasis role="bold">private.localhost</emphasis> will give <emphasis role="bold">srfsh</emphasis> access to all OpenSRF services, while <emphasis role="bold">public.localhost</emphasis> will only allow access to those OpenSRF services that are publicly exposed).</listitem>
980                                         <listitem>Modify <emphasis role="bold">username</emphasis> and <emphasis role="bold">password</emphasis> to match the <emphasis role="bold">opensrf</emphasis> Jabber user for the chosen domain</listitem>
981                                         <listitem>Modify <emphasis role="bold">logfile</emphasis> to be the full path for a log file to which the user has write access</listitem>
982                                         <listitem>Modify <emphasis role="bold">loglevel</emphasis> as needed for testing</listitem>
983                                 </itemizedlist>
984                                 <figure>
985                                         <title>Example of the file "/openils/conf/srfsh.xml.example"</title>
986                                         <screen>
987                                         &lt;?xml version="1.0"?>
988                                         &lt;!-- This file follows the standard bootstrap config file layout -->
989                                         &lt;!-- found in opensrf_core.xml -->
990                                         &lt;srfsh>
991                                         &lt;router_name>router&lt;/router_name>
992                                         &lt;domain>private.localhost&lt;/domain>
993                                         &lt;username>opensrf&lt;/username>
994                                         &lt;passwd>evergreen&lt;/passwd>
995                                         &lt;port>5222&lt;/port>
996                                         &lt;logfile>/tmp/srfsh.log&lt;/logfile>
997                                         &lt;!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->
998                                         &lt;loglevel>4&lt;/loglevel>
999                                         &lt;/srfsh>
1000                                         </screen>
1001                                 </figure>
1002                         </section>
1003                         <section>
1004                                 <title>Modify the OpenSRF Environment</title>
1005                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, change the file permissions of the directory <emphasis>/openils/var/cgi-bin</emphasis> to <emphasis>executable</emphasis>, then modify the shell configuration file <emphasis>~/.bashrc</emphasis> of that user by adding a Perl environmental variable. Finally, execute the shell configuration file to load the new variables into your current environment.</para>
1006                                 <note>
1007                                         <para>
1008                                                 <emphasis>In a multi-server environment, you must add any modifications to <emphasis role="bold">~/.bashrc</emphasis> to the top of the file <emphasis>before</emphasis> the line <emphasis role="bold"> [ -z "$PS1" ] &amp;&amp; return</emphasis>. This will allow headless (scripted) logins to load the correct environment.</emphasis>
1009                                         </para>
1010                                 </note>
1011                                 <figure>
1012                                         <title>Commands to modify the OpenSRF environment</title>
1013                                         <screen>
1014                                         # change permissions
1015                                         $ su - opensrf
1016                                         $ chmod 755 /openils/var/cgi-bin/*.cgi
1017         
1018                                         # add environmental variable
1019                                         $ echo "export PERL5LIB=/openils/lib/perl5:\$PERL5LIB" >> ~/.bashrc
1020         
1021                                         # inherit the new environment
1022                                         $ . ~/.bashrc
1023                                         </screen>
1024                                 </figure>
1025                         </section>
1026                         <section xml:id="serversideinstallation-localization">
1027                                 <title>(OPTIONAL) Configuration for Other Languages</title>
1028                                 <para>This section describes how translations such as Armenian (hy-AM), Canadian French (fr-CA) and others are loaded into the database to complete the translations (default English) available in the OPAC and Staff Client.</para>
1029                                 <caution fileref="media/caution.png"> ADD SECTION ON LANGUAGE LOCALIZATION </caution>
1030                         </section>
1031                         <section xml:id="serversideinstallation-starting">
1032                                 <title>Starting Evergreen</title>
1033                                 <orderedlist>
1034                                         <listitem>
1035                                                 <para>As the <emphasis role="bold">root</emphasis> user, start the "ejabberd" and "memcached" services (if they are not already running):</para>
1036                                                 <figure>
1037                                                         <title>Commands to start "ejabberd" and "memcached" services</title>
1038                                                         <screen>
1039                                                         $ su - root
1040                                                         $ /etc/init.d/ejabberd start
1041                                                         $ /etc/init.d/memcached start
1042                                                         </screen>
1043                                                 </figure>
1044                                         </listitem>
1045                                         <listitem>
1046                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, start Evergreen.</para>
1047                                                 <para>Use the flag <emphasis>-l</emphasis> to force Evergreen to use <emphasis>localhost</emphasis> (your current system) as the hostname. Using the <emphasis>start_all</emphasis> option will start the OpenSRF router, Perl services, and C services:</para>
1048                                                 <figure>
1049                                                         <title>Commands to start Evergreen</title>
1050                                                         <screen>
1051                                                         $ su - opensrf
1052
1053                                                         # ensure you have the needed path
1054                                                         $ export PATH=$PATH:/openils/bin
1055
1056                                                         # start the OpenSRF service:
1057                                                         # use "-l" to force hostname to be "localhost"
1058                                                         $ osrf_ctl.sh -l -a start_all     
1059                                                         </screen>
1060                                                 </figure>
1061                                                 <note>
1062                                                         <para>
1063                                                                 <emphasis>You can also start Evergreen <emphasis role="bold">without</emphasis> the <emphasis>-l</emphasis> flag, but the utility <emphasis>osrf_ctl.sh</emphasis> must know the fully qualified domain name for the system on which it will execute. That hostname may have been specified in the configuration file <emphasis>opensrf.xml</emphasis>, which you configured in a previous step.</emphasis>
1064                                                         </para>
1065                                                 </note>
1066                                                 <caution fileref="media/caution.png"> ADD EXPLANATION FOR CONFIGURING "opensrf.xml" </caution>
1067                                                 <para>Execute the following command to determine the fully qualified domain name of your system:</para>
1068                                                 <figure>
1069                                                         <title>(OPTIONAL) Commands to determine the fully qualified domain name</title>
1070                                                         <screen>
1071                                                         $ perl -e 'use Net::Domain qw(hostfqdn); print hostfqdn()."\n"'
1072                                                         </screen>
1073                                                 </figure>
1074                                                 <itemizedlist>
1075                                                         <listitem>When you attempt to start Evergreen, if you receive an error message similar to <emphasis>osrf_ctl.sh: command not found</emphasis>, then your environment variable <emphasis role="bold">PATH</emphasis> does not include the directory <emphasis>/openils/bin</emphasis>. As the <emphasis role="bold">opensrf</emphasis> user, edit the configuration file <emphasis>/home/opensrf/.bashrc</emphasis> and add the following line: <emphasis role="bold"><screen>export PATH=$PATH:/openils/bin</screen></emphasis></listitem>
1076                                                         <listitem>When you attempt to start Evergreen, if you receive an error message similar to <emphasis>Can't locate OpenSRF/System.pm in @INC ... BEGIN failed--compilation aborted</emphasis>, then your environment variable <emphasis role="bold">PERL5LIB</emphasis> does not include the directory <emphasis>/openils/lib/perl5</emphasis>. As the <emphasis role="bold">opensrf</emphasis> user, edit the configuration file <emphasis>/home/opensrf/.bashrc</emphasis> and add the following line: <emphasis role="bold"><screen>export PERL5LIB=$PERL5LIB:/openils/lib/perl5</screen></emphasis></listitem>
1077                                                 </itemizedlist>
1078                                         </listitem>
1079                                         <listitem>
1080                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, generate the Web files needed by the Staff Client and catalogue, and calculate the proximity of locations in the Organizational Unit tree (which allows <emphasis>Holds</emphasis> to work properly).</para>
1081                                                 <para>You must do this the first time you start Evergreen, and after any time you change the library hierarchy in the configuration file <emphasis>config.cgi</emphasis>.</para>
1082                                                 <figure>
1083                                                         <title>Commands to generate web files</title>
1084                                                         <screen>
1085                                                         $ su - opensrf
1086                                                         $ cd /openils/bin
1087                                                         $ ./autogen.sh -c /openils/conf/opensrf_core.xml -u
1088                                                         Updating Evergreen organization tree and IDL \
1089                                                                 using '/openils/conf/opensrf_core.xml'
1090
1091                                                         Updating fieldmapper
1092                                                         Exception: OpenSRF::EX::Session 2010-04-16T06:31:38 \
1093                                                                 OpenSRF::Utils::SettingsClient \
1094                                                                 /usr/local/share/perl/5.10.0/OpenSRF/Utils/SettingsClient.pm:103 \
1095                                                                 Session Error: router@private.localhost/opensrf.settings \
1096                                                                 IS NOT CONNECTED TO THE NETWORK!!!
1097                                                         </screen>
1098                                                         <caution fileref="media/caution.png"> ADD RESULTS OF TESTS FROM "autogen.sh" </caution>
1099                                                 </figure>
1100                                         </listitem>
1101                                         <listitem>
1102                                                 <para>As the <emphasis role="bold">root</emphasis> user, restart the Apache Web server:</para>
1103                                                 <figure>
1104                                                         <title>Commands to restart Apache web server</title>
1105                                                         <screen>
1106                                                         $ su - root
1107                                                         $ /etc/init.d/apache2 restart
1108                                                         </screen>
1109                                                 </figure>
1110                                                 <para>If the Apache Web server was running when you started the OpenSRF services, you might not be able to successfully log in to the OPAC or Staff Client until the Apache Web server is restarted.</para>
1111                                         </listitem>
1112                                 </orderedlist>
1113                         </section>
1114                         <section xml:id="serversideinstallation-testing">
1115                                 <title>Testing the Installation</title>
1116                                 <para>This section describes several simple tests you can perform to verify that the Evergreen server-side software has been installed and configured properly and is running as expected.</para>
1117                                 <sect1 xml:id="serversideinstallation-testing-connections">
1118                                         <title>Testing Connections to Evergreen</title>
1119                                         <para>Once you have installed and started Evergreen, test your connection to Evergreen. As the <emphasis role="bold">opensrf</emphasis> user start the utility <emphasis>srfsh</emphasis> and try logging onto the Evergreen server using the default administrator username and password. Following is sample output generated by executing that script after a successful Evergreen installation:</para>
1120                                         <figure>
1121                                                 <title>Commands to test Evergreen with "srfsh"</title>
1122                                                 <screen>
1123                                                 $ su - opensrf
1124                                                 $ /openils/bin/srfsh
1125                                                 srfsh% login admin open-ils
1126                                                 Received Data: "250bf1518c7527a03249858687714376"
1127                                                 ------------------------------------
1128                                                 Request Completed Successfully
1129                                                 Request Time in seconds: 0.045286
1130                                                 ------------------------------------
1131                                                 Received Data: {
1132                                                    "ilsevent":0,
1133                                                    "textcode":"SUCCESS",
1134                                                    "desc":" ",
1135                                                    "pid":21616,
1136                                                    "stacktrace":"oils_auth.c:304",
1137                                                    "payload":{
1138                                                       "authtoken":"e5f9827cc0f93b503a1cc66bee6bdd1a",
1139                                                       "authtime":420
1140                                                    }
1141                                                 }
1142                                                 ------------------------------------
1143                                                 Request Completed Successfully
1144                                                 Request Time in seconds: 1.336568
1145                                                 ------------------------------------
1146                                                 </screen>
1147                                         </figure>
1148                                 </sect1>
1149                                 <sect1>
1150                                         <title>Other Connection Tests with "srfsh"</title>
1151                                         <para></para>
1152                                         <para>There is another <emphasis>srfsh</emphasis> command called <emphasis>math_bench</emphasis> that sends queries to the math servers. Note that opensrf.math and opensrf.dbmath must be running for this command to work:</para>
1153                                         <screen>
1154                                         srfsh# math_bench 10
1155                                         |.........|.........|.........|.........|.........|.........|.........|.........|.........|.........
1156                                         ++++++++++++++++++++++++++++++++++++++++
1157                                         Average round trip time: 0.033425
1158                                         srfsh#
1159                                         </screen>
1160                                         <para>The first argument is how many sets of 4 queries (+ - * /) are sent to <emphasis>opensrf.math</emphasis>. When the response is successful, you will see the string of "+" symbols. If the system is not running correctly, you will either get an exception or no result at all.</para>
1161                                         <para>For other srfsh commands, type 'help' in at the prompt.</para>
1162                                         <para/>
1163                                         <para>If this does not work, try the troubleshooting steps in the following section.</para>
1164                                 </sect1>
1165                                 <sect1>
1166                                         <title>Testing with "settings-test.pl"</title>
1167                                         <para>As the <emphasis role="bold">opensrf</emphasis> user, run the script <emphasis>settings-tester.pl</emphasis> to see if it finds any system configuration problems. Following is sample output generated by executing that script after a successful Evergreen installation:</para>
1168                                         <caution fileref="media/caution.png"> REWORK THIS DIAGRAM TO USE SAME IMAGE STANDARDS AS OTHER CHAPTERS </caution>
1169                                         <figure>
1170                                                 <title>Executing the script <emphasis>settings-test.pl</emphasis></title>
1171                                                 <mediaobject>
1172                                                         <imageobject>
1173                                                                 <imagedata fileref="../media/serversideinstallation-testing-1.png" scalefit="1" width="100%"/>
1174                                                         </imageobject>
1175                                                 </mediaobject>
1176                                                 <mediaobject>
1177                                                         <imageobject>
1178                                                                 <imagedata fileref="../media/serversideinstallation-testing-2.png" scalefit="1" width="100%"/>
1179                                                         </imageobject>
1180                                                 </mediaobject>
1181                                         </figure>
1182                                         <para>If the output from the script does not help you find the problem, please do not make any further significant changes to your configuration. Follow the steps in the troubleshooting guide, <link linkend="troubleshooting">"Troubleshooting"</link> .</para>
1183                                         <para>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 and contact the <ulink url="http://open-ils.org/listserv.php">Evergreen development mailing list</ulink> for assistance before making any drastic changes to your system configuration.</para>
1184                                 </sect1>
1185                                 <sect1 xml:id="serversideinstallation-testing-opac">
1186                                         <title>Testing the Catalog</title>
1187                                         <para>By default, the OPAC will live at the URL <emphasis>http://my.domain.com/opac/</emphasis>.</para>
1188                                         <para>Navigate to this URL and the front page of the OPAC should load. There is a basic text entry field with some extra search options. If you have any problems loading this page, check the Apache error logs. If the page loads but does not function correctly, then check for possible javascript errors. We hightly reccommend testing with the <emphasis>Firefox</emphasis> browser because of the helpful javascript debugging tools.</para>
1189                                         <para>Assuming that the OPAC is functioning and there is data in your database, you can now perform other simple functional tests (e.g., searching the catalog).</para>
1190                                         <caution fileref="media/caution.png"> ADD OTHER SIMPLE FUNCTIONAL TESTS </caution>
1191                                 </sect1>
1192                                 <sect1>
1193                                         <title>Running the Evergreen Staff Client</title>
1194                                         <para>Run the Evergreen Staff Client by using the application <emphasis>XULRunner</emphasis> (installed automatically and by default with Firefox version 3.0 and later on Ubuntu and Debian distributions).</para>
1195                                         <para>For example, if the source files for the Evergreen installation are in the directory <emphasis>/home/opensrf/Evergreen-ILS-1.6.0.7/</emphasis>, start the Staff Client as shown as follows:</para>
1196                                         <figure>
1197                                                 <title>Commands to run the Staff Client</title>
1198                                                 <screen>
1199                                                 $ su - opensrf
1200                                                 $ xulrunner /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client/build/application.ini
1201                                                 </screen>
1202                                         </figure>
1203                                 </sect1>
1204                                 <sect1 xml:id="serversideinstallation-starting-apache-server">
1205                                         <title>Testing the Apache Web Server</title>
1206                                         <para>Once you have started Evergreen and confirmed that a basic login attempt works, you can test and start the Apache web server.</para>
1207                                         <para>As the <emphasis role="bold">root</emphasis> user, execute the following commands. Note the use of <emphasis>restart</emphasis> to force the new Evergreen modules to be reloaded even if the Apache server is already running. Any problems found with your configuration files should be displayed:</para>
1208                                         <figure>
1209                                                 <title>Commands to test the Apache Web Server</title>
1210                                                 <screen>
1211                                                 $ su - root
1212                                                 $ apache2ctl configtest &amp;&amp; /etc/init.d/apache2 restart
1213                                                 </screen>
1214                                         </figure>
1215                                 </sect1>
1216                         </section>
1217                         <section xml:id="serversideinstallation-stopping">
1218                                 <title>Stopping Evergreen</title>
1219                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, stop all Evergreen services by using the following command:</para>
1220                                 <figure>
1221                                         <title>Commands to stop Evergreen</title>
1222                                         <screen>
1223                                         $ su - opensrf
1224
1225                                         # stop the server:
1226                                         # use "-l" to force hostname to be "localhost"
1227                                         $ osrf_ctl.sh -l -a stop_all
1228                                         </screen>
1229                                 </figure>
1230                                 <note>
1231                                         <para>
1232                                                 <emphasis>You can also stop Evergreen services <emphasis role="bold">without</emphasis> the <emphasis>-l</emphasis> flag, but the utility <emphasis>osrf_ctl.sh</emphasis> must know the fully qualified domain name for the system on which it will execute. That hostname may have been specified in the configuration file <emphasis>opensrf.xml</emphasis>, which you configured in a previous step.</emphasis>
1233                                         </para>
1234                                 </note>
1235                                 <caution fileref="media/caution.png"> ADD EXPLANATION FOR CONFIGURING "opensrf.xml" </caution>
1236                         </section>
1237                 </section>
1238                 <section xml:id="serversideinstallation-postinstallation">
1239                         <title>Post-Installation Chores</title>
1240                         <section>
1241                                 <title>Remove temporary changes from Apache configuration file</title>
1242                                 <para>As the <emphasis role="bold">root</emphasis> user, edit the Apache configuration file <emphasis>/etc/apache2/sites-available/eg.conf</emphasis> again and make the following change:</para>
1243                                 <para>Uncomment the line <emphasis role="bold">Allow from 10.0.0.0/8</emphasis>, then comment out the line <emphasis role="bold">Allow from all</emphasis>. You modified this file in an earlier step as a temporary measure to expedite testing (see the section <link linkend="serversideinstallation-modify-apache">"Modify the Apache Configuration File"</link> for further information). Those changes must now be reversed in order to deny unwanted access to your CGI scripts from users on other public networks. You <emphasis role="bold">must</emphasis> secure this for a public production system.</para>
1244                         </section>
1245                         <section>
1246                                 <title>Configure a permanent SSL key</title>
1247                                 <para>In a previous step, we used the command <emphasis role="bold">openssl</emphasis> to temporarily create a new SSL key for the Apache server. For a public production server you should configure or purchase a signed SSL certificate</para>
1248                                 <warning>
1249                                         <para>
1250                                                 <emphasis>The temporary SSL key was only created to expedite testing. You <emphasis role="bold"> must</emphasis> get a proper SSL certificate for a public production system.</emphasis>
1251                                         </para>
1252                                 </warning>
1253                                 <caution fileref="media/caution.png"> ADD EXPLANATION OF HOW TO GET PERMANENT SSL CERTIFICATE </caution>
1254                         </section>
1255                         <section>
1256                                 <title>Set Up Support For Reports</title>
1257                                 <para>Evergreen reports are extremely powerful, but some configuration is required. See the section <link linkend="report-introduction">"Reports"</link> for details.</para>
1258                                 <sect1>
1259                                         <title>Starting the Reporter Daemon</title>
1260                                         <para>Once the <emphasis>open-ils.reporter</emphasis> process is running and enabled on the gateway, you can start the reporter daemon. That process periodically checks for requests for new reports or scheduled reports and gets them running.</para>
1261                                         <para>As the <emphasis role="bold">opensrf</emphasis> user, start the reporter daemon using the following command:</para>
1262                                         <figure>
1263                                                 <title>Commands to start the Reporter daemon</title>
1264                                                 <screen>
1265                                                 $ su - opensrf
1266                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/src/reporter
1267                                                 $ ./clark-kent.pl --daemon
1268                                                 </screen>
1269                                         </figure>
1270                                         <para>You can also specify other options with this utility:</para>
1271                                         <itemizedlist>
1272                                                 <listitem>--sleep=interval      : number of seconds to sleep between checks for new reports to run; defaults to 10</listitem>
1273                                                 <listitem>--lockfile=filename   : where to place the lockfile for the process; defaults to <emphasis>/tmp/reporter-LOCK</emphasis></listitem>
1274                                                 <listitem>--concurrency=integer : number of reporter daemon processes to run; defaults to "1"</listitem>
1275                                                 <listitem>--boostrap=filename   : OpenSRF bootstrap configuration file; defaults to <emphasis>/openils/conf/opensrf_core.xml</emphasis></listitem>
1276                                         </itemizedlist>
1277                                 </sect1>
1278                                 <sect1>
1279                                         <title>Stopping the Reporter Daemon</title>
1280                                         <para>To stop the Reporter daemon, you must kill the process and remove the lockfile. The daemon may have just a single associated process, with a lockfile in the default location.</para>
1281                                         <note>
1282                                                 <para>
1283                                                         <emphasis>It is possible that several processes are running; see the optional commands in the previous section. As the <emphasis role="bold">opensrf</emphasis> user, perform the following commands to stop the Reporter daemon:</emphasis>
1284                                                 </para>
1285                                         </note>
1286                                         <figure>
1287                                                 <title>Commands to stop the Reporter daemon</title>
1288                                                 <screen>
1289                                                 $ su - opensrf
1290                                                 # find and kill the process ID number(s)
1291                                                 $ kill `ps wax | grep "Clark Kent" | grep -v grep | cut -b1-6`
1292                                                 # remove the lock file
1293                                                 $ rm /tmp/reporter-LOCK
1294                                                 </screen>
1295                                         </figure>
1296                                 </sect1>
1297                         </section>
1298                 </section>
1299                 <section xml:id="serversideinstallation-staffclient">
1300                         <title>Installing the Evergreen Staff Client</title>
1301                         <para>The Staff Client is automatically built by default as part of the normal <emphasis>make install</emphasis> process for Evergreen server-side software. See the section <link linkend="serversideinstallation-compilingevergreen">"Compile, Link and Install Evergreen"</link> to review the final compile/link/install phase of the default Evergreen build process.</para>
1302                         <section>
1303                                 <title>Building the Evergreen Staff Client</title>
1304                                 <para>You can also build the Staff Client manually by running the <emphasis>make</emphasis> command in the source directory <emphasis>/home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client</emphasis>. The <emphasis>make</emphasis> command accepts a number of options to build special versions of the Staff Client. Following is a list of environment variables that can be passed to <emphasis>make</emphasis> to influence the manual build process:</para>
1305                                 <section>
1306                                         <title>Option STAFF_CLIENT_BUILD_ID</title>
1307                                         <para>This variable defaults to an automatically generated date/time string during the normal Evergreen server-side software installation process, but you can also specify it manually. The following commands could have been used during the normal build process:</para>
1308                                         <figure>
1309                                                 <title>Commands for normal Evergreen build</title>
1310                                                 <screen>
1311                                                 $ su - root
1312                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
1313                                                 $ make STAFF_CLIENT_BUILD_ID=rel_1_6_0_7 install
1314                                                 ...
1315                                                 </screen>
1316                                         </figure>
1317                                         <para>You can also manually set the BUILD_ID. The following commands will manually build the Staff Client using a different BUILD_ID.</para>
1318                                         <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then set the variable and build the Staff Client:</para>
1319                                         <figure>
1320                                                 <title>Commands to manually build the Staff Client</title>
1321                                                 <screen>
1322                                                 $ su - opensrf
1323                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1324                                                 $ make STAFF_CLIENT_BUILD_ID=my_test_id  build
1325                                                 ...
1326                                                 </screen>
1327                                         </figure>
1328                                 </section>
1329                                 <section>
1330                                         <title>Option STAFF_CLIENT_VERSION</title>
1331                                         <para>During the normal Evergreen server-side software build process this variable is pulled automatically from a README file in the Evergreen source root, but you can also specify it manually. The following commands could have been used during the normal build process:</para>
1332                                         <figure>
1333                                                 <title>Commands used for normal Evergreen build</title>
1334                                                 <screen>
1335                                                 $ su - root
1336                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
1337                                                 $ make STAFF_CLIENT_VERSION=0mytest.200 install
1338                                                 ...
1339                                                 </screen>
1340                                         </figure>
1341                                         <para>If you manually build the Staff Client, VERSION will default to <emphasis>0trunk.revision</emphasis>, where revision is either automatically pulled from SVN or an empty string on failure. If you wish to make extensions update automatically then your version needs to conform to the format found in <ulink url="https://developer.mozilla.org/en/Toolkit_version_format">Toolkit Version Format</ulink> and newer versions need to be "higher" than older versions.</para>
1342                                         <para>You can manually set VERSION. The following commands will manually build the Staff Client using a different VERSION.</para>
1343                                         <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then set the variable and build the Staff Client:</para>
1344                                         <figure>
1345                                                 <title>Commands to manually build the Staff Client</title>
1346                                                 <screen>
1347                                                 $ su - opensrf
1348                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1349                                                 $ make STAFF_CLIENT_VERSION=0mytest.200  build
1350                                                 ...
1351                                                 </screen>
1352                                         </figure>
1353                                 </section>
1354                                 <section>
1355                                         <title>Option STAFF_CLIENT_STAMP_ID variable</title>
1356                                         <para>During the normal Evergreen server-side software build process this variable is generated from STAFF_CLIENT_VERSION, but you can also specify it manually. The following commands could have been used during the normal build process:</para>
1357                                         <figure>
1358                                                 <title>Commands used for normal Evergreen build</title>
1359                                                 <screen>
1360                                                 $ su - root
1361                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
1362                                                 $ make STAFF_CLIENT_STAMP_ID=my_test_stamp install
1363                                                 ...
1364                                                 </screen>
1365                                         </figure>
1366                                         <para>It is possible to have multiple versions of the Staff Client with different stamps, possibly for different uses or client-side customizations.</para>
1367                                         <para>You can manually set STAMP_ID. The following commands will manually build the Staff Client using a different STAMP_ID.</para>
1368                                         <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then set the variable and build the Staff Client:</para>
1369                                         <figure>
1370                                                 <title>Commands to manually build the Staff Client</title>
1371                                                 <screen>
1372                                                 $ su - opensrf
1373                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1374                                                 $ make STAFF_CLIENT_STAMP_ID=my_test_stamp  build
1375                                                 ...
1376                                                 </screen>
1377                                         </figure>
1378                                 </section>
1379                         </section>
1380                         <section>
1381                                 <title>Advanced Build Options</title>
1382                                 <para>In addition to the basic options listed above, there are a number of other options for building the Staff Client. Most are target names for the <emphasis>make</emphasis> utility and require that you build the Staff Client from its source directory. See the following table for a list of possible <emphasis>make</emphasis> target keywords:</para>
1383                                 <table>
1384                                         <title>Keywords Targets for "make" Command</title>
1385                                         <tgroup align="left" cols="2" colsep="1" rowsep="1">
1386                                                 <colspec colnum="1" colwidth="1*"/>
1387                                                 <colspec colnum="2" colwidth="3*"/>
1388                                                 <thead>
1389                                                         <row>
1390                                                                 <entry>Keyword</entry>
1391                                                                 <entry>Description</entry>
1392                                                         </row>
1393                                                 </thead>
1394                                                 <tbody>
1395                                                         <row>
1396                                                                 <entry>clients</entry>
1397                                                                 <entry>Run "make win-client", "make linux-client", and "make generic-client" individually</entry>
1398                                                         </row>
1399                                                         <row>
1400                                                                 <entry>client_dir</entry>
1401                                                                 <entry>Build a client directory from the build directory, without doing a rebuild. The same as "copy everything but server/".</entry>
1402                                                         </row>
1403                                                         <row>
1404                                                                 <entry>client_app</entry>
1405                                                                 <entry>Prereq "client_dir"; removes "install.rdf" from client directory so an app bundle can't be installed as an extension</entry>
1406                                                         </row>
1407                                                         <row>
1408                                                                 <entry>client_ext</entry>
1409                                                                 <entry>Prereq "client_dir"; remove "application.ini", "autoupdate.js", "standalone_xul_app.js" from client directory so an extension won't break Firefox</entry>
1410                                                         </row>
1411                                                         <row>
1412                                                                 <entry>extension</entry>
1413                                                                 <entry>Prereq "client_ext"; rewritten to use "client_ext"</entry>
1414                                                         </row>
1415                                                         <row>
1416                                                                 <entry>generic-client</entry>
1417                                                                 <entry>Prereq "client_app"; make an XPI file suitable for use with "xulrunner --install-app""</entry>
1418                                                         </row>
1419                                                         <row>
1420                                                                 <entry>win-xulrunner</entry>
1421                                                                 <entry>Prereq "client_app"; add Windows xulrunner to client build</entry>
1422                                                         </row>
1423                                                         <row>
1424                                                                 <entry>linux-xulrunner</entry>
1425                                                                 <entry>Prereq "client_app"; add Linux xulrunner to client build</entry>
1426                                                         </row>
1427                                                         <row>
1428                                                                 <entry>win-client</entry>
1429                                                                 <entry>Prereq "win-xulrunner"; build "setup exe" (requires that "nsis" package be installed, will add options for automatic update if configured and developer options if client build was a "make devbuild")</entry>
1430                                                         </row>
1431                                                         <row>
1432                                                                 <entry>linux-client</entry>
1433                                                                 <entry>Prereq "linux_xulrunner"; build a "tar.bz2" bundle of the Linux client</entry>
1434                                                         </row>
1435                                                         <row>
1436                                                                 <entry>[generic | win | linux | extension]-updates[-client]</entry>
1437                                                                 <entry>Call external/make_updates.sh to build full and partial updates generic/win/linux/extension prefix limit to that distribution; Adding "-client" builds clients and copies them to a subdirectory of the "updates" directory as well; "extension-updates-client" doesn't exist.</entry>
1438                                                         </row>
1439                                                 </tbody>
1440                                         </tgroup>
1441                                 </table>
1442                                 <itemizedlist>
1443                                         <listitem>
1444                                                 <para>Developer Build</para>
1445                                                 <para>You can create a so-called "developer build" of the Staff Client by substituting "devbuild" for "build" when running <emphasis>make</emphasis>. The build will contain an extra configuration file that enables some special developer options.</para>
1446                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, run <emphasis>make</emphasis> from the Staff Client source directory:</para>
1447                                                 <figure>
1448                                                         <title>Commands to do a "developer build"</title>
1449                                                         <screen>
1450                                                         $ su - opensrf
1451                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1452                                                         $ make devbuild
1453                                                         ...
1454                                                         </screen>
1455                                                 </figure>
1456                                         </listitem>
1457                                         <listitem>
1458                                                 <para>Compressed Javascript</para>
1459                                                 <para>You can automatically run the Google "Closure Compiler" utility to review and compress Javascript code after the build process completes by substituting "compress-javascript" for "build" when running <emphasis>make</emphasis>.</para>
1460                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, run the following commands from the Staff Client source directory:</para>
1461                                                 <figure>
1462                                                         <title>Commands to compress Javascript</title>
1463                                                         <screen>
1464                                                         $ su - opensrf
1465                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1466                                                         $ make compress-javascript
1467                                                         ...
1468                                                         </screen>
1469                                                 </figure>
1470                                                 <para>You can also combine Javascript review and compression, and also perform a "developer build".</para>
1471                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, run the following commands from the Staff Client source directory:</para>
1472                                                 <figure>
1473                                                         <title>Commands to compress Javascript and do a "developer build"</title>
1474                                                         <screen>
1475                                                         $ su - opensrf
1476                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1477
1478                                                         # order of options is important!
1479                                                         $ make devbuild compress-javascript
1480                                                         ...
1481                                                         </screen>
1482                                                 </figure>
1483                                         </listitem>
1484                                         <listitem>
1485                                                 <para>Automatic Update Host</para>
1486                                                 <para>The host used to check for automatic Staff Client updates can be overridden by specifying the AUTOUPDATE_HOST option. The following commands could have been used during the normal build process:</para>
1487                                                 <figure>
1488                                                         <title>Commands to set AUTOUPDATE_HOST for normal Evergreen build</title>
1489                                                         <screen>
1490                                                         $ su - root
1491                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
1492                                                         $ make AUTOUPDATE_HOST=localhost install
1493                                                         ...
1494                                                         </screen>
1495                                                 </figure>
1496                                                 <para>You can manually set AUTOUPDATE_HOST. The following commands will manually build the Staff Client using a different AUTOUPDATE_HOST.</para>
1497                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then set the variable and build the Staff Client:</para>
1498                                                 <figure>
1499                                                         <title>Commands to manually specify AUTOUPDATE_HOST</title>
1500                                                         <screen>
1501                                                         $ su - opensrf
1502                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1503                                                         $ make AUTOUPDATE_HOST=localhost build
1504                                                         ...
1505                                                         </screen>
1506                                                 </figure>
1507                                                 <para>For more information see the section <link linkend="serversideinstallation-staffclient-autoupdate">"Automatic Updates"</link>.</para>
1508                                         </listitem>
1509                                 </itemizedlist>
1510                         </section>
1511                         <section>
1512                                 <title>Installing and Activating the Staff Client</title>
1513                                 <para>The Staff Client is automatically built, installed and activated as part of the normal <emphasis>make install</emphasis> process for Evergreen server-side software. However, if you manually build the Staff Client from its source directory, then you need to take additional steps to install and active it.</para>
1514                                 <para>Assuming you have already built the Staff Client, and that your installation is in the directory <emphasis>/openils/var/web/xul</emphasis>, as the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1515                                 <figure>
1516                                         <title>Commands to install and active the Staff Client</title>
1517                                         <screen>
1518                                         $ su - opensrf
1519                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1520                                         $ mkdir -p "/openils/var/web/xul/$(cat build/STAMP_ID)"
1521                                         $ cp -R build/server "/openils/var/web/xul/$(cat build/STAMP_ID)"
1522                                         </screen>
1523                                 </figure>
1524                         </section>
1525                         <section>
1526                                 <title>Packaging the Staff Client</title>
1527                                 <para>Once the Staff Client has been built, you can create several forms of client packages by using some targetted <emphasis>make</emphasis> commands in the Staff Client source directory.</para>
1528                                 <itemizedlist>
1529                                         <listitem>
1530                                                 <para>Packaging a Generic Client</para>
1531                                                 <para>This build creates a Staff Client packaged as an XPI file suitable for use with <emphasis>XULRunner</emphasis>.</para>
1532                                                 <para>This special build requires that you already have the "zip" utility installed on your system. It will create the output file "evergreen_staff_client.xpi", suitable for use with the <emphasis>XULRunner</emphasis> parameter <emphasis>--install-app</emphasis>.</para>
1533                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1534                                                 <figure>
1535                                                         <title>Commands to package a "generic" client</title>
1536                                                         <screen>
1537                                                         $ su - opensrf
1538                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1539                                                         $ make generic-client
1540                                                         ...
1541                                                         </screen>
1542                                                 </figure>
1543                                         </listitem>
1544                                         <listitem>
1545                                                 <para>Packaging a Windows Client</para>
1546                                                 <para>This build creates a Staff Client packaged as a Windows executable</para>
1547                                                 <para>This special build requires that you already have the "zip" utility installed on your system. It also requires that you install <ulink url="http://nsis.sourceforge.net/">NSIS (Nullsoft Scriptable Install System)</ulink>, a professional open source utility package used to create Windows installers (the "makensis" utility is installed as part of the "nsis" package). We recommend using Version 2.45 or later. The output file "evergreen_staff_client_setup.exe" will be created.</para>
1548                                                 <para>(OPTIONAL) If you wish for the Staff Client to have a link icon/tray icon by default, you may wish to provide a pre-modified <emphasis>xulrunner-stub.exe</emphasis>. Place it in the Staff Client source directory and <emphasis>make</emphasis> will automatically use it instead of the one that comes with the downloaded <emphasis>XULRunner</emphasis> release. The version of <emphasis>xulrunner-stub.exe</emphasis> need not match exactly.</para>
1549                                                 <para>You can also use a tool such as <ulink url="http://www.angusj.com/resourcehacker/">Resource Hacker</ulink> to embed icons. "Resource Hacker" is an open-source utility used to view, modify, rename, add, delete and extract resources in 32bit Windows executables</para>
1550                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1551                                                 <figure>
1552                                                         <title>Useful icon ID strings</title>
1553                                                         <screen>
1554                                                         IDI_APPICON - Tray icon
1555                                                         32512 - Default window icon
1556                                                         </screen>
1557                                                 </figure>
1558                                                 <para/>
1559                                                 <figure>
1560                                                         <title>Commands to build a Windows client</title>
1561                                                         <screen>
1562                                                         $ su - opensrf
1563                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1564                                                         $ make win-client
1565                                                         ...
1566                                                         </screen>
1567                                                 </figure>
1568                                         </listitem>
1569                                         <listitem>
1570                                                 <para>Packaging a Linux Client</para>
1571                                                 <para>This build creates a Staff Client package for Linux as a "tar.bz2" file with <emphasis>XULRunner</emphasis> already bundled with it. The output file "evergreen_staff_client.tar.bz2" will be created.</para>
1572                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1573                                                 <figure>
1574                                                         <title>Commands to build a Linux client</title>
1575                                                         <screen>
1576                                                         $ su - opensrf
1577                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1578                                                         $ make linux-client
1579                                                         ...
1580                                                         </screen>
1581                                                 </figure>
1582                                         </listitem>
1583                                         <listitem>
1584                                                 <para>Packaging a Firefox Extension</para>
1585                                                 <para>This special build requires that you already have the "zip" utility installed on your system. This build creates a Staff Client packaged as a Firefox extension. The output file "evergreen.xpi" will be created.</para>
1586                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1587                                                 <figure>
1588                                                         <title>Commands to build a Firefox extension</title>
1589                                                         <screen>
1590                                                         $ su - opensrf
1591                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1592                                                         $ make extension
1593                                                         ...
1594                                                         </screen>
1595                                                 </figure>
1596                                         </listitem>
1597                                 </itemizedlist>
1598                         </section>
1599                         <section xml:id="serversideinstallation-staffclient-autoupdate">
1600                                 <title>Automatic Updates</title>
1601                                 <para>It is possible to set up support for automatic Staff Client updates, either during the normal Evergreen server-side build process, or by later building the Staff Client with certain special options.</para>
1602                                 <para>Automatic update server certificate requirements are more strict than normal server requirements. Firefox and <emphasis>XULRunner</emphasis> will both ignore any automatic update server that is not validated by a trusted certificate authority. Servers with exceptions added to force the Staff Client to accept them WILL NOT WORK.</para>
1603                                 <para>In addition, automatic updates have special requirements for the file <emphasis>update.rdf</emphasis>:</para>
1604                                 <orderedlist>
1605                                         <listitem>It must be served from an SSL server, or</listitem>
1606                                         <listitem>It must be signed with the utility <ulink url="https://developer.mozilla.org/en/McCoy">McCoy</ulink>.</listitem>
1607                                 </orderedlist>
1608                                 <para>You can pre-install the signing key into the file <emphasis>install.rdf</emphasis> directly, or install it into a copy as <emphasis>install.mccoy.rdf</emphasis>. If the latter exists it will be copied into the build instead of the original file <emphasis>install.rdf</emphasis>.</para>
1609                                 <para>The name of the automatic update host can be provided in either of two ways:</para>
1610                                 <orderedlist>
1611                                         <listitem>At configuration time for the Evergreen server-side software, or</listitem>
1612                                         <listitem>During the Staff Client build process</listitem>
1613                                 </orderedlist>
1614                                 <section>
1615                                         <title>Specifying the Automatic Update Host</title>
1616                                         <section>
1617                                                 <title>At configuration time for the Evergreen server-side software</title>
1618                                                 <para>This must be done when the Evergreen server-side software is first configured (see the section <link linkend="serversideinstallation-configure"> "Configure Evergreen" </link>). As the <emphasis role="bold">opensrf</emphasis> user, use the utility "configure" as shown:</para>
1619                                                 <figure>
1620                                                         <title>Commands to configure Evergreen</title>
1621                                                         <screen>
1622                                                         $ su - opensrf
1623                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
1624                                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf --with-updateshost=hostname
1625                                                         $ make
1626                                                         ...
1627                                                         </screen>
1628                                                 </figure>
1629                                         </section>
1630                                         <section>
1631                                                 <title>During the Staff Client build process</title>
1632                                                 <para>You will used the variable AUTOUPDATE_HOST=hostname (see above). If you specify just a hostname (such as "example.com") then the URL will be a secure HTTPS URL (such as "https://example.com"). If you wish to use a non-HTTPS URL then prefix the hostname with "http://". (such as "http://example.com").</para>
1633                                                 <para>If neither option is used then, by default, the Staff Client will not include the automatic update preferences.</para>
1634                                         </section>
1635                                 </section>
1636                                 <section>
1637                                         <title>Building Updates</title>
1638                                         <para>Similar to building clients, the targets "generic-updates", "win-updates", "linux-updates", and "extension-updates" can be used individually with <emphasis>make</emphasis> to build the update files for the Staff Client. To build all the targets at once, simply use the target "updates".</para>
1639                                         <para>A "full" update will be built for each specified target (or for all if the target "updates" is used). For all but extensions any previous "full" updates (archived by default in the directory <emphasis>/openils/var/updates/archives</emphasis>) will be used to make "partial" updates. Partial updates tend to be much smaller and will thus download more quickly, but if something goes wrong with a partial update the full update will be used as a fallback. Extensions do not currently support partial updates.</para>
1640                                         <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1641                                         <figure>
1642                                                 <title>Commands for building updates</title>
1643                                                 <screen>
1644                                                 $ su - opensrf
1645                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1646
1647                                                 # command to build all updates at once:
1648                                                 $ make updates
1649                                                 ...
1650
1651                                                 # commands to build updates individually:
1652                                                 $ make generic-updates
1653                                                 ...
1654                                                 $ make win-updates
1655                                                 ...
1656                                                 $ make linux-updates
1657                                                 ...
1658                                                 $ make extension-updates
1659                                                 ...
1660                                                 </screen>
1661                                         </figure>
1662                                 </section>
1663                                 <section>
1664                                         <title>Building updates with "-client"</title>
1665                                         <para>To save time and effort you can build updates and manual download clients at the same time by adding the string "-client" to each target name (for instance, you can specify "win-updates-client"). You can also specify "updates-client" to build all the targets at once. This does not work for extension-updates.</para>
1666                                         <para>The clients will be installed alongside the updates and listed on the "manualupdate.html" page, rather than left in the Staff Client directory.</para>
1667                                         <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1668                                         <figure>
1669                                                 <title>Commands for building updates</title>
1670                                                 <screen>
1671                                                 $ su - opensrf
1672                                                 $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1673
1674                                                 # command to build all updates at once:
1675                                                 $ make updates-client
1676                                                 ...
1677
1678                                                 # commands to build updates individually:
1679                                                 $ make generic-updates-client
1680                                                 ...
1681                                                 $ make win-updates-client
1682                                                 ...
1683                                                 $ make linux-updates-client
1684                                                 ...
1685                                                 </screen>
1686                                         </figure>
1687                                 </section>
1688                                 <section>
1689                                         <title>Activating the Update Server</title>
1690                                         <para>This section reviews scripts associated with the update server, and requires some final adjustments to file permissions.</para>
1691                                         <para>The Apache example configuration creates an "updates" directory that, by default, points to the directory <emphasis>/openils/var/updates/pub</emphasis>. This directory contains one HTML file and several specially-named script files</para>
1692                                         <para>The "updatedetails.html" file is the fallback web page for the update details. The "check" script is used for <emphasis>XULRunner</emphasis> updates. The "update.rdf" script is used for extension updates. The "manualupdate.html" script checks for clients to provide download links when automatic updates have failed and uses the download script to force a download of the generic client xpi (compared to Firefox trying to install it as an extension).</para>
1693                                         <para>As the <emphasis role="bold">root</emphasis> user, change directory to the updates directory, then execute the following commands:</para>
1694                                         <para>The following scripts should be marked as executable: <emphasis>check, download, manualupdate.html, update.rdf</emphasis>.</para>
1695                                         <figure>
1696                                                 <title>Changing permissions of scripts</title>
1697                                                 <screen>
1698                                                 $ su - root
1699                                                 $ cd /openils/var/updates/pub
1700                                                 $ chmod +x  check  download  manualupdate.html  update.rdf
1701                                                 </screen>
1702                                         </figure>
1703                                 </section>
1704                         </section>
1705                         <section>
1706                                 <title>Other tips</title>
1707                                 <itemizedlist>
1708                                         <listitem>
1709                                                 <para>Multiple workstations on one install</para>
1710                                                 <para>Multiple workstation registrations for the same server can be accomplished with a single Staff Client install by using multiple profiles. When running <emphasis>XULRunner</emphasis> you can specify the option "-profilemanager" or "-P" (uppercase "P") to force the Profile Manager to start. Unchecking the "Don't ask at startup" option will make this the default.</para>
1711                                                 <para>Once you have opened the Profile Manager you can create additional profiles, one for each workstation you wish to register. You may need to install SSL exceptions for each profile.</para>
1712                                                 <para>When building targets "win-client", "win-updates-client", or "updates-client", you can specify "NSIS_EXTRAOPTS=-DPROFILES" to add an "Evergreen Staff Client Profile Manager" option to the start menu.</para>
1713                                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, change directory to the Staff Client source directory, then execute the following commands:</para>
1714                                                 <figure>
1715                                                         <title>Command to add start menu option</title>
1716                                                         <screen>
1717                                                         $ su - opensrf
1718                                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client
1719                                                         $ make NSIS_EXTRAOPTS=-DPROFILES win-client
1720                                                         ...
1721                                                         </screen>
1722                                                 </figure>
1723                                         </listitem>
1724                                         <listitem>
1725                                                 <para> Multiple Staff Clients</para>
1726                                                 <para>This may be confusing if you are not careful, but you can log in to multiple Evergreen servers at the same time, or a single Evergreen server multiple times. In either case you will need to create an additional profile for each additional server or workstation you want to log in as (see previous tip).</para>
1727                                                 <para>Once you have done so, run <emphasis>XULRunner</emphasis> with the option "-no-remote" (in addition to "-profilemanger" or "-P" if neeeded). Instead of <emphasis>XULRunner</emphasis> opening a new login window on your existing session it will start a new session instead, which can then be logged in to a different server or workstation ID.</para>
1728                                         </listitem>
1729                                 </itemizedlist>
1730                         </section>
1731                         <section xml:id="serversideinstallation-running-staffclient">
1732                                 <title>Running the Evergreen Staff Client</title>
1733                                 <caution fileref="media/caution.png">ADD CONTENT: LINUX VS WINDOWS STAFF CLIENT</caution>
1734                                 <para>Run the Evergreen Staff Client on a Linux system by using the application <emphasis>XULRunner</emphasis> (installed automatically and by default with Firefox version 3.0 and later on Ubuntu and Debian distributions).</para>
1735                                 <para>For example, if the source files for the Evergreen installation are in the directory <emphasis>/home/opensrf/Evergreen-ILS-1.6.0.7/</emphasis>, start the Staff Client as shown in the following command example:</para>
1736                                 <figure>
1737                                         <title>Commands to run the Staff Client</title>
1738                                         <screen>
1739                                         $ su - opensrf
1740                                         $ xulrunner /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client/build/application.ini
1741                                         </screen>
1742                                 </figure>
1743                         </section>
1744                 </section>
1745         </section>
1746         <section xml:id="serversideinstallation-otherlinux">
1747                 <title>Installing Evergreen On Other Linux Systems</title>
1748                 <caution fileref="media/caution.png"> ADD CONTENT FOR INSTALLING ON OTHER LINUX SYSTEMS </caution>
1749         </section>
1750         <section xml:id="serversideinstallation-virtual">
1751                 <title>Installing Evergreen in Virtualized Unix Environments</title>
1752                 <para>Evergreen software currently runs as a native application on any of several well-known Linux distributions (e.g., <emphasis>Ubuntu</emphasis> and <emphasis>Debian</emphasis>). It does not run as a native application on the Windows operating system (e.g., WindowsXP, WindowsXP Professional, Windows7), but the software can be installed and run on Windows via a virtualized Unix-guest Operating System (using, for example, VirtualBox or VMware to emulate a Linux environment).</para>
1753                 <caution fileref="media/caution.png"> ADD CONTENT FOR INSTALLING EVERGREEN IN VIRTUALIZED UNIX ENVIRONMENTS </caution>
1754                 <section xml:id="serversideinstallation-virtualized-virtualbox">
1755                         <title>VirtualBox</title>
1756                         <caution fileref="media/caution.png"> ADD CONTENT FOR VirtualBox </caution>
1757                 </section>
1758                 <section xml:id="serversideinstallation-virtualized-vmware">
1759                         <title>VMware</title>
1760                         <caution fileref="media/caution.png"> ADD CONTENT FOR VMware </caution>
1761                 </section>
1762                 <section xml:id="serversideinstallation-virtualized-virtualpc">
1763                         <title>VirtualPC</title>
1764                         <caution fileref="media/caution.png"> ADD CONTENT FOR VirtualPC </caution>
1765                 </section>
1766         </section>
1767         <section xml:id="serversideinstallation-previousversions">
1768                 <title>Installing Previous Versions of Evergreen</title>
1769                 <para>Earlier releases of Evergreen are available. Instructions for installing, configuring and testing earlier versions are found below.</para>
1770                 <para>The next most recent previous release of Evergreen is version <emphasis><emphasis role="bold">1.4.0.6</emphasis></emphasis>. The accompanying previous release of OpenSRF is version <emphasis><emphasis role="bold">1.0.x</emphasis></emphasis>.</para>
1771                 <section xml:id="serversideinstallation-ubuntudebian-previous">
1772                         <title>Installing Evergreen 1.4.0.6 on Ubuntu or Debian</title>
1773                         <caution fileref="media/caution.png"> ADD CONTENT FOR INSTALLING EVERGREEN 1.4.0.6 ON UBUNTU OR DEBIAN </caution>
1774                 </section>
1775                 <section xml:id="serversideinstallation-opensrf-previous">
1776                         <title>Installing OpenSRF 1.0.x</title>
1777                         <caution fileref="media/caution.png"> ADD CONTENT FOR INSTALLING OPENSRF 1.0.x </caution>
1778                 </section>
1779         </section>
1780         <section xml:id="serversideinstallation-postgresql">
1781                 <title>Installing PostgreSQL</title>
1782                 <caution fileref="media/caution.png"> ADD CONTENT FOR POSTGRESQL </caution>
1783         </section>
1784         <section xml:id="serversideinstallation-apache">
1785                 <title>Apache</title>
1786                 <section>
1787                         <title>Securing Apache (httpd)</title>
1788                         <para>The main consideration is to secure the directory <emphasis>cgi-bin</emphasis>. The only persons that need access to this directory are Evergreen system administrators. This directory should be restricted by both IP (to those workstations designated as Evergeen Administration systems), and by username/password.</para>
1789                         <caution fileref="media/caution.png"> ADD CONTENT ON HOW TO RESTRICT APACHE BY IP AND USERNAME/PASSWORD </caution>
1790                         <para>A user could add new libraries, re-arrange consortia, or change user groups; or a staff member could access the directory, and change his associated security group to administrative level privileges.</para>
1791                 </section>
1792                 <caution fileref="media/caution.png"> ADD MORE CONTENT FOR APACHE </caution>
1793         </section>
1794         <section xml:id="serversideinstallation-memcached">
1795                 <title>memcached Servers</title>
1796                 <caution fileref="media/caution.png"> ADD CONTENT FOR MEMCACHED </caution>
1797         </section>
1798         <section xml:id="serversideinstallation-organizationandpolicy">
1799                 <title>Organization and Policy Editing</title>
1800                 <para>After installing Evergreen, you will want to make configuration changes to reflect the organizational hierarchy and the policies of your library or libraries. See the section <link linkend="serveradministration-orgunits">"Organizational Unit Types and Organizational Units"</link> for further information. Examples of what can be configured include:</para>
1801                 <itemizedlist>
1802                         <listitem>Adding a branch library</listitem>
1803                         <listitem>Changing circulation rules for an existing library</listitem>
1804                         <listitem>Adding a new staff position or user group</listitem>
1805                 </itemizedlist>
1806                 <caution fileref="media/caution.png"> ADD CONTENT FOR ORGANIZATION AND POLICY EDITING </caution>
1807         </section>
1808         <section xml:id="serversideinstallation-sip">
1809                 <title>Installing the SIP Server</title>
1810                 <caution fileref="media/caution.png"> ADD CONTENT FOR INSTALLING THE SIP SERVER </caution>
1811         </section>
1812         <section xml:id="serversideinstallation-nginx">
1813                 <title>Using nginx to serve static content</title>
1814                 <caution fileref="media/caution.png"> ADD CONTENT FOR USING NGINX TO SERVE STATIC CONTENT </caution>
1815         </section>
1816 </chapter>