review section "Installing OpenSRF", make simple tweaks;
[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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-all">"Installation of Server-Side Software"</link></emphasis></emphasis> for instructions tailored to installing on some particular distributions of the Linux operating system. Earlier software distributions are described in the section <emphasis><emphasis role="bold"><link linkend="serversideinstallation-previousversions"> "Installing Previous Versions of Evergreen" </link></emphasis></emphasis>.</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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-virtual">"Installing Evergreen in Virtualized Unix Environments"</link></emphasis></emphasis>.</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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-postgresql"> "Installing PostgreSQL" </link></emphasis></emphasis>, 
15 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-apache"> "Apache" </link></emphasis></emphasis> and
16 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-memcached"> "memcached Servers" </link></emphasis></emphasis>.
17 </para>
18                 <para>[[ FURTHER REFINEMENT NEEDED HERE ]]</para>
19                 <para>Finally, installation of the Evergreen Staff Client software is reviewed in the section <emphasis><emphasis role="bold"><link linkend="serversideinstallation-staffclient"> "Running the Evergreen Staff Client" </link></emphasis></emphasis>. </para>
20                 <section>
21                         <title>Evergreen Software Dependencies</title>
22                         <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>
23                         <figure>
24                                 <title>Evergreen software dependencies</title>
25                                 <informaltable>
26                                         <tgroup align="left" cols="3" colsep="1" rowsep="1">
27                                                 <colspec colname="Evergreen" colnum="1" colwidth="1*"/>
28                                                 <colspec colname="OpenSRF" colnum="2" colwidth="1*"/>
29                                                 <colspec colname="PostgreSQL" colnum="3" colwidth="1*"/>
30                                                 <thead>
31                                                         <row>
32                                                                 <entry>Evergreen</entry>
33                                                                 <entry>OpenSRF</entry>
34                                                                 <entry>PostgreSQL</entry>
35                                                         </row>
36                                                 </thead>
37                                                 <tbody>
38                                                         <row>
39                                                                 <entry>1.6.x</entry>
40                                                                 <entry>1.2</entry>
41                                                                 <entry>8.2 / 8.3</entry>
42                                                         </row>
43                                                 </tbody>
44                                                 <tbody>
45                                                         <row>
46                                                                 <entry>1.4.x</entry>
47                                                                 <entry>1.0</entry>
48                                                                 <entry>8.1 / 8.2</entry>
49                                                         </row>
50                                                 </tbody>
51                                                 <tbody>
52                                                         <row>
53                                                                 <entry>1.2.x</entry>
54                                                                 <entry>0.9</entry>
55                                                                 <entry>8.1 / 8.2</entry>
56                                                         </row>
57                                                 </tbody>
58                                         </tgroup>
59                                 </informaltable>
60                         </figure>
61                         <para>[[ VERIFY THE DEPENDENCIES IN THIS TABLE ]] </para>
62                 </section>
63                 <section>
64                         <title>Current Stable Software Release</title>
65                         <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-ubuntudebian"> "Installing Evergreen on Ubuntu or Debian" </link></emphasis></emphasis> .
66                         </para>
67                         <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-opensrf"> "Installing OpenSRF On Ubuntu or Debian" </link></emphasis></emphasis> .</para>
68                 </section>
69                 <section>
70                         <title>Previous Software Releases</title>
71                         <para>Earlier releases of Evergreen are also available. Instructions for installing, configuring and testing earlier versions are found in the section <emphasis><emphasis role="bold"><link linkend="serversideinstallation-previousversions"> "Installing Previous Versions of Evergreen" </link></emphasis></emphasis> .</para>
72                         <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-ubuntudebian-previous"> "Installing Evergreen 1.4.0.6 on Ubuntu or Debian" </link></emphasis></emphasis> .
73                         </para>
74                         <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-opensrf-previous"> "Installing OpenSRF 1.0.x" </link></emphasis></emphasis> .
75                         </para>
76                 </section>
77                 <section>
78                         <title>System Requirements</title>
79                         <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>
80                         <para> [[ ADD FURTHER CONTENT ON HARDWARE AND SOFTWARE REQUIREMENTS ]] </para>
81                         <para>
82                                 <screen>
83                                 From Dan Scott on [http://list.georgialibraries.org/pipermail/
84                                   open-ils-general/2007-July/000316.html|OPEN-ILS-GENERAL]:
85                                 On 8/11/07, lan ye &lt;lye at mail.slcl.org> wrote:
86                                 > We've been researching the Evergreen Open Source Library system,
87                                 > and would like to have a list of hardware requirements for the
88                                 > installation of a small test server. To keep things within a
89                                 > small budget, I would like to just use an ordinary PC. Could you
90                                 > send some information to us?
91         
92                                 For system requirements, it depends on how extensive you want your
93                                 tests to be. Evergreen and all of the pieces it depends on
94                                 (PostgreSQL, Apache, Ejabberd) run happily in a VMWare image
95                                 allocated 512MB of RAM on my laptop with just the Project
96                                 Gutenberg e-books loaded, and that's enough to evaluate the OPAC
97                                 interface / try out the staff client / make some local changes and
98                                 generally experiment. But I'm not going to load one million bib
99                                 records into that system and expect it to perform. So, probably
100                                 any hardware you have lying around would be adequate for a small
101                                 test server.
102         
103                                 > It looks like Evergreen has been successfully installed on two
104                                 > Linux systems: Gentoo and Ubuntu. Which one is the best for us
105                                 > to test using what's already in place at other libraries? Are
106                                 > there any differences / Advantages in functionality between
107                                 > Gentoo and Ubuntu?
108         
109                                 As John said, GPLS is running on Debian, and that's the only
110                                 Evergreen system that is in production at the moment. However, the
111                                 documentation for installing on Debian is a bit scattered right
112                                 now. The developers themselves used Gentoo originally, and that's
113                                 what I'm using at the moment &amp; have documented in the wiki;
114                                 the install process on Ubuntu is very thoroughly documented and
115                                 Ubuntu is reasonably close to Debian.  
116                                 See http://open-ils.org/dokuwiki/doku.php?id=server_installation 
117                                 for the list of install instructions for various distributions.
118         
119                                 As for advantages / disadvantages of particular distributions,
120                                 that's a religious war that I don't want to step into... We'll try
121                                 to help you out no matter what distribution you choose; just
122                                 please choose a current release :)
123         
124                                 -- 
125                                 Dan Scott
126                                 Laurentian University
127                                 </screen>
128                                 <screen>
129                                 And from James Fournie in that same [http://list.georgialibraries.org/
130                                   pipermail/open-ils-general/2007-July/000317.html|thread]:
131                                 We are running a test Ubuntu server on a ~1ghz Celeron PC with
132                                 512mb RAM.  It seems to be ok handling the Gutenberg samples, and
133                                 our collection of about 8000 records. We did have serious problems
134                                 using anything less than 512mb RAM. Also, I tried Evergreen on a
135                                 K6 II 350, but it wasn't pretty.
136         
137                                 James Fournie
138                                 Digitization Librarian
139                                 Union of B.C. Indian Chiefs
140                                 </screen>
141                         </para>
142                 </section>
143                 <section>
144                         <title>Example System Architectures</title>
145                         <para>This sections describes examples of some working Evergreen system architectures, including both server-side software and Staff Client software.</para>
146                         <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>
147                         <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>
148                         <section xml:id="serversideinstallation-example-pines">
149                                 <title>PINES</title>
150                                 <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>
151                                 <para>[[ ADD FURTHER INFORMATION ON PINES ]] </para>
152                         </section>
153                         <section xml:id="serversideinstallation-example-sitka">
154                                 <title>Sitka</title>
155                                 <para>[[ ADD FURTHER INFORMATION ON SITKA ]] </para>
156                         </section>
157                         <section xml:id="serversideinstallation-example-other">
158                                 <title>Other working systems</title>
159                                 <para>[[ ADD FURTHER INFORMATION ON OTHER WORKING SYSTEMS ]] </para>
160                         </section>
161                 </section>
162         </section>
163         <section xml:id="serversideinstallation-all">
164                 <title>Installation of Server-Side Software</title>
165                 <para>This section describes the installation of the major components of Evergreen server-side software.</para>
166                 <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 <emphasis><emphasis role="bold"><link linkend="adminmisc-backingup"> "Backing Up" </link></emphasis></emphasis>  for further information.</para>
167                 <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>
168                 <section xml:id="serversideinstallation-opensrf">
169                         <title>Installing OpenSRF On Ubuntu or Debian</title>
170                         <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>
171                         <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>
172                         <note>
173                                 <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>
174                                 <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>
175                                 <itemizedlist>
176                                         <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>
177                                         <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>
178                                 </itemizedlist>
179                                 <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>
180                         </note>
181                         <section>
182                                 <title>Add the OpenSRF User</title>
183                                 <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>
184                                 <figure>
185                                         <title>Adding the user "opensrf"</title>
186                                         <screen>
187                                         $ su - opensrf
188                                         $ useradd -m -s /bin/bash opensrf
189                                         $ passwd opensrf
190                                         Enter new UNIX password: ******
191                                         Retype new UNIX password: ******
192                                         passwd: password updated successfully
193                                         $
194                                         </screen>
195                                 </figure>
196                         </section>
197                         <section>
198                                 <title>Download and Unpack Latest OpenSRF Version</title>
199                                 <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>
200                                 <figure>
201                                         <title>Commands to download and unpack OpenSRF</title>
202                                         <screen>
203                                         $ su - opensrf
204                                         $ wget http://evergreen-ils.org/downloads/OpenSRF-1.2.2.tar.gz
205                                         $ tar zxf OpenSRF-1.2.2.tar.gz
206                                         </screen>
207                                 </figure>
208                                 <para>The new directory <emphasis>/home/opensrf/OpenSRF-1.2.2</emphasis> will be created.</para>
209                         </section>
210                         <section>
211                                 <title>Install Prerequisites to Build OpenSRF</title>
212                                 <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>
213                                 <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 <emphasis>Figure 1.5</emphasis>.</para>
214                                 <figure>
215                                         <title>Commands to install prerequisites for OpenSRF</title>
216                                         <screen>
217                                         $ su - root
218                                         $ cd /home/opensrf/OpenSRF-1.2.2
219                                         $ make -f src/extras/Makefile.install [distribution]
220                                         </screen>
221                                 </figure>
222                                 <figure>
223                                         <title>Keywords used with "make"</title>
224                                         <informaltable>
225                                                 <tgroup align="left" cols="2" colsep="1" rowsep="1">
226                                                         <colspec colname="keyword" colnum="1" colwidth="1*"/>
227                                                         <colspec colname="description" colnum="2" colwidth="1*"/>
228                                                         <thead>
229                                                                 <row>
230                                                                         <entry>Keyword</entry>
231                                                                         <entry>Description</entry>
232                                                                 </row>
233                                                         </thead>
234                                                         <tbody>
235                                                                 <row>
236                                                                         <entry>debian-lenny</entry>
237                                                                         <entry>for Debian Lenny (5.0)</entry>
238                                                                 </row>
239                                                         </tbody>
240                                                         <tbody>
241                                                                 <row>
242                                                                         <entry>debian-etch</entry>
243                                                                         <entry>for Debian Etch (4.0)</entry>
244                                                                 </row>
245                                                         </tbody>
246                                                         <tbody>
247                                                                 <row>
248                                                                         <entry>ubuntu-karmic</entry>
249                                                                         <entry>for Ubuntu Karmic (9.10)</entry>
250                                                                 </row>
251                                                         </tbody>
252                                                         <tbody>
253                                                                 <row>
254                                                                         <entry>ubuntu-intrepid</entry>
255                                                                         <entry>for Ubuntu Jaunty (9.04) or Intrepid (8.10)</entry>
256                                                                 </row>
257                                                         </tbody>
258                                                         <tbody>
259                                                                 <row>
260                                                                         <entry>ubuntu-hardy</entry>
261                                                                         <entry>for Ubuntu Hardy (8.04)</entry>
262                                                                 </row>
263                                                         </tbody>
264                                                 </tgroup>
265                                         </informaltable>
266                                 </figure>
267                                 <para>[[ ADD INFO FOR OTHER LINUX DISTRIBUTIONS ]]</para>
268                                 <para>This will install a number of packages required by OpenSRF on your system, 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>
269                         </section>
270                         <section>
271                                 <title>Configure OpenSRF</title>
272                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, return to your build directory and configure OpenSRF by using 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 want to include support for Python and Java, respectively:</para>
273                                 <figure>
274                                         <title>Commands to configure OpenSRF</title>
275                                         <screen>
276                                         $ su - opensrf
277                                         $ cd /home/opensrf/OpenSRF-1.2.2
278                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf
279                                         $ make
280                                         </screen>
281                                 </figure>
282                         </section>
283                         <section>
284                                 <title>Compile, Link and Install OpenSRF</title>
285                                 <para>As the <emphasis role="bold">root</emphasis> user, return to your build directory and compile, link and install OpenSRF:</para>
286                                 <figure>
287                                         <title>Commands to build, link and install OpenSRF</title>
288                                         <screen>
289                                         $ su - opensrf
290                                         $ cd /home/opensrf/OpenSRF-1.2.2
291                                         $ make install
292                                         </screen>
293                                 </figure>
294                         </section>
295                         <section>
296                                 <title>Update the System Dynamic Library Path</title>
297                                 <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>
298                                 <figure>
299                                         <title>Commands to modify system dynamic library path</title>
300                                         <screen>
301                                         $ su - root
302                                         $ echo "/openils/lib" > /etc/ld.so.conf.d/osrf.conf
303                                         $ ldconfig
304                                         </screen>
305                                 </figure>
306                         </section>
307                         <section>
308                                 <title>Define Public and Private OpenSRF Domains</title>
309                                 <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>
310                                 <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>
311                                 <figure>
312                                         <title>Adding public and private domains to /etc/hosts</title>
313                                         <screen>
314                                         127.0.1.2       public.localhost        public
315                                         127.0.1.3       private.localhost       private
316                                         </screen>
317                                 </figure>
318                         </section>
319                         <section>
320                                 <title>Change file ownerships</title>
321                                 <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>
322                                 <figure>
323                                         <title>Changing file ownerships in /openils</title>
324                                         <screen>
325                                         $ chown -R opensrf:opensrf /openils
326                                         </screen>
327                                 </figure>
328                         </section>
329                         <section>
330                                 <title>Stop the "ejabberd" service</title>
331                                 <para>As the <emphasis role="bold">root</emphasis> user, stop the "ejabberd" service:</para>
332                                 <figure>
333                                         <title>Stopping the "ejabberd" service</title>
334                                         <screen>
335                                         $ /etc/init.d/ejabberd stop
336                                         </screen>
337                                 </figure>
338                                 <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>
339                                 <figure>
340                                         <title>Recovering from "ejabberd" error</title>
341                                         <screen>
342                                         $ su - root
343                                         $ epmd -kill
344                                         $ killall beam; killall beam.smp
345                                         $ rm /var/lib/ejabberd/*
346                                         $ echo 'ERLANG_NODE=ejabberd@localhost' >> /etc/default/ejabberd
347                                         </screen>
348                                 </figure>
349                         </section>
350                         <section>
351                                 <title>Edit the "ejabberd" configuration</title>
352                                 <para>As the <emphasis role="bold">root</emphasis> user, edit the file <emphasis>/etc/ejabberd/ejabberd.cfg</emphasis> and make the following changes:</para>
353                                 <itemizedlist>
354                                         <listitem>Change <emphasis role="bold">{hosts, ["localhost"]}.</emphasis>  to <emphasis role="bold">{hosts, ["localhost", "private.localhost", "public.localhost"]}.</emphasis></listitem>
355                                         <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>
356                                         <listitem>Change all three occurrences of <emphasis role="bold">max_stanza_size</emphasis> to <emphasis role="bold">2000000</emphasis>.</listitem>
357                                         <listitem>Change both occurrences of <emphasis role="bold">maxrate</emphasis> to <emphasis role="bold">500000</emphasis>.       </listitem>
358                                         <listitem>Comment out the line <emphasis role="bold">{mod_offline, []}</emphasis>  by placing two <emphasis role="bold">%</emphasis> comment signs in front.</listitem>
359                                 </itemizedlist>
360                         </section>
361                         <section>
362                                 <title>Restart the "ejabberd" service</title>
363                                 <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>
364                                 <figure>
365                                         <title>Restarting the "ejabberd" service</title>
366                                         <screen>
367                                         $ /etc/init.d/ejabberd start
368                                         </screen>
369                                 </figure>
370                         </section>
371                         <section>
372                                 <title>Register "router" and "ejabberd" users</title>
373                                 <para>On each domain, you need two "ejabberd" users to manage the OpenSRF communications:</para>
374                                 <itemizedlist>
375                                         <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>
376                                         <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>
377                                 </itemizedlist>
378                                 <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>
379                                 <figure>
380                                         <title>Registering "router" and "ejabberd" users</title>
381                                         <screen>
382                                         # Syntax for registering a user with ejabberdctl:
383                                         #    ejabberdctl register &lt;user> &lt;domain> &lt;password>
384                                         #
385                                         $ ejabberdctl register router private.localhost &lt;password>
386                                         $ ejabberdctl register opensrf private.localhost &lt;password>
387                                         $ ejabberdctl register router public.localhost &lt;password>
388                                         $ ejabberdctl register opensrf public.localhost &lt;password>
389                                         </screen>
390                                 </figure>
391                         </section>
392                         <section>
393                                 <title>Create configuration files</title>
394                                 <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>
395                                 <figure>
396                                         <title>Creating configuration files</title>
397                                         <screen>
398                                         $ su - root
399                                         $ cd /openils/conf
400                                         $ cp opensrf.xml.example      opensrf.xml
401                                         $ cp opensrf_core.xml.example opensrf_core.xml
402                                         </screen>
403                                 </figure>
404                         </section>
405                         <section>
406                                 <title>Edit opensrf_core.xml</title>
407                                 <para>Edit the file <emphasis>/openils/conf/opensrf_core.xml</emphasis> to change the "ejabberd" usernames and passwords as follows.</para>
408                                 <note>
409                                         <para>
410                                                 <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>
411                                         </para>
412                                 </note>
413                                 <figure>
414                                         <title>Updates needed to the file "/openils/conf/opensrf_core.xml"</title>
415                                         <screen>
416                                         /config/opensrf/username = opensrf
417
418                                         /config/opensrf/passwd = password for "private.localhost" opensrf user
419
420                                         /config/gateway/username = opensrf
421
422                                         /config/gateway/passwd = password for "public.localhost" opensrf user
423
424                                         # first entry, where "transport/server" == "public.localhost" :
425                                         /config/routers/router/transport 
426                                             username = router
427                                             password = password for "public.localhost" router user
428
429                                         # second entry, where "transport/server" == "private.localhost" :
430                                         /config/routers/router/transport
431                                             username = router
432                                             password = password for "private.localhost" router user
433                                         </screen>
434                                 </figure>
435                                 <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>
436                         </section>
437                         <section>
438                                 <title>Modify the file "opensrf.xml"</title>
439                                 <para>Modify the file <emphasis>/openils/conf/opensrf.xml</emphasis>.</para>
440                                 <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>
441                                 <figure>
442                                         <title>Modify the file "opensrf.xml"</title>
443                                         <screen>
444                                         &lt;!-- Example of an app-specific setting override -->
445                                         &lt;opensrf.persist>
446                                           &lt;app_settings>
447                                             &lt;dbfile>/tmp/persist.db&lt;/dbfile>
448                                           &lt;/app_settings>
449                                         &lt;/opensrf.persist>
450                                         </screen>
451                                 </figure>
452                         </section>
453                         <section>
454                                 <title>Create Configuration Files for Users Needing srfsh</title>
455                                 <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>
456                                 <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-testing"> "Testing the Installation" </link></emphasis></emphasis> for further information.</para>
457                                 <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>
458                                 <itemizedlist>
459                                         <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>
460                                         <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>
461                                         <listitem>Modify <emphasis role="bold">logfile</emphasis> to be the full path for a log file to which the user has write access</listitem>
462                                         <listitem>Modify <emphasis role="bold">loglevel</emphasis> as needed for testing</listitem>
463                                 </itemizedlist>
464                                 <figure>
465                                         <title>Sample of configuration file /openils/conf/srfsh.xml.example</title>
466                                         <screen>
467                                         &lt;?xml version="1.0"?>
468                                         &lt;!-- This file follows the standard bootstrap config file layout -->
469                                         &lt;!-- found in opensrf_core.xml -->
470                                         &lt;srfsh>
471                                         &lt;router_name>router&lt;/router_name>
472                                         &lt;domain>private.localhost&lt;/domain>
473                                         &lt;username>opensrf&lt;/username>
474                                         &lt;passwd>privsrf&lt;/passwd>
475                                         &lt;port>5222&lt;/port>
476                                         &lt;logfile>/tmp/srfsh.log&lt;/logfile>
477                                         &lt;!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->
478                                         &lt;loglevel>4&lt;/loglevel>
479                                         &lt;/srfsh>
480                                         </screen>
481                                 </figure>
482                         </section>
483                         <section>
484                                 <title>Modify environmental variable PATH for "opensrf" user</title>
485                                 <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>
486                                 <figure>
487                                         <title>Adding path to ".bashrc" configuration file</title>
488                                         <screen>
489                                         $ su - opensrf
490                                         $ echo "export PATH=/openils/bin:\$PATH" >> ~/.bashrc
491                                         </screen>
492                                 </figure>
493                         </section>
494                         <section>
495                                 <title>Starting OpenSRF</title>
496                                 <para>As the <emphasis role="bold">root</emphasis> user, start the "ejabberd" and "memcached" services:</para>
497                                 <figure>
498                                         <title>Starting some services</title>
499                                         <screen>
500                                         $ su - root
501                                         $ /etc/init.d/ejabberd start
502                                         $ /etc/init.d/memcached start
503                                         </screen>
504                                 </figure>
505                                 <para/>
506                                 <para>Finally, as the <emphasis role="bold">opensrf</emphasis> user, start OpenSRF:</para>
507                                 <figure>
508                                         <title>Starting OpenSRF</title>
509                                         <screen>
510                                         $ su - opensrf
511
512                                         # ensure you have the needed path
513                                         $ export PATH=$PATH:/openils/bin
514
515                                         # start the OpenSRF service:
516                                         # use "-l" to force hostname to be "localhost"
517                                         $ osrf_ctl.sh -l -a start_all     
518                                         </screen>
519                                 </figure>
520                                 <note>
521                                         <para>
522                                                 <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>
523                                         </para>
524                                 </note>
525                         </section>
526                         <section>
527                                 <title>Testing connections to OpenSRF</title>
528                                 <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>
529                                 <figure>
530                                         <title>Testing OpenSRF with "srfsh"</title>
531                                         <screen>
532                                         $ su - opensrf
533                                         $ /openils/bin/srfsh
534                                         srfsh#  request opensrf.math add 2 2
535                                         Received Data: 4
536                                         ------------------------------------
537                                         Request Completed Successfully
538                                         Request Time in seconds: 0.007519
539                                         ------------------------------------
540                                         srfsh#
541                                         </screen>
542                                 </figure>
543                                 <para>[[ VERIFY THIS TEST ]]</para>
544                                 <para>For other srfsh commands, type 'help' in at the prompt.</para>
545                         </section>
546                         <section>
547                                 <title>Stopping OpenSRF</title>
548                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, stop OpenSRF:</para>
549                                 <figure>
550                                         <title>Stopping OpenSRF</title>
551                                         <screen>
552                                         $ su - opensrf
553                                         $ osrf_ctl.sh -l -a stop_all
554                                         </screen>
555                                 </figure>
556                         </section>
557                 </section>
558                 <section xml:id="serversideinstallation-ubuntudebian">
559                         <title>Installing Evergreen On Ubuntu or Debian</title>
560                         <para>This section outlines the installation process for the latest stable version of Evergreen (1.6.0.7).</para>
561                         <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>
562                         <note>
563                                 <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>
564                                 <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>
565                                 <itemizedlist>
566                                         <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>
567                                         <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>
568                                 </itemizedlist>
569                                 <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>
570                         </note>
571                         <section xml:id="serversideinstallation-opensrf-overview">
572                                 <title>Installing OpenSRF</title>
573                                 <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-opensrf"> "Installing OpenSRF" </link></emphasis></emphasis>.</para>
574                                 <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>
575                         </section>
576                         <section>
577                                 <title>Download and Unpack Latest Evergreen Version</title>
578                                 <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>
579                                 <figure>
580                                         <title>Commands to download and unpack Evergreen</title>
581                                         <screen>
582                                         $ su - opensrf
583                                         $ wget http://evergreen-ils.org/downloads/Evergreen-ILS-1.6.0.7.tar.gz
584                                         $ tar zxf Evergreen-ILS-1.6.0.7.tar.gz
585                                         </screen>
586                                 </figure>
587                                 <para>The new directory <emphasis>/home/opensrf/Evergreen-ILS-1.6.0.1</emphasis> will be created.</para>
588                         </section>
589                         <section>
590                                 <title>Install Prerequisites to Build Evergreen</title>
591                                 <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>
592                                 <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 <emphasis> Figure 1.26</emphasis>.</para>
593                                 <figure>
594                                         <title>Commands to install prerequisites for Evergreen</title>
595                                         <screen>
596                                         $ su - root
597                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
598                                         $ make -f Open-ILS/src/extras/Makefile.install [distribution]
599                                         </screen>
600                                 </figure>
601                                 <figure>
602                                         <title>Keywords used with "make"</title>
603                                         <informaltable>
604                                                 <tgroup align="left" cols="2" colsep="1" rowsep="1">
605                                                         <colspec colname="keyword" colnum="1" colwidth="1*"/>
606                                                         <colspec colname="description" colnum="2" colwidth="1*"/>
607                                                         <thead>
608                                                                 <row>
609                                                                         <entry>Keyword</entry>
610                                                                         <entry>Description</entry>
611                                                                 </row>
612                                                         </thead>
613                                                         <tbody>
614                                                                 <row>
615                                                                         <entry>debian-lenny</entry>
616                                                                         <entry>for Debian Lenny (5.0), the most recent version</entry>
617                                                                 </row>
618                                                         </tbody>
619                                                         <tbody>
620                                                                 <row>
621                                                                         <entry>debian-etch</entry>
622                                                                         <entry>for Debian Etch (4.0)</entry>
623                                                                 </row>
624                                                         </tbody>
625                                                         <tbody>
626                                                                 <row>
627                                                                         <entry>ubuntu-karmic</entry>
628                                                                         <entry>for Ubuntu Lucid (10.04) [same as for Karmic]</entry>
629                                                                 </row>
630                                                         </tbody>
631                                                         <tbody>
632                                                                 <row>
633                                                                         <entry>ubuntu-karmic</entry>
634                                                                         <entry>for Ubuntu Karmic (9.10)</entry>
635                                                                 </row>
636                                                         </tbody>
637                                                         <tbody>
638                                                                 <row>
639                                                                         <entry>ubuntu-intrepid</entry>
640                                                                         <entry>for Ubuntu Intrepid (8.10)</entry>
641                                                                 </row>
642                                                         </tbody>
643                                                         <tbody>
644                                                                 <row>
645                                                                         <entry>ubuntu-hardy</entry>
646                                                                         <entry>for Ubuntu Hardy (8.04)</entry>
647                                                                 </row>
648                                                         </tbody>
649                                                         <tbody>
650                                                                 <row>
651                                                                         <entry>ubuntu-gutsy</entry>
652                                                                         <entry>for Ubuntu Gutsy (7.10)</entry>
653                                                                 </row>
654                                                         </tbody>
655                                                         <tbody>
656                                                                 <row>
657                                                                         <entry>gentoo</entry>
658                                                                         <entry>generic for Gentoo versions</entry>
659                                                                 </row>
660                                                         </tbody>
661                                                         <tbody>
662                                                                 <row>
663                                                                         <entry>centos</entry>
664                                                                         <entry>generic for Centos versions</entry>
665                                                                 </row>
666                                                         </tbody>
667                                                 </tgroup>
668                                         </informaltable>
669                                 </figure>
670                                 <para>[[ ADD INFO FOR OTHER LINUX DISTRIBUTIONS ]]</para>
671                         </section>
672                         <section>
673                                 <title>(OPTIONAL) Install the PostgreSQL Server</title>
674                                 <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>
675                                 <para>For further information on installing PostgreSQL, see the section <emphasis><emphasis role="bold"><link linkend="serversideinstallation-postgresql"> "Installing PostgreSQL" </link></emphasis></emphasis>.</para>
676                                 <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>
677                                 <figure>
678                                         <title>Commands to install the PostgreSQL server</title>
679                                         <screen>
680                                         $ su - root
681         
682                                         # Debian Lenny and Ubuntu Hardy (8.04)
683                                         $ make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_83
684         
685                                         # Ubuntu Karmic (9.10) and Ubuntu Lucid (10.04)
686                                         $ make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_84
687                                         </screen>
688                                 </figure>
689                                 <note>
690                                         <para>
691                                                 <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>
692                                         </para>
693                                 </note>
694                                 <para>[[ VERIFY: IS THIS STILL TRUE? ]]</para>
695                                 <para>[[ ADD INFO ON HOW TO DETERMINE WHICH VERSION OF POSTGRESQL YOU HAVE ]]</para>
696                         </section>
697                         <section>
698                                 <title>(OPTIONAL) Install Perl Modules on PostgreSQL Server</title>
699                                 <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>
700                                 <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>
701                                 <figure>
702                                         <title>Commands to install Perl modules</title>
703                                         <screen>
704                                         # ensure the gcc compiler is installed
705                                         $ su - root
706                                         $ aptitude install gcc
707         
708                                         # install the Perl modules
709                                         $ perl -MCPAN -e shell
710                                         cpan> install JSON::XS
711                                         cpan> install MARC::Record
712                                         cpan> install MARC::File::XML
713                                         </screen>
714                                 </figure>
715                                 <para>[[ ADD INFO ON HOW TO INSTALL THE PERL MODULES ]]</para>
716                                 <para>[[ ADD INFO ON HOW TO VERIFY THAT THE PERL MODULES ARE INSTALLED ]]</para>
717                         </section>
718                         <section>
719                                 <title>Update the System Dynamic Library Path</title>
720                                 <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>
721                                 <figure>
722                                         <title>Commands to modify system dynamic library path</title>
723                                         <screen>
724                                         $ su - root
725                                         $ cat > /etc/ld.so.conf.d/eg.conf &lt;&lt; ENDOFFILE
726                                         /usr/local/lib
727                                         /usr/local/lib/dbd
728                                         ENDOFFILE
729                                         $ ldconfig
730                                         </screen>
731                                 </figure>
732                         </section>
733                         <section>
734                                 <title>(OPTIONAL) Restart the PostgreSQL Service</title>
735                                 <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>
736                                 <para>[[ ADD INFO ON OTHER VERSIONS OF POSTGRESQL ]]</para>
737                                 <figure>
738                                         <title>Commands to restart PostgreSQL service</title>
739                                         <screen>
740                                         $ su - root
741                                         $ /etc/init.d/postgresql-8.3 restart
742                                         </screen>
743                                 </figure>
744                         </section>
745                         <section>
746                                 <title>Configure and Evergreen</title>
747                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, return to your build directory and configure Evergreen by using the utility "configure" to prepare for the next step of compiling and linking the software:</para>
748                                 <figure>
749                                         <title>Commands to configure Evergreen</title>
750                                         <screen>
751                                         $ su - opensrf
752                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
753                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf
754                                         $ make
755                                         </screen>
756                                 </figure>
757                         </section>
758                         <section>
759                                 <title>Compile, Link and Install Evergreen</title>
760                                 <para>As the <emphasis role="bold">root</emphasis> user, return to your build directory and compile, link and install Evergreen.</para>
761                                 <para>In the following commands, 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. Finally, create a symbolic link named <emphasis role="bold">server</emphasis> in the directory <emphasis role="bold">/openils/var/web/xul</emphasis> to the <emphasis role="bold">/server</emphasis> subdirectory of your Staff Client build:</para>
762                                 <figure>
763                                         <title>Commands  to build, link and install Evergreen</title>
764                                         <screen>
765                                         $ su - root
766                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
767                                         $ make STAFF_CLIENT_BUILD_ID=rel_1_6_0_6 install
768                                         $ cd /openils/var/web/xul
769                                         $ ln -sf rel_1_6_0_7/server server
770                                         </screen>
771                                 </figure>
772                         </section>
773                         <section>
774                                 <title>Copy the OpenSRF Configuration Files</title>
775                                 <para>As the <emphasis role="bold">root</emphasis> user, copy the example OpenSRF configuration files into place. This will replace the OpenSRF configuration files that you set up while installing and testing 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>
776                                 <figure>
777                                         <title>Commands to copy OpenSRF configuration files</title>
778                                         <screen>
779                                         $ su - root
780                                         $ cp /openils/conf/opensrf.xml.example      /openils/conf/opensrf.xml
781                                         $ cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
782                                         $ cp /openils/conf/oils_web.xml.example     /openils/conf/oils_web.xml
783                                         $ chown -R opensrf:opensrf /openils/
784                                         </screen>
785                                 </figure>
786                         </section>
787                         <section>
788                                 <title>Create and configure PostgreSQL Database</title>
789                                 <para>As the <emphasis role="bold">postgres</emphasis> user on your PostgreSQL server, create the Evergreen database.</para>
790                                 <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>
791                                 <orderedlist>
792                                         <listitem>
793                                                 <para>
794                                                         <emphasis role="bold">Create and configure the database</emphasis>
795                                                 </para>
796                                                 <para>As the <emphasis role="bold">postgres</emphasis> user on the PostgreSQL system create the PostgreSQL database, then set some internal paths:</para>
797                                                 <figure>
798                                                         <title>Commands to create database and adjust the path</title>
799                                                         <screen>
800                                                         # create the database
801                                                         $ su - postgres
802                                                         $ createdb -E UNICODE evergreen
803                                                         $ createlang plperl   evergreen
804                                                         $ createlang plperlu  evergreen
805                                                         $ createlang plpgsql  evergreen
806                 
807                                                         # adjust the paths
808                                                         $ psql -f /usr/share/postgresql/8.3/contrib/tablefunc.sql evergreen
809                                                         $ psql -f /usr/share/postgresql/8.3/contrib/tsearch2.sql  evergreen
810                                                         $ psql -f /usr/share/postgresql/8.3/contrib/pgxml.sql     evergreen
811                                                         </screen>
812                                                 </figure>
813                                         </listitem>
814                                         <listitem>
815                                                 <para><emphasis role="bold">Create new Evergreen superuser</emphasis> </para>
816                                                 <para>As the <emphasis role="bold">postgres</emphasis> user on the PostgreSQL system, create the new user <emphasis role="bold"> evergreen </emphasis>:</para>
817                                                 <figure>
818                                                         <title>Commands to create the 'evergreen' user</title>
819                                                         <screen>
820                                                         # create superuser 'evergreen' and set the password
821                                                         $ su - postgres
822                                                         $ createuser -P -s evergreen
823                                                         Enter password for new role:  mynewpassword
824                                                         Enter it again:  mynewpassword
825                                                         </screen>
826                                                 </figure>
827                                         </listitem>
828                                 </orderedlist>
829                         </section>
830                         <section>
831                                 <title>Create Database Schema</title>
832                                 <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>
833                                 <para>Enter the commands and replace <emphasis>[HOSTNAME], [PORT], [USER], [PASSWORD]</emphasis> and <emphasis>[DATABASENAME]</emphasis> with appropriate values.</para>
834                                 <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>
835                                 <figure>
836                                         <title>Commands to create Evergreen database schema</title>
837                                         <screen>
838                                         $ su - root
839                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
840                                         $ perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
841                                                 --service all --create-schema --create-bootstrap --create-offline \
842                                                 --hostname [HOSTNAME] --port [PORT] \
843                                                 --user [USER] --password [PASSWORD] --database [DATABASENAME]
844                                         </screen>
845                                 </figure>
846                                 <note>
847                                         <para>
848                                                 <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>
849                                         </para>
850                                 </note>
851                         </section>
852                         <section>
853                                 <title>Configure the Apache Server</title>
854                                 <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>
855                                 <figure>
856                                         <title>Commands to configure the Apache server</title>
857                                         <screen>
858                                         # configure the Apache server
859                                         $ su - root
860                                         $ a2enmod ssl        # enable mod_ssl
861                                         $ a2enmod rewrite    # enable mod_rewrite
862                                         $ a2enmod expires    # enable mod_expires
863                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7
864         
865                                         # copy files
866                                         $ cp Open-ILS/examples/apache/eg.conf       /etc/apache2/sites-available/
867                                         $ cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/
868                                         $ cp Open-ILS/examples/apache/startup.pl    /etc/apache2/
869                                         </screen>
870                                 </figure>
871                         </section>
872                         <section>
873                                 <title>Create a Security Certificate (SSL Key)</title>
874                                 <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>
875                                 <figure>
876                                         <title>Commands to create an SSL key</title>
877                                         <screen>
878                                         $ mkdir /etc/apache2/ssl
879                                         $ cd /etc/apache2/ssl
880                                         $ openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
881                                         </screen>
882                                 </figure>
883                                 <warning>
884                                         <para>
885                                                 <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>
886                                         </para>
887                                 </warning>
888                                 <para> [[ ADD INFO ON HOW TO GET A SIGNED SSL CERTIFICATE ]] </para>
889                         </section>
890                         <section xml:id="serversideinstallation-modify-apache">
891                                 <title>Modify the Apache Configuration File</title>
892                                 <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>
893                                 <itemizedlist>
894                                         <listitem>
895                                                 <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>
896                                                 <para>
897                                                         <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>
898                                                 </para>
899                                                 <warning>
900                                                         <para>
901                                                                 <emphasis>You must remove these changes after testing is completed. See the section <emphasis><emphasis role="bold"><link linkend="serversideinstallation-postinstallation"> "Post-Installation Chores" </link></emphasis></emphasis> for further details on removing this change after the Evergreen installation is complete.</emphasis>
902                                                         </para>
903                                                 </warning>
904                                         </listitem>
905                                         <listitem>
906                                                 <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>
907                                                 <para> [[ ADD INFO ON WHY DEBIAN ETCH USERS SHOULD NOT DO THIS ]] </para>
908                                         </listitem>
909                                         <listitem>
910                                                 <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>
911                                                 <para> [[ ADD INFO ON WHETHER THIS IS STILL NECESSARY ]] </para>
912                                                 <orderedlist>
913                                                         <listitem>
914                                                                 <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>
915                                                                 <screen>www-data</screen>
916                                                                 <para>to the user:</para>
917                                                                 <screen>opensrf</screen>
918                                                         </listitem>
919                                                         <listitem>
920                                                                 <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>
921                                                                 <screen>export APACHE_RUN_USER=www-data</screen>
922                                                                 <para>to the phrase:</para>
923                                                                 <screen>export APACHE_RUN_USER=opensrf</screen>
924                                                         </listitem>
925                                                 </orderedlist>
926                                         </listitem>
927                                         <listitem>
928                                                 <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>
929                                         </listitem>
930                                 </itemizedlist>
931                         </section>
932                         <section>
933                                 <title>(OPTIONAL) Performance Modifications for Apache</title>
934                                 <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>
935                                 <itemizedlist>
936                                         <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>
937                                         <listitem>
938                                                 <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>
939                                                 <figure>
940                                                         <title>(OPTIONAL) Updates to Apache configuration</title>
941                                                         <screen>
942                                                         &lt;IfModule mpm_prefork_module>
943                                                            StartServers           20
944                                                            MinSpareServers         5
945                                                            MaxSpareServers        15
946                                                            MaxClients            150
947                                                            MaxRequestsPerChild 10000
948                                                         &lt;/IfModule>
949                                                         
950                                                         MaxKeepAliveRequests 100
951                                                         </screen>
952                                                 </figure>
953                                         </listitem>
954                                 </itemizedlist>
955                         </section>
956                         <section>
957                                 <title>Enable the Evergreen Site</title>
958                                 <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>
959                                 <figure>
960                                         <title>Apache Commands to Enable the Evergreen Web Site</title>
961                                         <screen>
962                                         $ su - root
963         
964                                         # disables the default site (i.e., the "It Works" page).
965                                         $ a2dissite default
966         
967                                         # enables the Evergreen web site
968                                         $ a2ensite eg.conf
969                                         </screen>
970                                 </figure>
971                         </section>
972                         <section>
973                                 <title>Modify the OpenSRF Configuration File</title>
974                                 <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>
975                                 <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>
976                                 <note>
977                                         <para>
978                                                 <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>
979                                         </para>
980                                 </note>
981                                 <para>[[ ADD A BETTER DIAGRAM HERE ]]</para>
982                                 <figure>
983                                         <title>Updates needed to the file "/openils/conf/opensrf_core.xml"</title>
984                                         <screen>
985                                         /config/opensrf/username  = opensrf
986         
987                                         /config/opensrf/passwd    = password for "private.localhost" opensrf user
988         
989                                         /config/gateway/username  = opensrf
990         
991                                         /config/gateway/passwd    = password for "public.localhost" opensrf user
992         
993                                         # first entry, where "transport/server" == "public.localhost" :
994                                         /config/routers/router/transport 
995                                             username = router
996                                             password = password for "public.localhost" router user
997
998                                         # second entry, where "transport/server" == "private.localhost" :
999                                         /config/routers/router/transport
1000                                             username = router
1001                                             password = password for "private.localhost" router user
1002                                         </screen>
1003                                 </figure>
1004                         </section>
1005                         <section>
1006                                 <title>Create Configuration Files for Users Needing srfsh</title>
1007                                 <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-testing"> "Testing the Installation" </link></emphasis></emphasis> for further information.</para>
1008                                 <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>
1009                                 <itemizedlist>
1010                                         <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>
1011                                         <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>
1012                                         <listitem>Modify <emphasis role="bold">logfile</emphasis> to be the full path for a log file to which the user has write access</listitem>
1013                                         <listitem>Modify <emphasis role="bold">loglevel</emphasis> as needed for testing</listitem>
1014                                 </itemizedlist>
1015                                 <figure>
1016                                         <title>Sample of configuration file /openils/conf/srfsh.xml.example</title>
1017                                         <screen>
1018                                         &lt;?xml version="1.0"?>
1019                                         &lt;!-- This file follows the standard bootstrap config file layout -->
1020                                         &lt;!-- found in opensrf_core.xml -->
1021                                         &lt;srfsh>
1022                                         &lt;router_name>router&lt;/router_name>
1023                                         &lt;domain>private.localhost&lt;/domain>
1024                                         &lt;username>opensrf&lt;/username>
1025                                         &lt;passwd>evergreen&lt;/passwd>
1026                                         &lt;port>5222&lt;/port>
1027                                         &lt;logfile>/tmp/srfsh.log&lt;/logfile>
1028                                         &lt;!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->
1029                                         &lt;loglevel>4&lt;/loglevel>
1030                                         &lt;/srfsh>
1031                                         </screen>
1032                                 </figure>
1033                         </section>
1034                         <section>
1035                                 <title>Modify the OpenSRF Environment</title>
1036                                 <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>
1037                                 <note>
1038                                         <para>
1039                                                 <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>
1040                                         </para>
1041                                 </note>
1042                                 <figure>
1043                                         <title>Modify the OpenSRF environment</title>
1044                                         <screen>
1045                                         # change permissions
1046                                         $ su - opensrf
1047                                         $ chmod 755 /openils/var/cgi-bin/*.cgi
1048         
1049                                         # add environmental variable
1050                                         $ echo "export PERL5LIB=/openils/lib/perl5:\$PERL5LIB" >> ~/.bashrc
1051         
1052                                         # inherit the new environment
1053                                         $ . ~/.bashrc
1054                                         </screen>
1055                                 </figure>
1056                         </section>
1057                         <section xml:id="serversideinstallation-localization">
1058                                 <title>(OPTIONAL) Configuration for Other Languages</title>
1059                                 <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>
1060                                 <para> [[ ADD SECTION ON LANGUAGE LOCALIZATION ]] </para>
1061                         </section>
1062                 </section>
1063         </section>
1064         <section xml:id="serversideinstallation-testing">
1065                 <title>Testing the Installation</title>
1066                 <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>
1067                 <section xml:id="serversideinstallation-testing-connections">
1068                         <title>Testing Connections to Evergreen</title>
1069                         <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>
1070                         <figure>
1071                                 <title>Testing Evergreen with "srfsh"</title>
1072                                 <screen>
1073                                 $ su - opensrf
1074                                 $ /openils/bin/srfsh
1075                                 srfsh% login admin open-ils
1076                                 Received Data: "250bf1518c7527a03249858687714376"
1077                                 ------------------------------------
1078                                 Request Completed Successfully
1079                                 Request Time in seconds: 0.045286
1080                                 ------------------------------------
1081                                 Received Data: {
1082                                    "ilsevent":0,
1083                                    "textcode":"SUCCESS",
1084                                    "desc":" ",
1085                                    "pid":21616,
1086                                    "stacktrace":"oils_auth.c:304",
1087                                    "payload":{
1088                                       "authtoken":"e5f9827cc0f93b503a1cc66bee6bdd1a",
1089                                       "authtime":420
1090                                    }
1091                                 }
1092                                 ------------------------------------
1093                                 Request Completed Successfully
1094                                 Request Time in seconds: 1.336568
1095                                 ------------------------------------
1096                                 </screen>
1097                         </figure>
1098                         <para>If this does not work, try other simple troubleshooting steps:</para>
1099                         <itemizedlist>
1100                                 <listitem>
1101                                         <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>
1102                                         <para>[[ REWORK THIS DIAGRAM TO USE SAME IMAGE STANDARDS AS OTHER CHAPTERS ]]</para>
1103                                         <figure>
1104                                                 <title>Executing the script <emphasis> settings-test.pl</emphasis></title>
1105                                                 <mediaobject>
1106                                                         <imageobject>
1107                                                                 <imagedata fileref="../media/serversideinstallation-testing-1.png" scalefit="1" width="100%"/>
1108                                                         </imageobject>
1109                                                 </mediaobject>
1110                                                 <mediaobject>
1111                                                         <imageobject>
1112                                                                 <imagedata fileref="../media/serversideinstallation-testing-2.png" scalefit="1" width="100%"/>
1113                                                         </imageobject>
1114                                                 </mediaobject>
1115                                         </figure>
1116                                         <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, <emphasis><emphasis role="bold"><link linkend="troubleshooting"> "Troubleshooting" </link></emphasis></emphasis> .</para>
1117                                 </listitem>
1118                                 <listitem>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 [[ http://open-ils.org/listserv.php|Evergreen development mailing list ]] for assistance before making any drastic changes to your system configuration.</listitem>
1119                         </itemizedlist>
1120                 </section>
1121                 <section xml:id="serversideinstallation-testing-opac">
1122                         <title>Testing the Catalog</title>
1123                         <para>By default, the OPAC will live at the URL <emphasis>http://my.domain.com/opac/</emphasis>.</para>
1124                         <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>
1125                         <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>
1126                         <para>[[ ADD OTHER SIMPLE FUNCTIONAL TESTS ]]</para>
1127                 </section>
1128                 <section xml:id="serversideinstallation-testing-othersrfsh">
1129                         <title>Other Tests with srfsh</title>
1130                         <para>There is also a <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>
1131                         <screen>
1132                         srfsh# math_bench 10
1133                         |.........|.........|.........|.........|.........|.........|.........|.........|.........|.........
1134                         ++++++++++++++++++++++++++++++++++++++++
1135                         Average round trip time: 0.033425
1136                         srfsh#
1137                         </screen>
1138                         <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>
1139                         <para>For other srfsh commands, type 'help' in at the prompt.</para>
1140                 </section>
1141                 <section xml:id="serversideinstallation-starting-apache-server">
1142                         <title>Testing the Apache Web Server</title>
1143                         <para>Once you have started Evergreen and confirmed that a basic login attempt works, you can test and start the Apache web server.</para>
1144                         <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>
1145                         <figure>
1146                                 <title>Test the Apache Web Server</title>
1147                                 <screen>
1148                                 $ su - root
1149                                 $ apache2ctl configtest &amp;&amp; /etc/init.d/apache2 restart
1150                                 </screen>
1151                         </figure>
1152                 </section>
1153         </section>
1154         <section xml:id="serversideinstallation-starting">
1155                 <title>Starting Evergreen</title>
1156                 <orderedlist>
1157                         <listitem>
1158                                 <para>As the <emphasis role="bold">root</emphasis> user, start the "ejabberd" and "memcached" services (if they aren't already running):</para>
1159                                 <figure>
1160                                         <title>Starting some services</title>
1161                                         <screen>
1162                                         $ su - root
1163                                         $ /etc/init.d/ejabberd start
1164                                         $ /etc/init.d/memcached start
1165                                         </screen>
1166                                 </figure>
1167                         </listitem>
1168                         <listitem>
1169                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, start Evergreen.</para>
1170                                 <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>
1171                                 <figure>
1172                                         <title>Starting Evergreen</title>
1173                                         <screen>
1174                                         $ su - opensrf
1175
1176                                         # ensure you have the needed path
1177                                         $ export PATH=$PATH:/openils/bin
1178
1179                                         # start the OpenSRF service:
1180                                         # use "-l" to force hostname to be "localhost"
1181                                         $ osrf_ctl.sh -l -a start_all     
1182                                         </screen>
1183                                 </figure>
1184                                 <note>
1185                                         <para>
1186                                                 <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>
1187                                         </para>
1188                                 </note>
1189                                 <para>[[ ADD EXPLANATION FOR CONFIGURING "opensrf.xml" ]]</para>
1190                                 <para>Execute the following command to determine the fully qualified domain name of your system:</para>
1191                                 <figure>
1192                                         <title>(OPTIONAL) Determine the fully qualified domain name</title>
1193                                         <screen>
1194                                         $ perl -e 'use Net::Domain qw(hostfqdn); print hostfqdn()."\n"'
1195                                         </screen>
1196                                 </figure>
1197                                 <itemizedlist>
1198                                         <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>
1199                                         <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>
1200                                 </itemizedlist>
1201                         </listitem>
1202                         <listitem>
1203                                 <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>
1204                                 <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>
1205                                 <figure>
1206                                         <title>Generate web files</title>
1207                                         <screen>
1208                                         $ su - opensrf
1209                                         $ cd /openils/bin
1210                                         $ ./autogen.sh -c /openils/conf/opensrf_core.xml -u
1211                                         Updating Evergreen organization tree and IDL \
1212                                                 using '/openils/conf/opensrf_core.xml'
1213
1214                                         Updating fieldmapper
1215                                         Exception: OpenSRF::EX::Session 2010-04-16T06:31:38 \
1216                                                 OpenSRF::Utils::SettingsClient \
1217                                                 /usr/local/share/perl/5.10.0/OpenSRF/Utils/SettingsClient.pm:103 \
1218                                                 Session Error: router@private.localhost/opensrf.settings \
1219                                                 IS NOT CONNECTED TO THE NETWORK!!!
1220                                         </screen>
1221                                         <para>[[ ADD RESULTS OF TESTS FROM "autogen.sh" ]]</para>
1222                                 </figure>
1223                         </listitem>
1224                         <listitem>
1225                                 <para>As the <emphasis role="bold">root</emphasis> user, restart the Apache Web server:</para>
1226                                 <figure>
1227                                         <title>Restart the Apache web server</title>
1228                                         <screen>
1229                                         $ su - root
1230                                         $ /etc/init.d/apache2 restart
1231                                         </screen>
1232                                 </figure>
1233                                 <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>
1234                         </listitem>
1235                 </orderedlist>
1236         </section>
1237         <section xml:id="serversideinstallation-stopping">
1238                 <title>Stopping Evergreen</title>
1239                 <para>As the <emphasis role="bold">opensrf</emphasis> user, stop all Evergreen services by using the following command:</para>
1240                 <figure>
1241                         <title>Stopping all Evergreen services</title>
1242                         <screen>
1243                         $ su - opensrf
1244
1245                         # stop the server:
1246                         # use "-l" to force hostname to be "localhost"
1247                         $ osrf_ctl.sh -l -a stop_all
1248                         </screen>
1249                 </figure>
1250                 <note>
1251                         <para>
1252                                 <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>
1253                         </para>
1254                 </note>
1255                 <para>[[ ADD EXPLANATION FOR CONFIGURING "opensrf.xml" ]]</para>
1256         </section>
1257         <section xml:id="serversideinstallation-postinstallation">
1258                 <title>Post-Installation Chores</title>
1259                 <section>
1260                         <title>Remove temporary changes from Apache configuration file</title>
1261                         <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>
1262                         <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 <emphasis><emphasis role="bold"><link linkend="serversideinstallation-modify-apache"> "Modify the Apache Configuration File" </link></emphasis></emphasis> 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>
1263                 </section>
1264                 <section>
1265                         <title>Configure a permanent SSL key</title>
1266                         <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>
1267                         <warning>
1268                                 <para><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. See this section for further comments on setting up a properly signed SSL certificate: <emphasis><emphasis role="bold"><link linkend="serversideinstallation-ssl"> "Getting a Signed SSL Security Certificate" </link></emphasis></emphasis> </emphasis>.</para>
1269                         </warning>
1270                 </section>
1271                 <section>
1272                         <title>Set Up Support For Reports</title>
1273                         <para>Evergreen reports are extremely powerful, but some configuration is required. See the section <emphasis><emphasis role="bold"><link linkend="report-introduction"> "Reports" </link></emphasis></emphasis> for details.</para>
1274                         <section>
1275                                 <title>Starting the Reporter Daemon</title>
1276                                 <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>
1277                                 <para>As the <emphasis role="bold">opensrf</emphasis> user, start the reporter daemon using the following command:</para>
1278                                 <figure>
1279                                         <title>Starting the Reporter Daemon</title>
1280                                         <screen>
1281                                         $ su - opensrf
1282                                         $ cd /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/src/reporter
1283                                         $ ./clark-kent.pl --daemon
1284                                         </screen>
1285                                 </figure>
1286                                 <para>You can also specify other options with this utility:</para>
1287                                 <itemizedlist>
1288                                         <listitem>--sleep=interval      : number of seconds to sleep between checks for new reports to run; defaults to 10</listitem>
1289                                         <listitem>--lockfile=filename   : where to place the lockfile for the process; defaults to <emphasis>/tmp/reporter-LOCK</emphasis></listitem>
1290                                         <listitem>--concurrency=integer : number of reporter daemon processes to run; defaults to "1"</listitem>
1291                                         <listitem>--boostrap=filename   : OpenSRF bootstrap configuration file; defaults to <emphasis>/openils/conf/opensrf_core.xml</emphasis></listitem>
1292                                 </itemizedlist>
1293                         </section>
1294                         <section>
1295                                 <title>Stopping the Reporter Daemon</title>
1296                                 <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>
1297                                 <note>
1298                                         <para>
1299                                                 <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>
1300                                         </para>
1301                                 </note>
1302                                 <figure>
1303                                         <title>Stopping the Reporter Daemon</title>
1304                                         <screen>
1305                                         $ su - opensrf
1306                                         # find and kill the process ID number(s)
1307                                         $ kill `ps wax | grep "Clark Kent" | grep -v grep | cut -b1-6`
1308                                         # remove the lock file
1309                                         $ rm /tmp/reporter-LOCK
1310                                         </screen>
1311                                 </figure>
1312                         </section>
1313                 </section>
1314         </section>
1315         <section xml:id="serversideinstallation-staffclient">
1316                 <title>Running the Evergreen Staff Client</title>
1317                 <para>[[ ADD CONTENT: LINUX VS WINDOWS STAFF CLIENT ]]</para>
1318                 <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>
1319                 <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>
1320                 <figure>
1321                         <title>Running the Linux Staff Client</title>
1322                         <screen>
1323                         $ su - opensrf
1324                         $ xulrunner /home/opensrf/Evergreen-ILS-1.6.0.7/Open-ILS/xul/staff_client/build/application.ini
1325                         </screen>
1326                 </figure>
1327         </section>
1328         <section xml:id="serversideinstallation-otherlinux">
1329                 <title>Installing Evergreen On Other Linux Systems</title>
1330                 <para>[[ ADD CONTENT FOR INSTALLING ON OTHER LINUX SYSTEMS ]]</para>
1331         </section>
1332         <section xml:id="serversideinstallation-virtual">
1333                 <title>Installing Evergreen in Virtualized Unix Environments</title>
1334                 <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>
1335                 <para>[[ ADD CONTENT FOR INSTALLING EVERGREEN IN VIRTUALIZED UNIX ENVIRONMENTS ]]</para>
1336                 <section xml:id="serversideinstallation-virtualized-virtualbox">
1337                         <title>VirtualBox</title>
1338                         <para>[[ ADD CONTENT FOR VirtualBox ]]</para>
1339                 </section>
1340                 <section xml:id="serversideinstallation-virtualized-vmware">
1341                         <title>VMware</title>
1342                         <para>[[ ADD CONTENT FOR VMware ]]</para>
1343                 </section>
1344                 <section xml:id="serversideinstallation-virtualized-virtualpc">
1345                         <title>VirtualPC</title>
1346                         <para>[[ ADD CONTENT FOR VirtualPC ]]</para>
1347                 </section>
1348         </section>
1349         <section xml:id="serversideinstallation-previousversions">
1350                 <title>Installing Previous Versions of Evergreen</title>
1351                 <para>Earlier releases of Evergreen are available. Instructions for installing, configuring and testing earlier versions are found below.</para>
1352                 <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>
1353                 <section xml:id="serversideinstallation-ubuntudebian-previous">
1354                         <title>Installing Evergreen 1.4.0.6 on Ubuntu or Debian</title>
1355                         <para>[[ ADD CONTENT FOR INSTALLING EVERGREEN 1.4.0.6 ON UBUNTU OR DEBIAN ]]</para>
1356                 </section>
1357                 <section xml:id="serversideinstallation-opensrf-previous">
1358                         <title>Installing OpenSRF 1.0.x</title>
1359                         <para>[[ ADD CONTENT FOR INSTALLING OPENSRF 1.0.x ]]</para>
1360                 </section>
1361         </section>
1362         <section xml:id="serversideinstallation-postgresql">
1363                 <title>Installing PostgreSQL</title>
1364                 <para>[[ ADD CONTENT FOR POSTGRESQL ]] </para>
1365         </section>
1366         <section xml:id="serversideinstallation-apache">
1367                 <title>Apache</title>
1368                 <section>
1369                         <title>Securing Apache (httpd)</title>
1370                         <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>
1371                         <para>[[ ADD CONTENT ON HOW TO RESTRICT APACHE BY IP AND USERNAME/PASSWORD ]]</para>
1372                         <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>
1373                 </section>
1374                 <para>[[ ADD MORE CONTENT FOR APACHE ]] </para>
1375         </section>
1376         <section xml:id="serversideinstallation-memcached">
1377                 <title>memcached Servers</title>
1378                 <para>[[ ADD CONTENT FOR MEMCACHED ]] </para>
1379         </section>
1380         <section xml:id="serversideinstallation-organizationandpolicy">
1381                 <title>Organization and Policy Editing</title>
1382                 <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 <emphasis><emphasis role="bold"><link linkend="serveradministration-orgunits"> "Organizational Unit Types and Organizational Units" </link></emphasis></emphasis> for further information. Examples of what can be configured include:</para>
1383                 <itemizedlist>
1384                         <listitem>Adding a branch library</listitem>
1385                         <listitem>Changing circulation rules for an existing library</listitem>
1386                         <listitem>Adding a new staff position or user group</listitem>
1387                 </itemizedlist>
1388                 <para>[[ ADD CONTENT FOR ORGANIZATION AND POLICY EDITING ]] </para>
1389         </section>
1390         <section xml:id="serversideinstallation-sip">
1391                 <title>Installing the SIP Server</title>
1392                 <para>[[ ADD CONTENT FOR INSTALLING THE SIP SERVER ]]</para>
1393         </section>
1394         <section xml:id="serversideinstallation-nginx">
1395                 <title>Using nginx to serve static content</title>
1396                 <para>[[ ADD CONTENT FOR USING NGINX TO SERVE STATIC CONTENT ]]</para>
1397         </section>
1398         <section xml:id="serversideinstallation-ssl">
1399                 <title>Getting a Signed SSL Security Certificate</title>
1400                 <para>[[ ADD EXPLANATION OF HOW TO GET A SIGNED SSL CERTIFICATE ]] </para>
1401         </section>
1402 </chapter>