update the glossary;
[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 <xref linkend="serversideinstallation-all"/> for instructions tailored to installing on some particular distributions of the <systemitem class="osname">Linux</systemitem> operating system. Earlier software distributions are described in <xref linkend="serversideinstallation-previousversions"/>.</para>
12                 <para>The current version of the Evergreen server-side software runs as a native application on any of several well-known <systemitem class="osname">Linux</systemitem> distributions (e.g., <systemitem class="osname">Ubuntu</systemitem> and <systemitem class="osname">Debian</systemitem>). It does not currently run as a native application on the <systemitem class="osname">Microsoft Windows</systemitem> operating system (e.g., <systemitem class="osname">WindowsXP</systemitem>, <systemitem class="osname">WindowsXP Professional</systemitem>, <systemitem class="osname">Windows7</systemitem>), but the software can still be installed and run on <systemitem class="osname">Windows</systemitem> via a so-called <emphasis>virtualized</emphasis> Unix-guest Operating System (using, for example, <application>VirtualBox</application>, or <application>VMware</application>, or <application>VirtualPC</application> to emulate a <systemitem class="osname">Linux</systemitem> environment). It can also be installed to run on other <systemitem class="osname">Linux</systemitem> systems via virtualized environments (using, for example, <application>VirtualBox</application> or <application>VMware</application>). More information on virtualized environments can be found in <xref linkend="serversideinstallation-virtual"/>.</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 <xref linkend="serversideinstallation-postgresql"/> and <xref linkend="serversideinstallation-apache"/>.</para>
14                 <para>Finally, installation of the Evergreen Staff Client software is reviewed in <xref linkend="serversideinstallation-staffclient"/>. </para>
15                 <section>
16                         <title>Evergreen Software Dependencies</title>
17                         <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>
18                         <table>
19                                 <title>Evergreen Software Dependencies</title>
20                                 <tgroup align="left" cols="3" colsep="1" rowsep="1">
21                                         <thead>
22                                                 <row>
23                                                         <entry>Evergreen</entry>
24                                                         <entry>OpenSRF</entry>
25                                                         <entry>PostgreSQL</entry>
26                                                 </row>
27                                         </thead>
28                                         <tbody>
29                                                 <row>
30                                                         <entry>1.6.x</entry>
31                                                         <entry>1.2</entry>
32                                                         <entry>8.2 / 8.3</entry>
33                                                 </row>
34                                                 <row>
35                                                         <entry>1.4.x</entry>
36                                                         <entry>1.0</entry>
37                                                         <entry>8.1 / 8.2</entry>
38                                                 </row>
39                                                 <row>
40                                                         <entry>1.2.x</entry>
41                                                         <entry>0.9</entry>
42                                                         <entry>8.1 / 8.2</entry>
43                                                 </row>
44                                         </tbody>
45                                 </tgroup>
46                         </table>
47                 </section>
48                 <section>
49                         <title>Current Stable Software Release</title>
50                         <para>The current stable release of Evergreen is version <emphasis><emphasis role="bold"></emphasis></emphasis>. Instructions for installing, configuring and testing that version on the <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem> <systemitem class="osname">Linux</systemitem> systems are found in <xref linkend="serversideinstallation-ubuntudebian"/>.</para>
51                         <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 <xref linkend="serversideinstallation-opensrf"/>.</para>
52                 </section>
53                 <section>
54                         <title>Previous Software Releases</title>
55                         <para>Earlier releases of Evergreen are also available. Instructions for installing, configuring and testing earlier versions are found in <xref linkend="serversideinstallation-previousversions"/>.</para>
56                         <para>The next most recent previous release of Evergreen is version <emphasis><emphasis role="bold"></emphasis></emphasis>. Instructions for installing, configuring and testing that version are found in <xref linkend="serversideinstallation-evergreen-previous"/>.</para>
57                         <para>The accompanying previous release of OpenSRF is version <emphasis><emphasis role="bold">1.0.7</emphasis></emphasis>. Instructions for installing, configuring and testing that version are found in <xref linkend="serversideinstallation-opensrf-previous"/>.</para>
58                 </section>
59         </section>
60         <section xml:id="serversideinstallation-all">
61                 <title>Installing Server-Side Software</title>
62                 <para>This section describes the installation of the major components of Evergreen server-side software.</para>
63                 <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 <xref linkend="adminmisc-backingup"/> for further information.</para>
64                 <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>
65                 <section xml:id="serversideinstallation-opensrf">
66                         <title>Installing OpenSRF 1.2.2 On <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem></title>
67                         <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 <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem> systems. Evergreen software is integrated with and depends on the OpenSRF software system.</para>
68                         <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>
69                         <note>
70                                 <para>The following steps have been tested on the x86 (32-bit) and x86-64 (64-bit) platforms. OpenSRF 1.2.2 has been tested on <systemitem class="osname">Debian Etch (4.0)</systemitem>, <systemitem class="osname">Debian Lenny</systemitem>, <systemitem class="osname">Ubuntu Hardy Heron (8.04)</systemitem>, and <systemitem class="osname">Ubuntu Intrepid Ibex (8.10)</systemitem>.</para>
71                                 <para>In the following instructions, you are asked to perform certain steps as either the <systemitem class="username">root</systemitem> user, the <systemitem class="username">opensrf</systemitem> user, or the <systemitem class="username">postgres</systemitem> user.</para>
72                                 <itemizedlist>
73                                         <listitem><systemitem class="osname">Debian</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command <command>su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>
74                                         <listitem><systemitem class="osname">Ubuntu</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command <command>sudo su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>
75                                 </itemizedlist>
76                                 <para>To switch from the <systemitem class="username">root</systemitem> user to a different user, issue the command <command>su - USERNAME</command>. For example, to switch from the <systemitem class="username">root</systemitem> user to the <systemitem class="username">opensrf</systemitem> user, issue the command <command>su - opensrf</command>. Once you have become a non-root user, to become the <systemitem class="username">root</systemitem> user again, simply issue the command <command>exit"</command>.</para>
77                         </note>
78                         <section>
79                                 <title>Add the OpenSRF User</title>
80                                 <para>As the <systemitem class="username">root</systemitem> user, add the opensrf user to the system. The default shell for the new user is automatically set to <command>/bin/bash</command> to inherit a reasonable environment:</para>
81                                 <figure>
82                                         <title>Commands to add <systemitem class="username">opensrf</systemitem> user</title>
83                                         <screen>
84                                         $ su - opensrf
85                                         $ useradd -m -s /bin/bash opensrf
86                                         $ passwd opensrf
87                                         Enter new UNIX password: ******
88                                         Retype new UNIX password: ******
89                                         passwd: password updated successfully
90                                         $
91                                         </screen>
92                                 </figure>
93                         </section>
94                         <section>
95                                 <title>Download and Unpack Latest OpenSRF Version</title>
96                                 <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract the latest version of OpenSRF. The latest version can be found here: <ulink url="http://evergreen-ils.org/downloads/OpenSRF-1.2.2.tar.gz"></ulink></para>
97                                 <figure>
98                                         <title>Commands to download and unpack OpenSRF</title>
99                                         <screen>
100                                         $ su - opensrf
101                                         $ wget http://evergreen-ils.org/downloads/OpenSRF-1.2.2.tar.gz
102                                         $ tar zxf OpenSRF-1.2.2.tar.gz
103                                         </screen>
104                                 </figure>
105                                 <para>The new directory <filename class="directory">/home/opensrf/OpenSRF-1.2.2</filename> will be created.</para>
106                         </section>
107                         <section>
108                                 <title>Install Prerequisites to Build OpenSRF</title>
109                                 <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 <command>make</command> utility.</para>
110                                 <para>As the <systemitem class="username">root</systemitem> 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 <systemitem class="osname">Linux</systemitem> distribution listed in the <link linkend="serversideinstallation-keywords-figure-1">"Keywords"</link> figure below.</para>
111                                 <figure>
112                                         <title>Commands to install prerequisites for OpenSRF</title>
113                                         <screen>
114                                         $ su - root
115                                         $ cd /home/opensrf/OpenSRF-1.2.2
116                                         $ make -f src/extras/Makefile.install [DISTRIBUTION]
117                                         ...
118                                         </screen>
119                                 </figure>
120                                 <table xml:id="serversideinstallation-keywords-figure-1">
121                                         <title>Keywords Targets for <application>make</application> Command</title>
122                                         <tgroup align="left" cols="2" colsep="1" rowsep="1">
123                                                 <colspec colnum="1" colwidth="1*"/>
124                                                 <colspec colnum="2" colwidth="3*"/>
125                                                 <thead>
126                                                         <row>
127                                                                 <entry>Keyword</entry>
128                                                                 <entry>Description</entry>
129                                                         </row>
130                                                 </thead>
131                                                 <tbody>
132                                                         <row>
133                                                                 <entry>debian-lenny</entry>
134                                                                 <entry>for Debian Lenny (5.0)</entry>
135                                                         </row>
136                                                         <row>
137                                                                 <entry>debian-etch</entry>
138                                                                 <entry>for Debian Etch (4.0)</entry>
139                                                         </row>
140                                                         <row>
141                                                                 <entry>ubuntu-karmic</entry>
142                                                                 <entry>for Ubuntu Karmic (9.10)</entry>
143                                                         </row>
144                                                         <row>
145                                                                 <entry>ubuntu-intrepid</entry>
146                                                                 <entry>for Ubuntu Jaunty (9.04) or Intrepid (8.10)</entry>
147                                                         </row>
148                                                         <row>
149                                                                 <entry>ubuntu-hardy</entry>
150                                                                 <entry>for Ubuntu Hardy (8.04)</entry>
151                                                         </row>
152                                                 </tbody>
153                                         </tgroup>
154                                 </table>
155                                 <indexterm>
156                                         <primary>ZZZ-REVIEW</primary>
157                                         <secondary>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </secondary>
158                                 </indexterm>
159                                 <caution>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </caution>
160                                 <para>This will install a number of packages on the system that are required by OpenSRF, including some Perl modules from CPAN. You can say <literal>No</literal> 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 <literal>Yes</literal>.</para>
161                         </section>
162                         <section>
163                                 <title>Configure OpenSRF</title>
164                                 <para>As the <systemitem class="username">opensrf</systemitem> user, return to the OpenSRF build directory and use the <command>configure</command> utility to prepare for the next step of compiling and linking the software. You can include the  <option>--enable-python</option> and <option>--enable-java</option> configuration options if you wish to include support for Python and Java, respectively:</para>
165                                 <figure>
166                                         <title>Commands to configure OpenSRF</title>
167                                         <screen>
168                                         $ su - opensrf
169                                         $ cd /home/opensrf/OpenSRF-1.2.2
170                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf
171                                         $ make
172                                         ...
173                                         </screen>
174                                 </figure>
175                         </section>
176                         <section>
177                                 <title>Compile, Link and Install OpenSRF</title>
178                                 <para>As the <systemitem class="username">root</systemitem> user, return to the OpenSRF build directory and use the <command>make</command> utility to compile, link and install OpenSRF:</para>
179                                 <figure>
180                                         <title>Commands to build, link and install OpenSRF</title>
181                                         <screen>
182                                         $ su - opensrf
183                                         $ cd /home/opensrf/OpenSRF-1.2.2
184                                         $ make install
185                                         ...
186                                         </screen>
187                                 </figure>
188                         </section>
189                         <section>
190                                 <title>Update the System Dynamic Library Path</title>
191                                 <para>As the <systemitem class="username">root</systemitem> user, you must update the system dynamic library path to make your system recognize the newly installed libraries. Do this by creating the new file <filename>/etc/ld.so.conf.d/osrf.conf</filename> containing a new library path, then run the command <command>ldconfig</command> to automatically read the file and modify the system dynamic library path:</para>
192                                 <figure>
193                                         <title>Commands to modify system dynamic library path</title>
194                                         <screen>
195                                         $ su - root
196                                         $ echo "/openils/lib" > /etc/ld.so.conf.d/osrf.conf
197                                         $ ldconfig
198                                         </screen>
199                                 </figure>
200                         </section>
201                         <section>
202                                 <title>Define Public and Private OpenSRF Domains</title>
203                                 <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 <systemitem class="domainname">public.localhost</systemitem> for the public domain and <systemitem class="domainname">private.localhost</systemitem> 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 <filename>/etc/hosts</filename>.</para>
204                                 <para>As the <systemitem class="username">root</systemitem> user, edit the file <filename>/etc/hosts</filename> and add the following entries for our example domains:</para>
205                                 <figure>
206                                         <title>Example public and private domains in /etc/hosts</title>
207                                         <screen>
208                                      public.localhost        public
209                                      private.localhost       private
210                                         </screen>
211                                 </figure>
212                         </section>
213                         <section>
214                                 <title>Change File Ownerships</title>
215                                 <para>As the <systemitem class="username">root</systemitem> user, change the ownership of files installed in the directory <filename class="directory">/openils</filename> to the <systemitem class="username">opensrf</systemitem> user:</para>
216                                 <figure>
217                                         <title>Commands to change file ownerships</title>
218                                         <screen>
219                                         $ chown -R opensrf:opensrf /openils
220                                         </screen>
221                                 </figure>
222                         </section>
223                         <section>
224                                 <title>Stop the <systemitem class="service">ejabberd</systemitem> Service</title>
225                                 <para>As the <systemitem class="username">root</systemitem> user, stop the <systemitem class="service">ejabberd</systemitem> service:</para>
226                                 <figure>
227                                         <title>Commands to stop the <systemitem class="service">ejabberd</systemitem> service</title>
228                                         <screen>
229                                         $ /etc/init.d/ejabberd stop
230                                         </screen>
231                                 </figure>
232                                 <para>If <systemitem class="service">ejabberd</systemitem> 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 <systemitem class="daemon">beam</systemitem> and <systemitem class="daemon">epmd</systemitem> processes, then edit the configuration file <filename>/etc/ejabberd/ejabberd.cfg</filename> to hardcode a domain:</para>
233                                 <figure>
234                                         <title>Commands to recover from <systemitem class="service">ejabberd</systemitem> errors</title>
235                                         <screen>
236                                         $ su - root
237                                         $ epmd -kill
238                                         $ killall beam; killall beam.smp
239                                         $ rm /var/lib/ejabberd/*
240                                         $ echo 'ERLANG_NODE=ejabberd@localhost' >> /etc/default/ejabberd
241                                         </screen>
242                                 </figure>
243                         </section>
244                         <section>
245                                 <title>Edit the <systemitem class="service">ejabberd</systemitem> configuration</title>
246                                 <para>As the <systemitem class="username">root</systemitem> user, edit the file <filename>/etc/ejabberd/ejabberd.cfg</filename> and make the following changes:</para>
247                                 <itemizedlist>
248                                         <listitem>Change <literal>{hosts, ["localhost"]}.</literal> to <literal>{hosts, ["localhost", "private.localhost", "public.localhost"]}.</literal></listitem>
249                                         <listitem>Change <literal>{max_user_sessions, 10}.</literal> to <literal>{max_user_sessions, 10000}.</literal> If you see something like this instead: <literal>{access, max_user_sessions, [{10, all}]}.</literal>, then change it to <literal>{access, max_user_sessions, [{10000, all}]}.</literal></listitem>
250                                         <listitem>Change all three occurrences of <literal>max_stanza_size</literal> to <literal>2000000</literal>.</listitem>
251                                         <listitem>Change both occurrences of <literal>maxrate</literal> to <literal>500000</literal>.</listitem>
252                                         <listitem>Comment out the line <literal>{mod_offline, []}</literal> by placing two <literal>%</literal> comment signs in front.</listitem>
253                                 </itemizedlist>
254                         </section>
255                         <section xml:id="serversideinstallation-opensrf-continued">
256                                 <title>Restart the <systemitem class="service">ejabberd</systemitem> service</title>
257                                 <para>As the <systemitem class="username">root</systemitem> user, restart the <systemitem class="service">ejabberd</systemitem> service to test the configuration changes and to register your users:</para>
258                                 <figure>
259                                         <title>Commands to restart the <systemitem class="service">ejabberd</systemitem> service</title>
260                                         <screen>
261                                         $ /etc/init.d/ejabberd start
262                                         </screen>
263                                 </figure>
264                         </section>
265                         <section>
266                                 <title>Register <systemitem class="username">router</systemitem> and <systemitem class="username">ejabberd</systemitem> users</title>
267                                 <para>On each domain, you need two <systemitem class="service">ejabberd</systemitem> users to manage the OpenSRF communications:</para>
268                                 <itemizedlist>
269                                         <listitem>a <systemitem class="username">router</systemitem> user, to whom all requests to connect to an OpenSRF service will be routed; this <systemitem class="service">ejabberd</systemitem> user must be named <systemitem class="username">router</systemitem></listitem>
270                                         <listitem>an <systemitem class="username">opensrf</systemitem> user, which clients use to connect to OpenSRF services; this user can be named anything you like, but we will use <literal>opensrf</literal> in our examples</listitem>
271                                 </itemizedlist>
272                                 <para>As the <systemitem class="username">root</systemitem> user, use the <command>ejabberdctl</command> utility 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 <filename>/openils/conf/opensrf_core.xml</filename>:</para>
273                                 <figure>
274                                         <title>Commands to register <systemitem class="username">router</systemitem> and <systemitem class="username">ejabberd</systemitem> users</title>
275                                         <programlisting language="xml"><![CDATA[
276                                         # Syntax for registering a user with ejabberdctl:
277                                         #    ejabberdctl register <user> <domain> <password>
278                                         #
279                                         $ ejabberdctl register router private.localhost  <password>
280                                         $ ejabberdctl register opensrf private.localhost <password>
281                                         $ ejabberdctl register router public.localhost   <password>
282                                         $ ejabberdctl register opensrf public.localhost  <password>
283                                         ]]></programlisting>
284                                 </figure>
285                         </section>
286                         <section>
287                                 <title>Create configuration files</title>
288                                 <para>As the <systemitem class="username">opensrf</systemitem> user, use the example templates to create the configuration files <filename>/openils/conf/opensrf_core.xml</filename> and <filename>/openils/conf/opensrf.xml</filename>:</para>
289                                 <figure>
290                                         <title>Commands to create configuration files</title>
291                                         <screen>
292                                         $ su - root
293                                         $ cd /openils/conf
294                                         $ cp opensrf.xml.example      opensrf.xml
295                                         $ cp opensrf_core.xml.example opensrf_core.xml
296                                         </screen>
297                                 </figure>
298                         </section>
299                         <section>
300                                 <title>Edit opensrf_core.xml</title>
301                                 <para>Edit the file <filename>/openils/conf/opensrf_core.xml</filename> to change the <systemitem class="service">ejabberd</systemitem> usernames and passwords as follows.</para>
302                                 <note>
303                                         <para>
304                                                 <emphasis>The following example uses common XPath syntax on the left-hand side to indicate the approximage position needing changes within the XML file.</emphasis>
305                                         </para>
306                                 </note>
307                                 <figure>
308                                         <title>Updates needed in the file <filename>/openils/conf/opensrf_core.xml</filename></title>
309                                         <screen>
310                                         /config/opensrf/username = opensrf
312                                         /config/opensrf/passwd = password for "private.localhost" opensrf user
314                                         /config/gateway/username = opensrf
316                                         /config/gateway/passwd = password for "public.localhost" opensrf user
318                                         # first entry, where "transport/server" == "public.localhost" :
319                                         /config/routers/router/transport 
320                                             username = router
321                                             password = password for "public.localhost" router user
323                                         # second entry, where "transport/server" == "private.localhost" :
324                                         /config/routers/router/transport
325                                             username = router
326                                             password = password for "private.localhost" router user
327                                         </screen>
328                                 </figure>
329                                 <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 <systemitem class="domainname">private.localhost</systemitem> / <systemitem class="domainname">public.localhost</systemitem> domains, these will already be set to the correct values. Otherwise, search and replace to match your values.</para>
330                         </section>
331                         <section>
332                                 <title>Modify the file <filename>opensrf.xml</filename></title>
333                                 <para>As the <systemitem class="username">opensrf</systemitem> user, edit the file <filename>/openils/conf/opensrf.xml</filename> to set the location of the persistent database in the <literal>dbfile</literal> element near the end of the file:</para>
334                                 <figure>
335                                         <title>Example of the file <filename>opensrf.xml</filename></title>
336                                         <programlisting language="xml"><![CDATA[
337                                         <!-- Example of an app-specific setting override -->
338                                         <opensrf.persist>
339                                           <app_settings>
340                                             <dbfile>/tmp/persist.db</dbfile>
341                                           </app_settings>
342                                         </opensrf.persist>
343                                         ]]></programlisting>
344                                 </figure>
345                         </section>
346                         <section>
347                                 <title>Create Configuration Files for Users Needing <application>srfsh</application></title>
348                                 <para>In this section you will set up a special configuration file for each user who will need to run the <application>srfsh</application> (pronounced <emphasis>surf shell</emphasis>) utility.</para>
349                                 <para>The software installation will automatically create <application>srfsh</application>. 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 <xref linkend="serversideinstallation-testing"/> for further information.</para>
350                                 <para>As the <systemitem class="username">root</systemitem> user, copy the short sample configuration file <filename>/openils/conf/srfsh.xml.example</filename> to the file <filename>.srfsh.xml</filename> (note the leading dot!) in the home directory of each user who will use <application>srfsh</application>. Finally, edit each file <filename>.srfsh.xml</filename> 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>
351                                 <itemizedlist>
352                                         <listitem>Modify <literal>domain</literal> to be the router hostname (following our domain examples, <systemitem class="domainname">private.localhost</systemitem> will give <application>srfsh</application> access to all OpenSRF services, while <systemitem class="domainname">public.localhost</systemitem> will only allow access to those OpenSRF services that are publicly exposed).</listitem>
353                                         <listitem>Modify <literal>username</literal> and <literal>password</literal> to match the <literal>opensrf</literal> Jabber user for the chosen domain</listitem>
354                                         <listitem>Modify <literal>logfile</literal> to be the full path for a log file to which the user has write access</listitem>
355                                         <listitem>Modify <literal>loglevel</literal> as needed for testing</listitem>
356                                 </itemizedlist>
357                                 <figure>
358                                         <title>Example of the file <filename>/openils/conf/srfsh.xml.example</filename></title>
359                                         <programlisting language="xml"><![CDATA[
360                                         <?xml version="1.0"?>
361                                         <!-- This file follows the standard bootstrap config file layout -->
362                                         <!-- found in opensrf_core.xml -->
363                                         <srfsh>
364                                         <router_name>router</router_name>
365                                         <domain>private.localhost</domain>
366                                         <username>opensrf</username>
367                                         <passwd>privsrf</passwd>
368                                         <port>5222</port>
369                                         <logfile>/tmp/srfsh.log</logfile>
370                                         <!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->
371                                         <loglevel>4</loglevel>
372                                         </srfsh>
373                                         ]]></programlisting>
374                                 </figure>
375                         </section>
376                         <section>
377                                 <title>Modify Environmental Variable PATH for <systemitem class="username">opensrf</systemitem> User</title>
378                                 <para>As the <systemitem class="username">opensrf</systemitem> user, modify the environmental variable <envar>PATH</envar> by adding a new file path to the <systemitem class="username">opensrf</systemitem> user's shell configuration file <filename>.bashrc</filename>:</para>
379                                 <figure>
380                                         <title>Commands to add path to <filename>.bashrc</filename> configuration file</title>
381                                         <screen>
382                                         $ su - opensrf
383                                         $ echo "export PATH=/openils/bin:\$PATH" >> ~/.bashrc
384                                         </screen>
385                                 </figure>
386                         </section>
387                         <section>
388                                 <title>Starting OpenSRF</title>
389                                 <para>As the <systemitem class="username">root</systemitem> user, start the <systemitem class="service">ejabberd</systemitem> and <systemitem class="service">memcached</systemitem> services:</para>
390                                 <figure>
391                                         <title>Commands to start <systemitem class="service">ejabberd</systemitem> and <systemitem class="service">memcached</systemitem> services</title>
392                                         <screen>
393                                         $ su - root
394                                         $ /etc/init.d/ejabberd start
395                                         $ /etc/init.d/memcached start
396                                         </screen>
397                                 </figure>
398                                 <para/>
399                                 <para>Finally, as the <systemitem class="username">opensrf</systemitem> user, start OpenSRF:</para>
400                                 <figure>
401                                         <title>Commands to start OpenSRF</title>
402                                         <screen>
403                                         $ su - opensrf
405                                         # ensure you have the needed path
406                                         $ export PATH=$PATH:/openils/bin
408                                         # start the OpenSRF service:
409                                         # use "-l" to force hostname to be "localhost"
410                                         $ osrf_ctl.sh -l -a start_all     
411                                         </screen>
412                                 </figure>
413                                 <note>
414                                         <para>
415                                                 <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 <filename>opensrf.xml</filename>, which you configured in a previous step.</emphasis>
416                                         </para>
417                                 </note>
418                         </section>
419                         <section>
420                                 <title>Testing connections to OpenSRF</title>
421                                 <para>Once you have installed and started OpenSRF, as the <systemitem class="username">root</systemitem> user, test your connection to OpenSRF using the <application>srfsh</application> utility and trying to call the <emphasis>add</emphasis> method on the OpenSRF <systemitem class="service">math</systemitem> service:</para>
422                                 <figure>
423                                         <title>Commands to test OpenSRF with <application>srfsh</application></title>
424                                         <screen>
425                                         $ su - opensrf
426                                         $ /openils/bin/srfsh
427                                         srfsh#  request opensrf.math add 2 2
428                                         Received Data: 4
429                                         ------------------------------------
430                                         Request Completed Successfully
431                                         Request Time in seconds: 0.007519
432                                         ------------------------------------
433                                         srfsh#
434                                         </screen>
435                                 </figure>
436                                 <indexterm>
437                                         <primary>ZZZ-REVIEW</primary>
438                                         <secondary>VERIFY THIS TEST </secondary>
439                                 </indexterm>
440                                 <caution>VERIFY THIS TEST </caution>
441                                 <para>For other <application>srfsh</application> commands, type <userinput>help</userinput> in at the prompt.</para>
442                         </section>
443                         <section>
444                                 <title>Stopping OpenSRF</title>
445                                 <para>As the <systemitem class="username">opensrf</systemitem> user, stop OpenSRF:</para>
446                                 <figure>
447                                         <title>Commands to stop OpenSRF</title>
448                                         <screen>
449                                         $ su - opensrf
450                                         $ osrf_ctl.sh -l -a stop_all
451                                         </screen>
452                                 </figure>
453                         </section>
454                 </section>
455                 <section xml:id="serversideinstallation-ubuntudebian">
456                         <title>Installing Evergreen On <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem></title>
457                         <para>This section outlines the installation process for the latest stable version of Evergreen.</para>
458                         <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>
459                         <note>
460                                 <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 <systemitem class="osname">Ubuntu</systemitem>. These instructions assume the Server edition.</para>
461                                 <para>In the following instructions, you are asked to perform certain steps as either the <systemitem class="username">root</systemitem> user, the <systemitem class="username">opensrf</systemitem> user, or the <systemitem class="username">postgres</systemitem> user.</para>
462                                 <itemizedlist>
463                                         <listitem><systemitem class="osname">Debian</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command <command>su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>
464                                         <listitem><systemitem class="osname">Ubuntu</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command <command>sudo su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>
465                                 </itemizedlist>
466                                 <para>To switch from the <systemitem class="username">root</systemitem> user to a different user, issue the command <command>su - USERNAME</command>. For example, to switch from the <systemitem class="username">root</systemitem> user to the <systemitem class="username">opensrf</systemitem> user, issue the command <command>su - opensrf</command>. Once you have become a non-root user, to become the <systemitem class="username">root</systemitem> user again, simply issue the command <command>exit</command>.</para>
467                         </note>
468                         <section>
469                                 <title>Installing OpenSRF</title>
470                                 <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 <xref linkend="serversideinstallation-opensrf"/>.</para>
471                                 <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>
472                         </section>
473                         <section>
474                                 <title>Download and Unpack Latest Evergreen Version</title>
475                                 <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract the latest version of Evergreen. The latest version can be found here: <ulink url="http://evergreen-ils.org/downloads/Evergreen-ILS-"></ulink></para>
476                                 <figure>
477                                         <title>Commands to download and unpack Evergreen</title>
478                                         <screen>
479                                         $ su - opensrf
480                                         $ wget http://evergreen-ils.org/downloads/Evergreen-ILS-
481                                         $ tar zxf Evergreen-ILS-
482                                         </screen>
483                                 </figure>
484                                 <para>The new directory <filename class="directory">/home/opensrf/Evergreen-ILS-</filename> will be created.</para>
485                         </section>
486                         <section>
487                                 <title>Install Prerequisites to Build Evergreen</title>
488                                 <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 <command>make</command> utility.</para>
489                                 <para>As the <systemitem class="username">root</systemitem> 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 <systemitem class="osname">Linux</systemitem> distribution listed in the <link linkend="serversideinstallation-keywords-figure-2">"Keywords"</link> figure below.</para>
490                                 <figure>
491                                         <title>Commands to install prerequisites for Evergreen</title>
492                                         <screen>
493                                         $ su - root
494                                         $ cd /home/opensrf/Evergreen-ILS-
495                                         $ make -f Open-ILS/src/extras/Makefile.install [distribution]
496                                         ...
497                                         </screen>
498                                 </figure>
499                                 <table xml:id="serversideinstallation-keywords-figure-2">
500                                         <title>Keywords Targets for <application>make</application> Command</title>
501                                         <tgroup align="left" cols="2" colsep="1" rowsep="1">
502                                                 <colspec colnum="1" colwidth="1*"/>
503                                                 <colspec colnum="2" colwidth="3*"/>
504                                                 <thead>
505                                                         <row>
506                                                                 <entry>Keyword</entry>
507                                                                 <entry>Description</entry>
508                                                         </row>
509                                                 </thead>
510                                                 <tbody>
511                                                         <row>
512                                                                 <entry>debian-lenny</entry>
513                                                                 <entry>for Debian Lenny (5.0), the most recent version</entry>
514                                                         </row>
515                                                         <row>
516                                                                 <entry>debian-etch</entry>
517                                                                 <entry>for Debian Etch (4.0)</entry>
518                                                         </row>
519                                                         <row>
520                                                                 <entry>ubuntu-karmic</entry>
521                                                                 <entry>for Ubuntu Lucid (10.04) [same as for Karmic]</entry>
522                                                         </row>
523                                                         <row>
524                                                                 <entry>ubuntu-karmic</entry>
525                                                                 <entry>for Ubuntu Karmic (9.10)</entry>
526                                                         </row>
527                                                         <row>
528                                                                 <entry>ubuntu-intrepid</entry>
529                                                                 <entry>for Ubuntu Intrepid (8.10)</entry>
530                                                         </row>
531                                                         <row>
532                                                                 <entry>ubuntu-hardy</entry>
533                                                                 <entry>for Ubuntu Hardy (8.04)</entry>
534                                                         </row>
535                                                         <row>
536                                                                 <entry>ubuntu-gutsy</entry>
537                                                                 <entry>for Ubuntu Gutsy (7.10)</entry>
538                                                         </row>
539                                                         <row>
540                                                                 <entry>gentoo</entry>
541                                                                 <entry>generic for Gentoo versions</entry>
542                                                         </row>
543                                                         <row>
544                                                                 <entry>centos</entry>
545                                                                 <entry>generic for Centos versions</entry>
546                                                         </row>
547                                                 </tbody>
548                                         </tgroup>
549                                 </table>
550                                 <indexterm>
551                                         <primary>ZZZ-REVIEW</primary>
552                                         <secondary>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </secondary>
553                                 </indexterm>
554                                 <caution>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </caution>
555                         </section>
556                         <section>
557                                 <title>(OPTIONAL) Install the PostgreSQL Server</title>
558                                 <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>
559                                 <para>For further information on installing PostgreSQL, see <xref linkend="serversideinstallation-postgresql"/>.</para>
560                                 <para>If your PostgreSQL server will be on the same system as your Evergreen software, then as the <systemitem class="username">root</systemitem> user install the required PostgreSQL server packages:</para>
561                                 <figure>
562                                         <title>Commands to install the PostgreSQL server</title>
563                                         <screen>
564                                         $ su - root
566                                         # Debian Lenny and Ubuntu Hardy (8.04)
567                                         $ make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_83
568                                         ...
570                                         # Ubuntu Karmic (9.10) and Ubuntu Lucid (10.04)
571                                         $ make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_84
572                                         ...
573                                         </screen>
574                                 </figure>
575                                 <note>
576                                         <para>
577                                                 <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>
578                                         </para>
579                                 </note>
580                                 <indexterm>
581                                         <primary>ZZZ-REVIEW</primary>
582                                         <secondary>VERIFY: IS THIS STILL TRUE? </secondary>
583                                 </indexterm>
584                                 <caution>VERIFY: IS THIS STILL TRUE? </caution>
585                                 <indexterm>
586                                         <primary>ZZZ-REVIEW</primary>
587                                         <secondary>ADD INFO ON HOW TO DETERMINE WHICH VERSION OF POSTGRESQL YOU HAVE </secondary>
588                                 </indexterm>
589                                 <caution>ADD INFO ON HOW TO DETERMINE WHICH VERSION OF POSTGRESQL YOU HAVE </caution>
590                         </section>
591                         <section>
592                                 <title>(OPTIONAL) Install Perl Modules on PostgreSQL Server</title>
593                                 <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>
594                                 <para>Otherwise, if your PostgreSQL server is running on another system, then as the <systemitem class="username">root</systemitem> user install the following Perl modules on that system:</para>
595                                 <figure>
596                                         <title>Commands to install Perl modules</title>
597                                         <screen>
598                                         # ensure the gcc compiler is installed
599                                         $ su - root
600                                         $ aptitude install gcc
602                                         # install the Perl modules
603                                         $ perl -MCPAN -e shell
604                                         cpan> install JSON::XS
605                                         cpan> install MARC::Record
606                                         cpan> install MARC::File::XML
607                                         </screen>
608                                 </figure>
609                                 <indexterm>
610                                         <primary>ZZZ-REVIEW</primary>
611                                         <secondary>ADD INFO ON HOW TO INSTALL THE PERL MODULES </secondary>
612                                 </indexterm>
613                                 <caution>ADD INFO ON HOW TO INSTALL THE PERL MODULES </caution>
614                                 <indexterm>
615                                         <primary>ZZZ-REVIEW</primary>
616                                         <secondary>ADD INFO ON HOW TO VERIFY THAT THE PERL MODULES ARE INSTALLED </secondary>
617                                 </indexterm>
618                                 <caution>ADD INFO ON HOW TO VERIFY THAT THE PERL MODULES ARE INSTALLED </caution>
619                         </section>
620                         <section>
621                                 <title>Update the System Dynamic Library Path</title>
622                                 <para>As the <systemitem class="username">root</systemitem> user, you must update the system dynamic library path to make your system recognize the newly installed libraries. Do this by creating the new file <filename>/etc/ld.so.conf.d/eg.conf</filename> containing two new library paths, then run the command <command>ldconfig</command> to automatically read the file and modify the system dynamic library path:</para>
623                                 <figure>
624                                         <title>Commands to modify system dynamic library path</title>
625                                         <screen>
626                                         $ su - root
627                                         $ cat > /etc/ld.so.conf.d/eg.conf &lt;&lt; ENDOFFILE
628                                         /usr/local/lib
629                                         /usr/local/lib/dbd
630                                         ENDOFFILE
631                                         $ ldconfig
632                                         </screen>
633                                 </figure>
634                         </section>
635                         <section>
636                                 <title>(OPTIONAL) Restart the PostgreSQL Server</title>
637                                 <para>If PostgreSQL is running on the same system as the rest of Evergreen, as the <systemitem class="username">root</systemitem> user you must restart the PostgreSQL server to avoid a problem where the library <filename>plperl.so</filename> cannot be found. If your PostgreSQL server is running on another system, just skip this step.</para>
638                                 <indexterm>
639                                         <primary>ZZZ-REVIEW</primary>
640                                         <secondary>ADD INFO ON OTHER VERSIONS OF POSTGRESQL </secondary>
641                                 </indexterm>
642                                 <caution>ADD INFO ON OTHER VERSIONS OF POSTGRESQL </caution>
643                                 <figure>
644                                         <title>Commands to restart PostgreSQL server</title>
645                                         <screen>
646                                         $ su - root
647                                         $ /etc/init.d/postgresql-PGSQL_VERSION restart
648                                         </screen>
649                                 </figure>
650                                 <emphasis>Where <literal>PGSQL_VERSION</literal> is your installed PostgreSQL version (e.g. <literal>8.3</literal>).</emphasis>
651                         </section>
652                         <section xml:id="serversideinstallation-configure">
653                                 <title>Configure Evergreen</title>
654                                 <para>As the <systemitem class="username">opensrf</systemitem> user, return to the Evergreen build directory and use the <command>configure</command> utility to prepare for the next step of compiling and linking the software:</para>
655                                 <figure>
656                                         <title>Commands to configure Evergreen</title>
657                                         <screen>
658                                         $ su - opensrf
659                                         $ cd /home/opensrf/Evergreen-ILS-
660                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf
661                                         $ make
662                                         ...
663                                         </screen>
664                                 </figure>
665                         </section>
666                         <section xml:id="serversideinstallation-compilingevergreen">
667                                 <title>Compile, Link and Install Evergreen</title>
668                                 <para>In this step you will actually compile, link and install Evergreen and the default Evergreen Staff Client.</para>
669                                 <para>As the <systemitem class="username">root</systemitem> user, return to the Evergreen build directory and use the <command>make</command> utility as shown below. The Staff Client will also be automatically built, but you must remember to set the variable <envar>STAFF_CLIENT_BUILD_ID</envar> to match the version of the Staff Client you will use to connect to the Evergreen server.</para>
670                                 <para>For further information on manually building the Staff Client, see <xref linkend="serversideinstallation-building-staffclient"/>.</para>
671                                 <figure>
672                                         <title>Commands to build, link and install Evergreen</title>
673                                         <screen>
674                                         $ su - root
675                                         $ cd /home/opensrf/Evergreen-ILS-
676                                         $ make STAFF_CLIENT_BUILD_ID=rel_1_6_0_7 install
677                                         ...
678                                         </screen>
679                                         <para>The above commands will create a new subdirectory <filename class="directory">/openils/var/web/xul/rel_1_6_0_7</filename> containing the Staff Client.</para>
680                                 </figure>
681                                 <para>To complete the Staff Client installation, as the <systemitem class="username">root</systemitem> user create a symbolic link named <emphasis>server</emphasis> in the head of the Staff Client directory <filename class="directory">/openils/var/web/xul</filename> that points to the subdirectory <filename class="directory">/server</filename> of the new Staff Client build:</para>
682                                 <figure>
683                                         <title>Commands to create symbolic link</title>
684                                         <screen>
685                                         $ su - root
686                                         $ cd /openils/var/web/xul
687                                         $ ln -sf rel_1_6_0_7/server server
688                                         </screen>
689                                 </figure>
690                         </section>
691                         <section>
692                                 <title>Copy the OpenSRF Configuration Files</title>
693                                 <para>As the <systemitem class="username">root</systemitem> user, copy the example OpenSRF configuration files into place. This replaces the configuration files that you set up in a previous step when you installed and tested OpenSRF. You should also create backup copies of the old files for troubleshooting purposes. Finally, change the ownership on the installed files to the <systemitem class="username">opensrf</systemitem> user:</para>
694                                 <figure>
695                                         <title>Commands to copy OpenSRF configuration files</title>
696                                         <screen>
697                                         $ su - root
698                                         $ cp /openils/conf/opensrf.xml.example      /openils/conf/opensrf.xml
699                                         $ cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
700                                         $ cp /openils/conf/oils_web.xml.example     /openils/conf/oils_web.xml
701                                         $ chown -R opensrf:opensrf /openils/
702                                         </screen>
703                                 </figure>
704                         </section>
705                         <section>
706                                 <title>Create and Configure PostgreSQL Database</title>
707                                 <para>As the <systemitem class="username">postgres</systemitem> user on your PostgreSQL server, create the Evergreen database.</para>
708                                 <para>In the commands below, remember to adjust the path of the <emphasis role="bold">contrib</emphasis> repository to match your PostgreSQL server layout. For example, if you built PostgreSQL from source the path would be <filename class="directory">/usr/local/share/contrib</filename>; if you installed the PostgreSQL 8.3 server packages on <systemitem class="osname">Ubuntu 8.04</systemitem>, the path would be <filename class="directory">/usr/share/postgresql/8.3/contrib/</filename>.</para>
709                                 <procedure>
710                                         <step>
711                                                 <para>
712                                                         <emphasis role="bold">Create and configure the database</emphasis>
713                                                 </para>
714                                                 <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL system create the PostgreSQL database, then set some internal paths:</para>
715                                                 <figure>
716                                                         <title>Commands to create database and adjust the path</title>
717                                                         <screen>
718                                                         # create the database
719                                                         $ su - postgres
720                                                         $ createdb -E UNICODE evergreen
721                                                         $ createlang plperl   evergreen
722                                                         $ createlang plperlu  evergreen
723                                                         $ createlang plpgsql  evergreen
725                                                         # adjust the paths
726                                                         $ psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/tablefunc.sql evergreen
727                                                         $ psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/tsearch2.sql  evergreen
728                                                         $ psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/pgxml.sql     evergreen
729                                                         </screen>
730                                                 </figure>
731                                                 <emphasis>Where <literal>PGSQL_VERSION</literal> is your installed PostgreSQL version (e.g. <literal>8.3</literal>).</emphasis>
732                                         </step>
733                                         <step>
734                                                 <para>
735                                                         <emphasis role="bold">Create new Evergreen superuser</emphasis>
736                                                 </para>
737                                                 <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL system, create the new database <systemitem class="username">evergreen</systemitem> user and assign a password:</para>
738                                                 <figure>
739                                                         <title>Commands to create the <systemitem class="username">evergreen</systemitem> user</title>
740                                                         <screen>
741                                                         # create superuser 'evergreen' and set the password
742                                                         $ su - postgres
743                                                         $ createuser -P -s evergreen
744                                                         Enter password for new role: MYNEWPASSWORD
745                                                         Enter it again: MYNEWPASSWORD
746                                                         </screen>
747                                                 </figure>
748                                                 <emphasis>Where <literal>MYNEWPASSWORD</literal> is the password chosen.</emphasis>
749                                         </step>
750                                 </procedure>
751                         </section>
752                         <section>
753                                 <title>Create Database Schema</title>
754                                 <para>As the <systemitem class="username">root</systemitem> user, create the database schema and configure your system with the corresponding database authentication details for the <emphasis>evergreen</emphasis> database user that you created in the previous step.</para>
755                                 <para>Enter the following commands and replace <emphasis>HOSTNAME, PORT, PASSWORD</emphasis> and <emphasis>DATABASENAME</emphasis> with appropriate values.</para>
756                                 <figure>
757                                         <title>Commands to create Evergreen database schema</title>
758                                         <screen>
759                                         $ su - root
760                                         $ cd /home/opensrf/Evergreen-ILS-
761                                         $ perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
762                                                 --service all --create-schema --create-bootstrap --create-offline \
763                                                 --hostname HOSTNAME --port PORT \
764                                                 --user evergreen --password PASSWORD --database DATABASENAME
765                                         </screen>
766                                 </figure>
767                                 <emphasis>Where, on most systems, <emphasis>HOSTNAME</emphasis> will be <emphasis role="bold">localhost</emphasis>, <emphasis>PORT</emphasis> will be <emphasis role="bold">5432</emphasis>, and <emphasis>PASSWORD</emphasis> and <emphasis>DATABASENAME</emphasis> will be those assigned when PostgreSQL was installed in the previous step.</emphasis>
768                                 <note>
769                                         <para>
770                                                 <emphasis>If you are entering the above command on a single line, do not include the <literal>\</literal> (backslash) characters. If you are using the <command>bash</command> 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>
771                                         </para>
772                                 </note>
773                         </section>
774                         <section xml:id="serversideinstallation-modify-apache">
775                                 <title>Modify the Apache Configuration</title>
776                                 <para>The Apache configuration must be updated in several ways to support Evergreen.</para>
777                                 <section>
778                                         <title>Configure the Apache Server</title>
779                                         <para>Enable some built-in Apache modules with the utility <command>a2enmod</command>, and install some additional Apache configuration files. As the <systemitem class="username">root</systemitem> user, enable some modules in the Apache server, then copy the new configuration files to the Apache server directories:</para>
780                                         <figure>
781                                                 <title>Commands to configure the Apache server</title>
782                                                 <screen>
783                                                 # configure the Apache server
784                                                 $ su - root
785                                                 $ a2enmod ssl        # enable mod_ssl
786                                                 $ a2enmod rewrite    # enable mod_rewrite
787                                                 $ a2enmod expires    # enable mod_expires
788                                                 $ cd /home/opensrf/Evergreen-ILS-1.x.x.x
790                                                 # copy files
791                                                 $ cp Open-ILS/examples/apache/eg.conf    /etc/apache2/sites-available/
792                                                 $ cp Open-ILS/examples/apache/eg_vhost.conf   /etc/apache2/
793                                                 $ cp Open-ILS/examples/apache/startup.pl      /etc/apache2/
794                                                 </screen>
795                                         </figure>
796                                 </section>
797                                 <section xml:id="serversideinstallation-createsslkey">
798                                         <title>Create a Security Certificate (SSL Key)</title>
799                                         <para>Create a new SSL key for the Apache server with the command <command>openssl</command>. 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>
800                                         <figure>
801                                                 <title>Commands to create an SSL key</title>
802                                                 <screen>
803                                                 $ mkdir /etc/apache2/ssl
804                                                 $ cd /etc/apache2/ssl
805                                                 $ openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
806                                                 </screen>
807                                         </figure>
808                                         <warning>
809                                                 <para>
810                                                         <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.</emphasis>
811                                                 </para>
812                                                 <para>For further information on getting a proper SSL certificate, see <xref linkend="serversideinstallation-ssl"/>.</para>
813                                         </warning>
814                                 </section>
815                                 <section>
816                                         <title>Modify the Apache Configuration File</title>
817                                         <para>Several changes are needed in the new Apache configuration file <filename>/etc/apache2/sites-available/eg.conf</filename>. As the <systemitem class="username">root</systemitem> user, edit the file and make the following changes:</para>
818                                         <procedure>
819                                                 <step>
820                                                         <para>Comment out the line <literal>Allow from</literal>, then uncomment the line <literal>Allow from all</literal>.</para>
821                                                         <para>
822                                                                 <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>
823                                                         </para>
824                                                         <warning>
825                                                                 <para>
826                                                                         <emphasis>You must remove these changes after testing is completed. See <xref linkend="serversideinstallation-postinstallation"/> for further details on removing this change after the Evergreen installation is complete.</emphasis>
827                                                                 </para>
828                                                         </warning>
829                                                 </step>
830                                                 <step>
831                                                         <para>Comment out the line <literal>Listen 443</literal>, since it conflicts with the same declaration in the configuration file: <filename>/etc/apache2/ports.conf</filename>. <systemitem class="osname">Debian Etch</systemitem> users should not do this.</para>
832                                                         <indexterm>
833                                                                 <primary>ZZZ-REVIEW</primary>
834                                                                 <secondary>ADD INFO ON WHY DEBIAN ETCH USERS SHOULD NOT DO THIS </secondary>
835                                                         </indexterm>
836                                                         <caution>ADD INFO ON WHY DEBIAN ETCH USERS SHOULD NOT DO THIS </caution>
837                                                 </step>
838                                                 <step>
839                                                         <warning>
840                                                                 <para>The following updates are needed to allow the logs to function properly, but it may break other Apache applications on your server.</para>
841                                                         </warning>
842                                                         <itemizedlist>
843                                                                 <listitem>
844                                                                         <para>For the <systemitem class="osname">Linux</systemitem> distributions <systemitem class="osname">Ubuntu Hardy</systemitem> or <systemitem class="osname">Debian Etch</systemitem>, as the <systemitem class="username">root</systemitem> user, edit the Apache configuration file <filename>/etc/apache2/apache2.conf</filename> and change the phrase: <literal>User www-data</literal> to the phrase: <literal>User opensrf</literal>.</para>
845                                                                 </listitem>
846                                                                 <listitem>
847                                                                         <para>For the <systemitem class="osname">Linux</systemitem> distributions <systemitem class="osname">Ubuntu Karmic</systemitem> or <systemitem class="osname">Ubuntu Lucid</systemitem> or <systemitem class="osname">Debian Lenny</systemitem>, as the <systemitem class="username">root</systemitem> user, edit the Apache configuration file <filename>/etc/apache2/envvars</filename> and change the phrase: <literal>export APACHE_RUN_USER=www-data</literal> to the phrase: <literal>export APACHE_RUN_USER=opensrf</literal>.</para>
848                                                                 </listitem>
849                                                         </itemizedlist>
850                                                 </step>
851                                                 <step>
852                                                         <para>As the <systemitem class="username">root</systemitem> user, edit the Apache configuration file <filename>/etc/apache2/apache2.conf</filename> and add the lines <literal>KeepAliveTimeout 1</literal> and <literal>MaxKeepAliveRequests 100</literal>, or modify any existing lines.</para>
853                                                 </step>
854                                         </procedure>
855                                 </section>
856                                 <section>
857                                         <title>(OPTIONAL) Performance Modifications for Apache</title>
858                                         <para>Some further configuration changes to Apache may be necessary for busy systems. These changes increase the number of Apache server processes that are started to support additional browser connections.</para>
859                                         <procedure>
860                                                 <step>As the <systemitem class="username">root</systemitem> user, edit the Apache configuration file <filename>/etc/apache2/apache2.conf</filename>, locate and modify the section related to <emphasis>prefork configuration</emphasis> to suit the load on your system.</step>
861                                                 <figure>
862                                                         <title>(OPTIONAL) Example of updates to Apache configuration</title>
863                                                         <programlisting language="xml"><![CDATA[
864                                                         <IfModule mpm_prefork_module>
865                                                            StartServers           20
866                                                            MinSpareServers         5
867                                                            MaxSpareServers        15
868                                                            MaxClients            150
869                                                            MaxRequestsPerChild 10000
870                                                         </IfModule>
871                                                         ]]></programlisting>
872                                                 </figure>
873                                         </procedure>
874                                 </section>
875                                 <section>
876                                         <title>Enable the Evergreen Web Site</title>
877                                         <para>Finally, as the <systemitem class="username">root</systemitem> user, execute the following Apache configuration commands to disable the default <emphasis>It Works</emphasis> web page and to enable the Evergreen web site:</para>
878                                         <figure>
879                                                 <title>Commands to enable the Evergreen Web Site</title>
880                                                 <screen>
881                                                 $ su - root
883                                                 # disable the default site
884                                                 $ a2dissite default
886                                                 # enable the Evergreen web site
887                                                 $ a2ensite eg.conf
888                                                 </screen>
889                                         </figure>
890                                 </section>
891                         </section>
892                         <section xml:id="serversideinstallation-opensrf-config">
893                                 <title>Modify the OpenSRF Configuration File</title>
894                                 <para>As the <systemitem class="username">opensrf</systemitem> user, edit the OpenSRF configuration file <filename>/openils/conf/opensrf_core.xml</filename> to update the Jabber usernames and passwords, and to specify the domain from which we will accept and to which we will make connections.</para>
895                                 <para>If you are installing Evergreen on a single server and using the <systemitem class="domainname">private.localhost</systemitem> / <systemitem class="domainname">public.localhost</systemitem> domains, these will already be set to the correct values. Otherwise, search and replace to match your customized values.</para>
896                                 <note>
897                                         <para>
898                                                 <emphasis>The following example uses common XPath syntax on the left-hand side to indicate the approximate position needing changes within the XML file:</emphasis>
899                                         </para>
900                                 </note>
901                                 <indexterm>
902                                         <primary>ZZZ-REVIEW</primary>
903                                         <secondary>ADD A BETTER DIAGRAM HERE </secondary>
904                                 </indexterm>
905                                 <caution>ADD A BETTER DIAGRAM HERE </caution>
906                                 <figure>
907                                         <title>Updates needed in the file <filename>/openils/conf/opensrf_core.xml</filename></title>
908                                         <screen>
909                                         /config/opensrf/username = opensrf
911                                         /config/opensrf/passwd = password for "private.localhost" opensrf user
913                                         /config/gateway/username = opensrf
915                                         /config/gateway/passwd = password for "public.localhost" opensrf user
917                                         # first entry, where "transport/server" == "public.localhost" :
918                                         /config/routers/router/transport 
919                                             username = router
920                                             password = password for "public.localhost" router user
922                                         # second entry, where "transport/server" == "private.localhost" :
923                                         /config/routers/router/transport
924                                             username = router
925                                             password = password for "private.localhost" router user
926                                         </screen>
927                                 </figure>
928                         </section>
929                         <section xml:id="serversideinstallation-srfsh">
930                                 <title>Create Configuration Files for Users Needing <application>srfsh</application></title>
931                                 <para>The software installation will automatically create a utility named <application>srfsh</application> (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 <xref linkend="serversideinstallation-testing"/> for further information.</para>
932                                 <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 <filename>/openils/conf/srfsh.xml.example</filename> to the file <filename>.srfsh.xml</filename> (note the leading dot!) in the home directory of each user who will use <application>srfsh</application>. Finally, edit each users' <filename>.srfsh.xml</filename> file and make the following changes:</para>
933                                 <procedure>
934                                         <step>Modify <emphasis role="bold">domain</emphasis> to be the router hostname (following our domain examples, <systemitem class="domainname">private.localhost</systemitem>> will give <application>srfsh</application> access to all OpenSRF services, while <systemitem class="domainname">public.localhost</systemitem> will only allow access to those OpenSRF services that are publicly exposed).</step>
935                                         <step>Modify <emphasis role="bold">username</emphasis> and <emphasis role="bold">password</emphasis> to match the <systemitem class="username">opensrf</systemitem> Jabber user for the chosen domain</step>
936                                         <step>Modify <emphasis role="bold">logfile</emphasis> to be the full path for a log file to which the user has write access</step>
937                                         <step>Modify <emphasis role="bold">loglevel</emphasis> as needed for testing</step>
938                                 </procedure>
939                                 <figure>
940                                         <title>Example of user's file <filename>.srfsh.xml</filename></title>
941                                         <programlisting language="xml"><![CDATA[
942                                         <?xml version="1.0"?>
943                                         <!-- This file follows the standard bootstrap config file layout -->
944                                         <!-- found in opensrf_core.xml -->
945                                         <srfsh>
946                                         <router_name>router</router_name>
947                                         <domain>private.localhost</domain>
948                                         <username>opensrf</username>
949                                         <passwd>evergreen</passwd>
950                                         <port>5222</port>
951                                         <logfile>/tmp/srfsh.log</logfile>
952                                         <!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->
953                                         <loglevel>4</loglevel>
954                                         </srfsh>
955                                         ]]></programlisting>
956                                 </figure>
957                         </section>
958                         <section xml:id="serversideinstallation-opensrf-env">
959                                 <title>Modify the OpenSRF Environment</title>
960                                 <para>As the <systemitem class="username">opensrf</systemitem> user, change the permissions of <emphasis>.cgi</emphasis> files in the directory <filename class="directory">/openils/var/cgi-bin</filename> to <emphasis>executable</emphasis>, then modify the shell configuration file <filename>~/.bashrc</filename> for <systemitem class="username">opensrf</systemitem> by adding a Perl environmental variable. Finally, execute the shell configuration file to load the new variables into your current environment.</para>
961                                 <note>
962                                         <para>
963                                                 <emphasis>In a multi-server environment, you must add any modifications to <filename>~/.bashrc</filename> to the top of the file <emphasis>before</emphasis> the line <literal>[ -z "$PS1" ] &amp;&amp; return </literal>. This will allow headless (scripted) logins to load the correct environment.</emphasis>
964                                         </para>
965                                 </note>
966                                 <figure>
967                                         <title>Commands to modify the OpenSRF environment</title>
968                                         <screen>
969                                         # change permissions
970                                         $ su - opensrf
971                                         $ chmod 755 /openils/var/cgi-bin/*.cgi
973                                         # add environmental variable
974                                         $ echo "export PERL5LIB=/openils/lib/perl5:\$PERL5LIB" >> ~/.bashrc
976                                         # inherit the new environment
977                                         $ . ~/.bashrc
978                                         </screen>
979                                 </figure>
980                         </section>
981                         <section xml:id="serversideinstallation-localization">
982                                 <title>(OPTIONAL) Enabling and Disabling Language Localizations</title>
983                                 <para>Current versions of Evergreen (after version 1.4) are bundled with support for a number of languages beyond American English (<emphasis role="bold">en-US</emphasis>). The translated interfaces are split between static files that are automatically installed with Evergreen, and dynamic labels that can be stored in the Evergreen database. Evergreen is installed with additional SQL files that contain translated dynamic labels for a number of languages, and to make the set of translated labels available in all interfaces. Only a few steps are required to enable or disable one or more languages.</para>
984                                 <section>
985                                         <title>Enabling a Localization</title>
986                                         <para>To enable the translated labels for a given language to display in Evergreen, just populate the database with the translated labels and enable the localization. The following example illustrates how to enable Canadian French (<emphasis role="bold">fr-CA</emphasis>) support in the database. These same steps can be used with any of the languages bundled with Evergreen, or you can create and add your own localization.</para>
987                                         <orderedlist>
988                                                 <listitem>
989                                                         <para>The translated labels for each locale are stored in SQL files named "950.data.seed-values-xx-YY.sql" where "xx-YY" represents the locale code for the translation. Load the translated labels into the Evergreen database using the command <command>psql</command>, substituting your user, host and database connection information accordingly:</para>
990                                                         <figure>
991                                                                 <title>Commands to load localizations into database</title>
992                                                                 <programlisting language="xml"><![CDATA[
993                                                                 $ psql -U <username> -h <hostname> -d <database> -f /path/to/Evergreen-source/Open-ILS/src/sql/Pg/950.data.seed-values-fr-CA.sql
994                                                                 ]]></programlisting>
995                                                         </figure>
996                                                 </listitem>
997                                                 <listitem>
998                                                         <para>Ensure the locale is enabled in the Evergreen database by using the utility <command>psql</command> to check for the existence of the locale in the table <literal>config.i18n_locale</literal>:</para>
999                                                         <figure>
1000                                                                 <title>Commands to check for localization</title>
1001                                                                 <screen>
1002                                                                 SELECT code, marc_code, name, description
1003                                                                 FROM config.i18n_locale
1004                                                                 WHERE code = 'fr-CA';
1005                                                                 </screen>
1006                                                         </figure>
1007                                                         <para>As shown in the following example, if one row of output is returned, then the locale is already enabled:</para>
1008                                                         <figure>
1009                                                                 <title>Results of an installed localization</title>
1010                                                                 <screen>
1011                                                                 code  | marc_code |      name       |   description   
1012                                                                 ------+-----------+-----------------+-----------------
1013                                                                 fr-CA | fre       | French (Canada) | Canadian French
1014                                                                 (1 row)
1015                                                                 </screen>
1016                                                         </figure>
1017                                                         <para>If zero rows of output are returned, then the locale is not enabled:</para>
1018                                                         <figure>
1019                                                                 <title>Results of no installed localizations</title>
1020                                                                 <screen>
1021                                                                 code | marc_code | name | description 
1022                                                                 ------+-----------+------+-------------
1023                                                                 (0 rows)
1024                                                                 </screen>
1025                                                         </figure>
1026                                                         <para>To enable a locale, use <command>psql</command> to insert a row into the table <literal>config.i18n_locale</literal> as follows:</para>
1027                                                         <figure>
1028                                                                 <title>Commands to enable a locale in the database</title>
1029                                                                 <screen>
1030                                                                 INSERT INTO config.i18n_locale (code, marc_code, name, description)
1031                                                                 VALUES ('fr-CA', 'fre', 'French (Canada)', 'Canadian French');
1032                                                                 </screen>
1033                                                         </figure>
1034                                                 </listitem>
1035                                         </orderedlist>
1036                                 </section>
1037                                 <section>
1038                                         <title>Disabling a Localization</title>
1039                                         <para>You might not want to offer all of the localizations that are preconfigured in Evergreen. If you choose to disable the dynamic labels for a locale, just delete those entries from the table <literal>config.i18n_locale</literal> using the <command>psql</command> utility:</para>
1040                                         <figure>
1041                                                 <title>Commands to delete localization from table</title>
1042                                                 <screen>
1043                                                 DELETE FROM config.i18n_locale
1044                                                 WHERE code = 'fr-CA';
1045                                                 </screen>
1046                                         </figure>
1047                                 </section>
1048                         </section>
1049                         <section xml:id="serversideinstallation-starting">
1050                                 <title>Starting Evergreen</title>
1051                                 <procedure>
1052                                         <step>
1053                                                 <para>As the <systemitem class="username">root</systemitem> user, start the <systemitem class="service">ejabberd</systemitem> and <systemitem class="service">memcached</systemitem> services (if they are not already running):</para>
1054                                                 <figure>
1055                                                         <title>Commands to start <systemitem class="service">ejabberd</systemitem> and <systemitem class="service">memcached</systemitem> services</title>
1056                                                         <screen>
1057                                                         $ su - root
1058                                                         $ /etc/init.d/ejabberd start
1059                                                         $ /etc/init.d/memcached start
1060                                                         </screen>
1061                                                 </figure>
1062                                         </step>
1063                                         <step>
1064                                                 <para>As the <systemitem class="username">opensrf</systemitem> user, start Evergreen.</para>
1065                                                 <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>
1066                                                 <figure>
1067                                                         <title>Commands to start Evergreen</title>
1068                                                         <screen>
1069                                                         $ su - opensrf
1071                                                         # ensure you have the needed path
1072                                                         $ export PATH=$PATH:/openils/bin
1074                                                         # start the OpenSRF service:
1075                                                         # use "-l" to force hostname to be "localhost"
1076                                                         $ osrf_ctl.sh -l -a start_all     
1077                                                         </screen>
1078                                                 </figure>
1079                                                 <note>
1080                                                         <para>
1081                                                                 <emphasis>You can also start Evergreen <emphasis role="bold">without</emphasis> the <option>-l</option> flag, but the <command>osrf_ctl.sh</command> utility 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 <filename>opensrf.xml</filename>, which you configured in a previous step.</emphasis>
1082                                                         </para>
1083                                                         <para>Execute the following command to determine the fully qualified domain name of your system:</para>
1084                                                         <figure>
1085                                                                 <title>(OPTIONAL) Commands to determine the fully qualified domain name</title>
1086                                                                 <screen>
1087                                                                 $ perl -e 'use Net::Domain qw(hostfqdn); print hostfqdn()."\n"'
1088                                                                 </screen>
1089                                                         </figure>
1090                                                 </note>
1091                                                 <indexterm>
1092                                                         <primary>ZZZ-REVIEW</primary>
1093                                                         <secondary>ADD EXPLANATION FOR CONFIGURING "opensrf.xml" </secondary>
1094                                                 </indexterm>
1095                                                 <caution>ADD EXPLANATION FOR CONFIGURING "opensrf.xml" </caution>
1096                                                 <itemizedlist>
1097                                                         <listitem>
1098                                                                 <para>If you receive an error message similar to <emphasis>osrf_ctl.sh: command not found</emphasis>, then your environment variable <envar>PATH</envar> does not include the directory <filename class="directory">/openils/bin</filename>. As the <systemitem class="username">opensrf</systemitem> user, edit the configuration file <filename>/home/opensrf/.bashrc</filename> and add the following line: <literal>export PATH=$PATH:/openils/bin</literal></para>
1099                                                         </listitem>
1100                                                         <listitem>
1101                                                                 <para>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 <filename class="directory">/openils/lib/perl5</filename>. As the <systemitem class="username">opensrf</systemitem> user, edit the configuration file <filename>/home/opensrf/.bashrc</filename> and add the following line: <literal>export PERL5LIB=$PERL5LIB:/openils/lib/perl5</literal></para>
1102                                                         </listitem>
1103                                                 </itemizedlist>
1104                                         </step>
1105                                         <step>
1106                                                 <para>As the <systemitem class="username">opensrf</systemitem> 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>
1107                                                 <para>You must do this the first time you start Evergreen, and after making any changes to the library hierarchy in the configuration file <filename>config.cgi</filename>.</para>
1108                                                 <figure>
1109                                                         <title>Commands to generate web files</title>
1110                                                         <screen>
1111                                                         $ su - opensrf
1112                                                         $ cd /openils/bin
1113                                                         $ ./autogen.sh -c /openils/conf/opensrf_core.xml -u
1114                                                         Updating Evergreen organization tree and IDL using '/openils/conf/opensrf_core.xml'
1115                                                         Updating fieldmapper
1116                                                         ...
1117                                                         </screen>
1118                                                 </figure>
1119                                                 <indexterm>
1120                                                         <primary>ZZZ-REVIEW</primary>
1121                                                         <secondary>ADD RESULTS OF TESTS FROM "autogen.sh" </secondary>
1122                                                 </indexterm>
1123                                                 <caution>ADD RESULTS OF TESTS FROM <filename>autogen.sh</filename> </caution>
1124                                         </step>
1125                                         <step>
1126                                                 <para>As the <systemitem class="username">root</systemitem> user, restart the Apache Web server:</para>
1127                                                 <figure>
1128                                                         <title>Commands to restart Apache web server</title>
1129                                                         <screen>
1130                                                         $ su - root
1131                                                         $ /etc/init.d/apache2 restart
1132                                                         </screen>
1133                                                 </figure>
1134                                                 <note>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.</note>
1135                                         </step>
1136                                 </procedure>
1137                         </section>
1138                         <section xml:id="serversideinstallation-testing">
1139                                 <title>Testing the Installation</title>
1140                                 <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>
1141                                 <section xml:id="serversideinstallation-testing-connections">
1142                                         <title>Testing Connections to Evergreen</title>
1143                                         <para>Once you have installed and started Evergreen, test your connection to Evergreen. As the <systemitem class="username">opensrf</systemitem> user start the <application>srfsh</application> application 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>
1144                                         <figure>
1145                                                 <title>Commands to test Evergreen with <application>srfsh</application></title>
1146                                                 <screen>
1147                                                 $ su - opensrf
1148                                                 $ /openils/bin/srfsh
1149                                                 srfsh% login admin open-ils
1150                                                 Received Data: "250bf1518c7527a03249858687714376"
1151                                                 ------------------------------------
1152                                                 Request Completed Successfully
1153                                                 Request Time in seconds: 0.045286
1154                                                 ------------------------------------
1155                                                 Received Data: {
1156                                                    "ilsevent":0,
1157                                                    "textcode":"SUCCESS",
1158                                                    "desc":" ",
1159                                                    "pid":21616,
1160                                                    "stacktrace":"oils_auth.c:304",
1161                                                    "payload":{
1162                                                       "authtoken":"e5f9827cc0f93b503a1cc66bee6bdd1a",
1163                                                       "authtime":420
1164                                                    }
1165                                                 }
1166                                                 ------------------------------------
1167                                                 Request Completed Successfully
1168                                                 Request Time in seconds: 1.336568
1169                                                 ------------------------------------
1170                                                 </screen>
1171                                         </figure>
1172                                 </section>
1173                                 <section>
1174                                         <title>Other Connection Tests with <application>srfsh</application></title>
1175                                         <para></para>
1176                                         <para>There is another <application>srfsh</application> command called <command>math_bench</command> that sends queries to the math servers. Note that the <systemitem class="service">opensrf.math</systemitem> and <systemitem class="service">opensrf.dbmath</systemitem> must be running for this command to work:</para>
1177                                         <figure>
1178                                                 <title>Example of math_bench usage</title>
1179                                                 <screen>
1180                                                 srfsh# math_bench 10
1181                                                 |.........|.........|.........|.........|.........|.........|.........|.........|.........|.........
1182                                                 ++++++++++++++++++++++++++++++++++++++++
1183                                                 Average round trip time: 0.033425
1184                                                 srfsh#
1185                                                 </screen>
1186                                         </figure>
1187                                         <para>The first argument is how many sets of 4 queries (+ - * /) are sent to <systemitem class="service">opensrf.math</systemitem>. When the response is successful, you will see the string of <literal>+</literal> symbols. If the system is not running correctly, you will either get an exception or no result at all.</para>
1188                                         <para>For other <application>srfsh</application> commands, type <userinput>help</userinput> in at the prompt.</para>
1189                                         <para/>
1190                                         <para>If this does not work, try the troubleshooting steps in the following section.</para>
1191                                 </section>
1192                                 <section>
1193                                         <title>Testing with <application>settings-tester.pl</application></title>
1194                                         <para>As the <systemitem class="username">opensrf</systemitem> user, run the script <command>settings-tester.pl</command> to see if it finds any system configuration problems. Following is sample output generated by executing that script after a successful Evergreen installation:</para>
1195                                         <section>
1196                                                 <title>Example of execution of <command>settings-tester.pl</command></title>
1197                                                 <programlisting language="xml"><![CDATA[
1198                                                 $ su - root
1199                                                 $ cd /home/opensrf/Evergreen-ILS-
1200                                                 $ perl Open-ILS/src/support-scripts/settings-tester.pl
1201                                                 LWP::UserAgent version 5.810
1202                                                 XML::LibXML version 1.70
1203                                                 XML::LibXML::XPathContext version 1.70
1204                                                 XML::LibXSLT version 1.70
1205                                                 Net::Server::PreFork version 0.97
1206                                                 Cache::Memcached version 1.24
1207                                                 Class::DBI version 0.96
1208                                                 Class::DBI::AbstractSearch version 0.07
1209                                                 Template version 2.19
1210                                                 DBD::Pg version 2.8.2
1211                                                 Net::Z3950::ZOOM version 1.24
1212                                                 MARC::Record version 2.0.0
1213                                                 MARC::Charset version 1.1
1214                                                 MARC::File::XML version 0.92
1215                                                 Text::Aspell version 0.04
1216                                                 CGI version 3.29
1217                                                 DateTime::TimeZone version 0.7701
1218                                                 DateTime version 0.42
1219                                                 DateTime::Format::ISO8601 version 0.06
1220                                                 DateTime::Format::Mail version 0.3001
1221                                                 Unix::Syslog version 1.1
1222                                                 GD::Graph3d version 0.63
1223                                                 JavaScript::SpiderMonkey version 0.19
1224                                                 Log::Log4perl version 1.16
1225                                                 Email::Send version 2.192
1226                                                 Text::CSV version 1.06
1227                                                 Text::CSV_XS version 0.52
1228                                                 Spreadsheet::WriteExcel::Big version 2.20
1229                                                 Tie::IxHash version 1.21
1230                                                 Parse::RecDescent version 1.95.1
1231                                                 SRU version 0.99
1232                                                 JSON::XS version 2.27
1234                                                 Checking Jabber connection for user opensrf, domain private.localhost
1235                                                 * Jabber successfully connected
1237                                                 Checking Jabber connection for user opensrf, domain public.localhost
1238                                                 * Jabber successfully connected
1240                                                 Checking Jabber connection for user router, domain public.localhost
1241                                                 * Jabber successfully connected
1243                                                 Checking Jabber connection for user router, domain private.localhost
1244                                                 * Jabber successfully connected
1245                                                 ]]></programlisting>
1246                                                 <programlisting language="xml"><![CDATA[
1247                                                 Checking database connections
1248                                                 * /opensrf/default/reporter/setup :: Successfully connected to database dbi:Pg:dbname=evergreen;host=localhost;port=5432
1249                                                   * Database has the expected server encoding UTF8.
1250                                                 * /opensrf/default/apps/open-ils.storage/app_settings/databases :: Successfully connected to database dbi:Pg:dbname=evergreen;host=localhost;port=5432
1251                                                   * Database has the expected server encoding UTF8.
1252                                                 * /opensrf/default/apps/open-ils.cstore/app_settings :: Successfully connected to database dbi:Pg:dbname=evergreen;host=localhost;port=5432
1253                                                   * Database has the expected server encoding UTF8.
1254                                                 * /opensrf/default/apps/open-ils.pcrud/app_settings :: Successfully connected to database dbi:Pg:dbname=evergreen;host=localhost;port=5432
1255                                                   * Database has the expected server encoding UTF8.
1256                                                 * /opensrf/default/apps/open-ils.reporter-store/app_settings :: Successfully connected to database dbi:Pg:dbname=evergreen;host=localhost;port=5432
1257                                                   * Database has the expected server encoding UTF8.
1259                                                 Checking database drivers to ensure <driver> matches <language>
1260                                                 * OK: Pg language is undefined for reporter base configuration
1261                                                 * OK: Pg language is undefined for reporter base configuration
1262                                                 * OK: Pg language is perl in /opensrf/default/apps/open-ils.storage/language
1263                                                 * OK: pgsql language is C in /opensrf/default/apps/open-ils.cstore/language
1264                                                 * OK: pgsql language is C in /opensrf/default/apps/open-ils.pcrud/language
1265                                                 * OK: pgsql language is C in /opensrf/default/apps/open-ils.reporter-store/language
1267                                                 Checking libdbi and libdbi-drivers
1268                                                   * OK - found locally installed libdbi.so and libdbdpgsql.so in shared library path
1270                                                 Checking hostname
1271                                                  * OK: found hostname 'localhost' in <hosts> section of opensrf.xml
1272                                                 $
1273                                                 ]]></programlisting>
1274                                         </section>
1275                                         <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 in <xref linkend="troubleshooting"/>.</para>
1276                                         <para>If you have followed the entire set of installation steps listed here closely, you are probably extremely close to a working system. Gather your configuration files and log files and contact the <ulink url="http://open-ils.org/listserv.php">Evergreen development mailing list</ulink> for assistance before making any drastic changes to your system configuration.</para>
1277                                 </section>
1278                                 <section xml:id="serversideinstallation-testing-opac">
1279                                         <title>Testing the Catalog</title>
1280                                         <para>By default, the OPAC will live at the URL <uri>http://my.domain.com/opac/</uri>.</para>
1281                                         <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 <application>Firefox</application> browser because of the helpful javascript debugging tools.</para>
1282                                         <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>
1283                                         <indexterm>
1284                                                 <primary>ZZZ-REVIEW</primary>
1285                                                 <secondary>ADD OTHER SIMPLE FUNCTIONAL TESTS </secondary>
1286                                         </indexterm>
1287                                         <caution>ADD OTHER SIMPLE FUNCTIONAL TESTS </caution>
1288                                 </section>
1289                                 <section>
1290                                         <title>Running the Evergreen Staff Client</title>
1291                                         <para>Run the Evergreen Staff Client by using the application <application>XULRunner</application> (installed automatically and by default with Firefox version 3.0 and later on <systemitem class="osname">Ubuntu</systemitem> and <systemitem class="osname">Debian</systemitem> distributions).</para>
1292                                         <para>For example, if the source files for the Evergreen installation are in the directory <filename class="directory">/home/opensrf/Evergreen-ILS-</filename>, start the Staff Client as follows:</para>
1293                                         <figure>
1294                                                 <title>Commands to run the Staff Client</title>
1295                                                 <screen>
1296                                                 $ su - opensrf
1297                                                 $ xulrunner /home/opensrf/Evergreen-ILS-
1298                                                 </screen>
1299                                         </figure>
1300                                 </section>
1301                                 <section xml:id="serversideinstallation-starting-apache-server">
1302                                         <title>Testing the Apache Web Server</title>
1303                                         <para>Once you have started Evergreen and confirmed that a basic login attempt works, you can test and start the Apache web server.</para>
1304                                         <para>As the <systemitem class="username">root</systemitem> 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>
1305                                         <figure>
1306                                                 <title>Commands to test the Apache Web Server</title>
1307                                                 <screen>
1308                                                 $ su - root
1309                                                 $ apache2ctl configtest &amp;&amp; /etc/init.d/apache2 restart
1310                                                 </screen>
1311                                         </figure>
1312                                 </section>
1313                         </section>
1314                         <section xml:id="serversideinstallation-stopping">
1315                                 <title>Stopping Evergreen</title>
1316                                 <para>As the <systemitem class="username">opensrf</systemitem> user, stop all Evergreen services by using the following command:</para>
1317                                 <figure>
1318                                         <title>Commands to stop Evergreen</title>
1319                                         <screen>
1320                                         $ su - opensrf
1322                                         # stop the server:
1323                                         # use "-l" to force hostname to be "localhost"
1324                                         $ osrf_ctl.sh -l -a stop_all
1325                                         </screen>
1326                                 </figure>
1327                                 <note>
1328                                         <para>
1329                                                 <emphasis>You can also stop Evergreen services <emphasis role="bold">without</emphasis> the <option>-l</option> flag, but the <command>osrf_ctl.sh</command> utility 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 <filename>opensrf.xml</filename>, which you configured in a previous step.</emphasis>
1330                                         </para>
1331                                 </note>
1332                                 <indexterm>
1333                                         <primary>ZZZ-REVIEW</primary>
1334                                         <secondary>ADD EXPLANATION FOR CONFIGURING "opensrf.xml" </secondary>
1335                                 </indexterm>
1336                                 <caution>ADD EXPLANATION FOR CONFIGURING "opensrf.xml" </caution>
1337                         </section>
1338                         <section xml:id="serversideinstallation-postinstallation">
1339                                 <title>Post-Installation Chores</title>
1340                                 <para>There are a few additional steps to complete after Evergreen has been successfully installed and tested.</para>
1341                                 <section>
1342                                         <title>Remove temporary changes from Apache configuration file</title>
1343                                         <para>As the <systemitem class="username">root</systemitem> user, edit the Apache configuration file <filename>/etc/apache2/sites-available/eg.conf</filename> again and make the following change:</para>
1344                                         <para>Uncomment the line <literal>Allow from</literal>, then comment out the line <literal>Allow from all</literal>. You modified this file in an earlier step as a temporary measure to expedite testing (see <xref linkend="serversideinstallation-modify-apache"/> 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>
1345                                 </section>
1346                                 <section>
1347                                         <title>Configure a permanent SSL key</title>
1348                                         <para>In a previous step, we used the command <command>openssl</command> 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. For further information on getting a proper SSL certificate, see <xref linkend="serversideinstallation-ssl"/>.</para>
1349                                         <warning>
1350                                                 <para>
1351                                                         <emphasis>The temporary SSL key was only created to expedite testing. You <emphasis role="bold"> must</emphasis> get a proper SSL certificate for a public production system.</emphasis>
1352                                                 </para>
1353                                         </warning>
1354                                 </section>
1355                                 <section>
1356                                         <title>Set Up Support For Reports</title>
1357                                         <para>Evergreen reports are extremely powerful, but some configuration is required. See <xref linkend="report-introduction"/> for details.</para>
1358                                         <itemizedlist>
1359                                                 <listitem>
1360                                                         <para>Starting the Reporter Daemon</para>
1361                                                         <para>Once the <systemitem class="daemon">open-ils.reporter</systemitem> 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>
1362                                                         <para>As the <systemitem class="username">opensrf</systemitem> user, start the reporter daemon using the following command:</para>
1363                                                         <figure>
1364                                                                 <title>Commands to start the Reporter daemon</title>
1365                                                                 <screen>
1366                                                                 $ su - opensrf
1367                                                                 $ cd /home/opensrf/Evergreen-ILS-
1368                                                                 $ ./clark-kent.pl --daemon
1369                                                                 </screen>
1370                                                         </figure>
1371                                                         <para>You can also specify other options with this utility:</para>
1372                                                         <itemizedlist>
1373                                                                 <listitem><option>--sleep=interval</option> : number of seconds to sleep between checks for new reports to run; defaults to 10</listitem>
1374                                                                 <listitem><option>--lockfile=filename</option> : where to place the lockfile for the process; defaults to <filename>/tmp/reporter-LOCK</filename></listitem>
1375                                                                 <listitem><option>--concurrency=integer</option> : number of reporter daemon processes to run; defaults to <literal>1</literal></listitem>
1376                                                                 <listitem><option>--bootstrap=filename</option> : OpenSRF bootstrap configuration file; defaults to <filename>/openils/conf/opensrf_core.xml</filename></listitem>
1377                                                         </itemizedlist>
1378                                                 </listitem>
1379                                                 <listitem>
1380                                                         <para>Stopping the Reporter Daemon</para>
1381                                                         <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>
1382                                                         <note>
1383                                                                 <para>
1384                                                                         <emphasis>It is possible that several processes are running; see the optional commands in the previous section. As the <systemitem class="username">opensrf</systemitem> user, perform the following commands to stop the Reporter daemon:</emphasis>
1385                                                                 </para>
1386                                                         </note>
1387                                                         <figure>
1388                                                                 <title>Commands to stop the Reporter daemon</title>
1389                                                                 <screen>
1390                                                                 $ su - opensrf
1391                                                                 # find and kill the process ID number(s)
1392                                                                 $ kill `ps wax | grep "Clark Kent" | grep -v grep | cut -b1-6`
1393                                                                 # remove the lock file
1394                                                                 $ rm /tmp/reporter-LOCK
1395                                                                 </screen>
1396                                                         </figure>
1397                                                 </listitem>
1398                                         </itemizedlist>
1399                                 </section>
1400                                 <section xml:id="serversideinstallation-organizationandpolicy">
1401                                         <title>Organization and Policy Editing</title>
1402                                         <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 <xref linkend="serveradministration-orgunits"/> for further information. Examples of what can be configured include:</para>
1403                                         <itemizedlist>
1404                                                 <listitem>Adding a branch library</listitem>
1405                                                 <listitem>Changing circulation rules for an existing library</listitem>
1406                                                 <listitem>Adding a new staff position or user group</listitem>
1407                                         </itemizedlist>
1408                                         <indexterm>
1409                                                 <primary>ZZZ-REVIEW</primary>
1410                                                 <secondary>ADD CONTENT FOR ORGANIZATION AND POLICY EDITING </secondary>
1411                                         </indexterm>
1412                                         <caution>ADD CONTENT FOR ORGANIZATION AND POLICY EDITING </caution>
1413                                 </section>
1414                         </section>
1415                 </section>
1416                 <section xml:id="serversideinstallation-virtual">
1417                         <title>Installing In Virtualized Unix Environments</title>
1418                         <para>Evergreen software currently runs as a native application on any of several well-known <systemitem class="osname">Linux</systemitem> distributions (e.g., <systemitem class="osname">Ubuntu</systemitem> and <systemitem class="osname">Debian</systemitem>). It does not run as a native application on the <systemitem class="osname">Windows</systemitem> operating system (e.g., <systemitem class="osname">WindowsXP</systemitem>, <systemitem class="osname">WindowsXP Professional</systemitem>, <systemitem class="osname">Windows7</systemitem>), but the software can be installed and run on <systemitem class="osname">Windows</systemitem> via a virtualized Unix-guest Operating System (using, for example, <application>VirtualBox</application> or <application>VMware</application> to emulate a <systemitem class="osname">Linux</systemitem> environment).</para>
1419                         <indexterm>
1420                                 <primary>ZZZ-REVIEW</primary>
1421                                 <secondary>ADD CONTENT FOR INSTALLING EVERGREEN IN VIRTUALIZED UNIX ENVIRONMENTS </secondary>
1422                         </indexterm>
1424                         <section xml:id="serversideinstallation-virtualized-virtualbox">
1425                                 <title>VirtualBox</title>
1426                                 <indexterm>
1427                                         <primary>ZZZ-REVIEW</primary>
1428                                         <secondary>ADD CONTENT FOR VirtualBox </secondary>
1429                                 </indexterm>
1430                                 <caution>ADD CONTENT FOR VirtualBox </caution>
1431                         </section>
1432                         <section xml:id="serversideinstallation-virtualized-vmware">
1433                                 <title>VMware</title>
1434                                 <indexterm>
1435                                         <primary>ZZZ-REVIEW</primary>
1436                                         <secondary>ADD CONTENT FOR VMware </secondary>
1437                                 </indexterm>
1438                                 <caution>ADD CONTENT FOR VMware </caution>
1439                         </section>
1440                         <section xml:id="serversideinstallation-virtualized-virtualpc">
1441                                 <title>VirtualPC</title>
1442                                 <indexterm>
1443                                         <primary>ZZZ-REVIEW</primary>
1444                                         <secondary>ADD CONTENT FOR VirtualPC </secondary>
1445                                 </indexterm>
1446                                 <caution>ADD CONTENT FOR VirtualPC </caution>
1447                         </section>
1448                 </section>
1449                 <section xml:id="serversideinstallation-previousversions">
1450                         <title>Installing Previous Versions of Evergreen</title>
1451                         <para>Earlier releases of Evergreen are available. Instructions for installing, configuring and testing earlier versions are found below.</para>
1452                         <para>The next most recent previous release of Evergreen is version <emphasis><emphasis role="bold"></emphasis></emphasis>. The accompanying previous release of OpenSRF is version <emphasis><emphasis role="bold">1.0.7</emphasis></emphasis>.</para>
1453                         <section xml:id="serversideinstallation-evergreen-previous">
1454                                 <title>Installing Evergreen On <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem></title>
1455                                 <para>This section outlines the installation process for the previous version of Evergreen.</para>
1456                                 <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>
1457                                 <note>
1458                                         <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 <systemitem class="osname">Ubuntu</systemitem>. These instructions assume the Server edition.</para>
1459                                         <para>If you are starting with a clean install of <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem>, you are strongly recommended <emphasis role="bold">not</emphasis> to install the packaged PostgreSQL server. This can confuse port numbers and system configuration. Evergreen 1.4 requires PostgreSQL 8.2.</para>
1460                                 </note>
1461                                 <section>
1462                                         <title>Installing OpenSRF 1.0.7</title>
1463                                         <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 <xref linkend="serversideinstallation-opensrf-previous"/>.</para>
1464                                         <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>
1465                                 </section>
1466                                 <section>
1467                                         <title>Download and Unpack Evergreen Version</title>
1468                                         <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract the latest version of Evergreen. The latest version can be found here: <ulink url="http://evergreen-ils.org/downloads/Evergreen-ILS-"></ulink></para>
1469                                         <figure>
1470                                                 <title>Commands to download and unpack Evergreen</title>
1471                                                 <screen>
1472                                                 $ su - opensrf
1473                                                 $ wget http://evergreen-ils.org/downloads/Evergreen-ILS-
1474                                                 $ tar zxf Evergreen-ILS-
1475                                                 </screen>
1476                                         </figure>
1477                                         <para>The new directory <filename class="directory">/home/opensrf/Evergreen-ILS-</filename> will be created.</para>
1478                                 </section>
1479                                 <section>
1480                                         <title>Install Prerequisites to Build Evergreen</title>
1481                                         <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 <command>make</command> utility.</para>
1482                                         <para>As the <systemitem class="username">root</systemitem> 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 <systemitem class="osname">Linux</systemitem> distribution listed in the <link linkend="serversideinstallation-keywords-figure-2-a">"Keywords"</link> figure below.</para>
1483                                         <figure>
1484                                                 <title>Commands to install prerequisites for Evergreen</title>
1485                                                 <screen>
1486                                                 $ su - root
1487                                                 $ cd /home/opensrf/Evergreen-ILS-
1488                                                 $ make -f Open-ILS/src/extras/Makefile.install [distribution]
1489                                                 ...
1490                                                 </screen>
1491                                         </figure>
1492                                         <table xml:id="serversideinstallation-keywords-figure-2-a">
1493                                                 <title>Keywords Targets for <application>make</application> Command</title>
1494                                                 <tgroup align="left" cols="2" colsep="1" rowsep="1">
1495                                                         <colspec colnum="1" colwidth="1*"/>
1496                                                         <colspec colnum="2" colwidth="3*"/>
1497                                                         <thead>
1498                                                                 <row>
1499                                                                         <entry>Keyword</entry>
1500                                                                         <entry>Description</entry>
1501                                                                 </row>
1502                                                         </thead>
1503                                                         <tbody>
1504                                                                 <row>
1505                                                                         <entry>debian-lenny</entry>
1506                                                                         <entry>for Debian Lenny (5.0)</entry>
1507                                                                 </row>
1508                                                                 <row>
1509                                                                         <entry>debian-etch</entry>
1510                                                                         <entry>for Debian Etch (4.0)</entry>
1511                                                                 </row>
1512                                                                 <row>
1513                                                                         <entry>ubuntu-intrepid</entry>
1514                                                                         <entry>for Ubuntu Intrepid (8.10)</entry>
1515                                                                 </row>
1516                                                                 <row>
1517                                                                         <entry>ubuntu-hardy</entry>
1518                                                                         <entry>for Ubuntu Hardy (8.04)</entry>
1519                                                                 </row>
1520                                                         </tbody>
1521                                                 </tgroup>
1522                                         </table>
1523                                 </section>
1524                                 <section>
1525                                         <title>Update the System Dynamic Library Path</title>
1526                                         <para>As the <systemitem class="username">root</systemitem> user, you must update the system dynamic library path to make your system recognize the newly installed libraries. Do this by creating the new file <filename>/etc/ld.so.conf.d/eg.conf</filename> containing two new library paths, then run the command <command>ldconfig</command> to automatically read the file and modify the system dynamic library path:</para>
1527                                         <figure>
1528                                                 <title>Commands to modify system dynamic library path</title>
1529                                                 <screen>
1530                                                 $ su - root
1531                                                 $ cat > /etc/ld.so.conf.d/eg.conf &lt;&lt; ENDOFFILE
1532                                                 /usr/local/lib
1533                                                 /usr/local/lib/dbd
1534                                                 ENDOFFILE
1535                                                 $ ldconfig
1536                                                 </screen>
1537                                         </figure>
1538                                 </section>
1539                                 <section>
1540                                         <title>Restart the PostgreSQL Server</title>
1541                                         <para>If PostgreSQL is running on the same system as the rest of Evergreen, as the <systemitem class="username">root</systemitem> user you must restart the PostgreSQL server to avoid a problem where the library <filename>plperl.so</filename> cannot be found. If your PostgreSQL server is running on another system, just skip this step.</para>
1542                                         <figure>
1543                                                 <title>Commands to restart PostgreSQL server</title>
1544                                                 <screen>
1545                                                 $ su - root
1546                                                 $ /etc/init.d/postgresql-8.2 restart
1547                                                 </screen>
1548                                         </figure>
1549                                 </section>
1550                                 <section>
1551                                         <title>Configure Evergreen</title>
1552                                         <para>As the <systemitem class="username">opensrf</systemitem> user, return to the Evergreen build directory and use the <command>configure</command> utility to prepare for the next step of compiling and linking the software:</para>
1553                                         <figure>
1554                                                 <title>Commands to configure Evergreen</title>
1555                                                 <screen>
1556                                                 $ su - opensrf
1557                                                 $ cd /home/opensrf/Evergreen-ILS-
1558                                                 $ ./configure --prefix=/openils --sysconfdir=/openils/conf
1559                                                 $ make
1560                                                 ...
1561                                                 </screen>
1562                                         </figure>
1563                                 </section>
1564                                 <section>
1565                                         <title>Compile, Link and Install Evergreen</title>
1566                                         <para>In this step you will actually compile, link and install Evergreen and the default Evergreen Staff Client.</para>
1567                                         <para>As the <systemitem class="username">root</systemitem> user, return to the Evergreen build directory and use the <command>make</command> utility as shown below. The Staff Client will also be automatically built, but you must remember to set the variable <envar>STAFF_CLIENT_BUILD_ID</envar> to match the version of the Staff Client you will use to connect to the Evergreen server.</para>
1568                                         <para>For further information on manually building the Staff Client, see <xref linkend="serversideinstallation-building-staffclient"/>.</para>
1569                                         <figure>
1570                                                 <title>Commands to build, link and install Evergreen</title>
1571                                                 <screen>
1572                                                 $ su - root
1573                                                 $ cd /home/opensrf/Evergreen-ILS-
1574                                                 $ make STAFF_CLIENT_BUILD_ID=rel_1_4_0_6 install
1575                                                 ...
1576                                                 </screen>
1577                                                 <para>The above commands will create a new subdirectory <filename class="directory">/openils/var/web/xul/rel_1_4_0_6</filename> containing the Staff Client.</para>
1578                                         </figure>
1579                                 </section>
1580                                 <section>
1581                                         <title>Copy the OpenSRF Configuration Files</title>
1582                                         <para>As the <systemitem class="username">root</systemitem> user, copy the example OpenSRF configuration files into place. This replaces the configuration files that you set up in a previous step when you installed and tested OpenSRF. You should also create backup copies of the old files for troubleshooting purposes. Finally, change the ownership on the installed files to the <systemitem class="username">opensrf</systemitem> user:</para>
1583                                         <figure>
1584                                                 <title>Commands to copy OpenSRF configuration files</title>
1585                                                 <screen>
1586                                                 $ su - root
1587                                                 $ cp /openils/conf/opensrf.xml.example      /openils/conf/opensrf.xml
1588                                                 $ cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
1589                                                 $ chown -R opensrf:opensrf /openils/
1590                                                 </screen>
1591                                         </figure>
1592                                 </section>
1593                                 <section>
1594                                         <title>Create and Configure PostgreSQL Database</title>
1595                                         <para>As the <systemitem class="username">postgres</systemitem> user on your PostgreSQL server, create the Evergreen database.</para>
1596                                         <para>In the commands below, remember to adjust the path of the <emphasis role="bold">contrib</emphasis> repository to match your PostgreSQL server layout. For example, if you built PostgreSQL from source the path would be <filename class="directory">/usr/local/share/contrib</filename>; if you installed the PostgreSQL 8.2 server packages on <systemitem class="osname">Ubuntu 8.04</systemitem>, the path would be <filename class="directory">/usr/share/postgresql/8.2/contrib/</filename>.</para>
1597                                         <procedure>
1598                                                 <step>
1599                                                         <para>
1600                                                                 <emphasis role="bold">Create and configure the database</emphasis>
1601                                                         </para>
1602                                                         <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL system create the PostgreSQL database, then set some internal paths:</para>
1603                                                         <figure>
1604                                                                 <title>Commands to create database and adjust the path</title>
1605                                                                 <screen>
1606                                                                 # create the database
1607                                                                 $ su - postgres
1608                                                                 $ createdb -E UNICODE evergreen
1609                                                                 $ createlang plperl   evergreen
1610                                                                 $ createlang plperlu  evergreen
1611                                                                 $ createlang plpgsql  evergreen
1613                                                                 # adjust the paths
1614                                                                 $ psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/tablefunc.sql evergreen
1615                                                                 $ psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/tsearch2.sql  evergreen
1616                                                                 $ psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/pgxml.sql     evergreen
1617                                                                 </screen>
1618                                                         </figure>
1619                                                         <emphasis>Where <literal>PGSQL_VERSION</literal> is your installed PostgreSQL version (e.g. <literal>8.2</literal>).</emphasis>
1620                                                 </step>
1621                                                 <step>
1622                                                         <para>
1623                                                                 <emphasis role="bold">Create new Evergreen superuser</emphasis>
1624                                                         </para>
1625                                                         <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL system, create the new database <systemitem class="username">evergreen</systemitem> user and assign a password:</para>
1626                                                         <figure>
1627                                                                 <title>Commands to create the <systemitem class="username">evergreen</systemitem> user</title>
1628                                                                 <screen>
1629                                                                 # create superuser 'evergreen' and set the password
1630                                                                 $ su - postgres
1631                                                                 $ createuser -P -s evergreen
1632                                                                 Enter password for new role: MYNEWPASSWORD
1633                                                                 Enter it again: MYNEWPASSWORD
1634                                                                 </screen>
1635                                                         </figure>
1636                                                         <emphasis>Where <literal>MYNEWPASSWORD</literal> is the password chosen.</emphasis>
1637                                                 </step>
1638                                         </procedure>
1639                                 </section>
1640                                 <section>
1641                                         <title>Create Database Schema</title>
1642                                         <para>As the <systemitem class="username">root</systemitem> user, create the database schema and configure your system with the corresponding database authentication details for the <emphasis>evergreen</emphasis> database user that you created in the previous step.</para>
1643                                         <para>Enter the following commands and replace <emphasis>HOSTNAME, PORT, PASSWORD</emphasis> and <emphasis>DATABASENAME</emphasis> with appropriate values.</para>
1644                                         <figure>
1645                                                 <title>Commands to create Evergreen database schema</title>
1646                                                 <screen>
1647                                                 $ su - root
1648                                                 $ cd /home/opensrf/Evergreen-ILS-
1649                                                 $ perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \
1650                                                         --service all --create-schema --create-bootstrap --create-offline \
1651                                                         --hostname HOSTNAME --port PORT \
1652                                                         --user evergreen --password PASSWORD --database DATABASENAME
1653                                                 </screen>
1654                                         </figure>
1655                                         <emphasis>Where, on most systems, <emphasis>HOSTNAME</emphasis> will be <emphasis role="bold">localhost</emphasis>, <emphasis>PORT</emphasis> will be <emphasis role="bold">5432</emphasis>, and <emphasis>PASSWORD</emphasis> and <emphasis>DATABASENAME</emphasis> will be those assigned when PostgreSQL was installed in the previous step.</emphasis>
1656                                         <note>
1657                                                 <para>
1658                                                         <emphasis>If you are entering the above command on a single line, do not include the <literal>\</literal> (backslash) characters. If you are using the <command>bash</command> 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>
1659                                                 </para>
1660                                         </note>
1661                                 </section>
1662                                 <section>
1663                                         <title>Evergreen installation - (continued)</title>
1664                                         <para><emphasis>The remainder of the Evergreen installation procedure is identical to that for installing the latest version of Evergreen. Continue with the instructions found in</emphasis> <xref linkend="serversideinstallation-modify-apache"/>.</para>
1665                                 </section>
1666                         </section>
1667                 </section>
1668                 <section xml:id="serversideinstallation-opensrf-previous">
1669                         <title>Installing OpenSRF 1.0.7 On <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem></title>
1670                         <para>This section describes the installation of the previous version of the Open Service Request Framework (OpenSRF), a major component of the Evergreen server-side software, on <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem> systems. Evergreen software is integrated with and depends on the OpenSRF software system.</para>
1671                         <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>
1672                         <note>
1673                                 <para>The following steps have been tested on the x86 (32-bit) and x86-64 (64-bit) platforms. OpenSRF 1.0.7 has been tested on <systemitem class="osname">Debian Etch (4.0)</systemitem>, <systemitem class="osname">Debian Lenny</systemitem>, <systemitem class="osname">Ubuntu Hardy Heron (8.04)</systemitem>, and <systemitem class="osname">Ubuntu Intrepid Ibex (8.10)</systemitem>.</para>
1674                                 <para>In the following instructions, you are asked to perform certain steps as either the <systemitem class="username">root</systemitem> user, the <systemitem class="username">opensrf</systemitem> user, or the <systemitem class="username">postgres</systemitem> user.</para>
1675                                 <itemizedlist>
1676                                         <listitem><systemitem class="osname">Debian</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command <command>su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>
1677                                         <listitem><systemitem class="osname">Ubuntu</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command <command>sudo su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>
1678                                 </itemizedlist>
1679                                 <para>To switch from the <systemitem class="username">root</systemitem> user to a different user, issue the command <command>su - USERNAME</command>. For example, to switch from the <systemitem class="username">root</systemitem> user to the <systemitem class="username">opensrf</systemitem> user, issue the command <command>su - opensrf</command>. Once you have become a non-root user, to become the <systemitem class="username">root</systemitem> user again, simply issue the command <command>exit"</command>.</para>
1680                         </note>
1681                         <section>
1682                                 <title>Add the OpenSRF User</title>
1683                                 <para>As the <systemitem class="username">root</systemitem> user, add the opensrf user to the system. The default shell for the new user is automatically set to <command>/bin/bash</command> to inherit a reasonable environment:</para>
1684                                 <figure>
1685                                         <title>Commands to add <systemitem class="username">opensrf</systemitem> user</title>
1686                                         <screen>
1687                                         $ su - opensrf
1688                                         $ useradd -m -s /bin/bash opensrf
1689                                         $ passwd opensrf
1690                                         Enter new UNIX password: ******
1691                                         Retype new UNIX password: ******
1692                                         passwd: password updated successfully
1693                                         $
1694                                         </screen>
1695                                 </figure>
1696                         </section>
1697                         <section>
1698                                 <title>Download and Unpack Latest OpenSRF Version</title>
1699                                 <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract the latest version of OpenSRF. The latest version can be found here: <ulink url="http://evergreen-ils.org/downloads/OpenSRF-1.0.7.tar.gz"></ulink></para>
1700                                 <figure>
1701                                         <title>Commands to download and unpack OpenSRF</title>
1702                                         <screen>
1703                                         $ su - opensrf
1704                                         $ wget http://evergreen-ils.org/downloads/OpenSRF-1.0.7.tar.gz
1705                                         $ tar zxf OpenSRF-1.0.7.tar.gz
1706                                         </screen>
1707                                 </figure>
1708                                 <para>The new directory <filename class="directory">/home/opensrf/OpenSRF-1.0.7</filename> will be created.</para>
1709                         </section>
1710                         <section>
1711                                 <title>Install Prerequisites to Build OpenSRF</title>
1712                                 <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 <command>make</command> utility.</para>
1713                                 <para>As the <systemitem class="username">root</systemitem> 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 <systemitem class="osname">Linux</systemitem> distribution listed in the <link linkend="serversideinstallation-keywords-figure-1a">"Keywords"</link> figure below.</para>
1714                                 <figure>
1715                                         <title>Commands to install prerequisites for OpenSRF</title>
1716                                         <screen>
1717                                         $ su - root
1718                                         $ cd /home/opensrf/OpenSRF-1.0.7
1719                                         $ make -f src/extras/Makefile.install [DISTRIBUTION]
1720                                         ...
1721                                         </screen>
1722                                 </figure>
1723                                 <table xml:id="serversideinstallation-keywords-figure-1a">
1724                                         <title>Keywords Targets for <application>make</application> Command</title>
1725                                         <tgroup align="left" cols="2" colsep="1" rowsep="1">
1726                                                 <colspec colnum="1" colwidth="1*"/>
1727                                                 <colspec colnum="2" colwidth="3*"/>
1728                                                 <thead>
1729                                                         <row>
1730                                                                 <entry>Keyword</entry>
1731                                                                 <entry>Description</entry>
1732                                                         </row>
1733                                                 </thead>
1734                                                 <tbody>
1735                                                         <row>
1736                                                                 <entry>debian-lenny</entry>
1737                                                                 <entry>for Debian Lenny (5.0)</entry>
1738                                                         </row>
1739                                                         <row>
1740                                                                 <entry>debian-etch</entry>
1741                                                                 <entry>for Debian Etch (4.0)</entry>
1742                                                         </row>
1743                                                         <row>
1744                                                                 <entry>ubuntu-intrepid</entry>
1745                                                                 <entry>for Intrepid (8.10)</entry>
1746                                                         </row>
1747                                                         <row>
1748                                                                 <entry>ubuntu-hardy</entry>
1749                                                                 <entry>for Ubuntu Hardy (8.04)</entry>
1750                                                         </row>
1751                                                 </tbody>
1752                                         </tgroup>
1753                                 </table>
1754                                 <para>This will install a number of packages on the system that are required by OpenSRF, including some Perl modules from CPAN. You can say <literal>No</literal> 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 <literal>Yes</literal>.</para>
1755                         </section>
1756                         <section>
1757                                 <title>Configure OpenSRF</title>
1758                                 <para>As the <systemitem class="username">opensrf</systemitem> user, return to the OpenSRF build directory and use the <command>configure</command> utility to prepare for the next step of compiling and linking the software. You can include the  <option>--enable-python</option> and <option>--enable-java</option> configuration options if you wish to include support for Python and Java, respectively:</para>
1759                                 <figure>
1760                                         <title>Commands to configure OpenSRF</title>
1761                                         <screen>
1762                                         $ su - opensrf
1763                                         $ cd /home/opensrf/OpenSRF-1.0.7
1764                                         $ ./configure --prefix=/openils --sysconfdir=/openils/conf
1765                                         $ make
1766                                         ...
1767                                         </screen>
1768                                 </figure>
1769                         </section>
1770                         <section>
1771                                 <title>Compile, Link and Install OpenSRF</title>
1772                                 <para>As the <systemitem class="username">root</systemitem> user, return to the OpenSRF build directory and use the <command>make</command> utility to compile, link and install OpenSRF:</para>
1773                                 <figure>
1774                                         <title>Commands to build, link and install OpenSRF</title>
1775                                         <screen>
1776                                         $ su - opensrf
1777                                         $ cd /home/opensrf/OpenSRF-1.0.7
1778                                         $ make install
1779                                         ...
1780                                         </screen>
1781                                 </figure>
1782                         </section>
1783                         <section>
1784                                 <title>Update the System Dynamic Library Path</title>
1785                                 <para>As the <systemitem class="username">root</systemitem> user, you must update the system dynamic library path to make your system recognize the newly installed libraries. Do this by creating the new file <filename>/etc/ld.so.conf.d/osrf.conf</filename> containing a new library path, then run the command <command>ldconfig</command> to automatically read the file and modify the system dynamic library path:</para>
1786                                 <figure>
1787                                         <title>Commands to modify system dynamic library path</title>
1788                                         <screen>
1789                                         $ su - root
1790                                         $ echo "/openils/lib" > /etc/ld.so.conf.d/osrf.conf
1791                                         $ ldconfig
1792                                         </screen>
1793                                 </figure>
1794                         </section>
1795                         <section>
1796                                 <title>Define Public and Private OpenSRF Domains</title>
1797                                 <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 <systemitem class="domainname">public.localhost</systemitem> for the public domain and <systemitem class="domainname">private.localhost</systemitem> 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 <filename>/etc/hosts</filename>.</para>
1798                                 <para>As the <systemitem class="username">root</systemitem> user, edit the file <filename>/etc/hosts</filename> and add the following entries for our example domains:</para>
1799                                 <figure>
1800                                         <title>Example public and private domains in /etc/hosts</title>
1801                                         <screen>
1802                                      public.localhost        public
1803                                      private.localhost       private
1804                                         </screen>