]> git.evergreen-ils.org Git - working/Evergreen.git/blob - 1.6/admin/ServersideInstallation.xml
Move PostgreSQL ifnormation from ServersideInstallation to Admin misc.
[working/Evergreen.git] / 1.6 / admin / ServersideInstallation.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
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">\r
3         <info>\r
4                 <title>Server-side Installation of Evergreen Software</title>\r
5                 <abstract>\r
6                         <para>This section describes installation of the Evergreen server-side software and its associated components. Installation, configuration, testing and verification \r
7                         of the software is straightforward if you follow some simple directions.</para>\r
8                 </abstract>\r
9         </info>\r
10                 <para>Installing, configuring and testing the Evergreen server-side software is straightforward with the current stable software release. See \r
11                 <xref linkend="serversideinstallation-all"/> for instructions tailored to installing on some particular distributions of the <systemitem class="osname">Linux</systemitem> \r
12                 operating system. Earlier software distributions are described in <xref linkend="serversideinstallation-previousversions"/>.</para>\r
13                 <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> \r
14                 distributions (e.g., <systemitem class="osname">Ubuntu</systemitem> and <systemitem class="osname">Debian</systemitem>). It does not currently run as a native application \r
15                 on the <systemitem class="osname">Microsoft Windows</systemitem> operating system (e.g., <systemitem class="osname">WindowsXP</systemitem>, ]\r
16                 <systemitem class="osname">WindowsXP Professional</systemitem>, <systemitem class="osname">Windows7</systemitem>), but the software can still be installed and run on \r
17                 <systemitem class="osname">Windows</systemitem> via a so-called <emphasis>virtualized</emphasis> Linux-guest Operating System (using, for example, \r
18                 <application>"VirtualBox"</application>, or <application>"VMware"</application>, or <application>"VirtualPC"</application> to emulate a \r
19                 <systemitem class="osname">Linux</systemitem> environment). It can also be installed to run on other <systemitem class="osname">Linux</systemitem> systems via virtualized \r
20                 environments (using, for example, <application>"VirtualBox"</application> or <application>"VMware"</application>). More information on virtualized environments can be \r
21                 found in <xref linkend="serversideinstallation-virtual"/>.</para>\r
22                 <para>Installation of the Evergreen Staff Client software is reviewed in <xref linkend="serversideinstallation-staffclient"/>. </para>\r
23                         <para>The Evergreen server-side software has dependencies on particular versions of certain major software sub-components. Successful installation of Evergreen \r
24                         software requires that software versions agree with those listed here:</para>\r
25                         <table xml:id="serversideinstall-software-dependencies">\r
26                                 <title>Evergreen Software Dependencies</title>\r
27                                 <tgroup align="left" cols="3" colsep="1" rowsep="1">\r
28                                 <colspec colnum="1" colname="Evergreen" colwidth="1.0*"/>\r
29                                 <colspec colnum="2" colname="OpenSRF" colwidth="1.0*"/>\r
30                                 <colspec colnum="3" colname="PostgreSQL" colwidth="1.0*"/>\r
31         \r
32                                         <thead>\r
33                                                 <row>\r
34                                                         <entry>Evergreen</entry>\r
35                                                         <entry>OpenSRF</entry>\r
36                                                         <entry>PostgreSQL</entry>\r
37                                                 </row>\r
38                                         </thead>\r
39                                         <tbody>\r
40                                                 <row>\r
41                                                         <entry>1.6.x</entry>\r
42                                                         <entry>1.2</entry>\r
43                                                         <entry>8.2 / 8.3</entry>\r
44                                                 </row>\r
45                                         </tbody>\r
46                                 </tgroup>\r
47                         </table>        \r
48         <section xml:id="serversideinstallation-all">\r
49                 <title>Installing Server-Side Software</title>\r
50                 <para>This section describes the installation of the major components of Evergreen server-side software.</para>\r
51                 <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 \r
52                 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 \r
53                 and resume the installation from a known state. See <xref linkend="backingup"/> for further information.</para>\r
54                 <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 \r
55                 the series of regularly scheduled system backups that you should probably also begin.</para>\r
56                 <section xml:id="serversideinstallation-opensrf">\r
57                         <title>Installing OpenSRF 1.2.2 On <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem></title>\r
58                         <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, \r
59                         on <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem> systems. Evergreen software is integrated with and depends on the \r
60                         OpenSRF software system.</para>\r
61                         <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 \r
62                         Evergreen installation steps until you have verified that OpenSRF has been successfully installed.</para>\r
63                         <note>\r
64                                 <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 \r
65                                 (4.0)</systemitem>, <systemitem class="osname">Debian Lenny</systemitem>, <systemitem class="osname">Ubuntu Hardy Heron (8.04)</systemitem>, and \r
66                                 <systemitem class="osname">Ubuntu Intrepid Ibex (8.10)</systemitem>.</para>\r
67                                 <para>In the following instructions, you are asked to perform certain steps as either the <systemitem class="username">root</systemitem> user, the \r
68                                 <systemitem class="username">opensrf</systemitem> user, or the <systemitem class="username">postgres</systemitem> user.</para>\r
69                                 <itemizedlist>\r
70                                         <listitem><systemitem class="osname">Debian</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command \r
71                                         <command>su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>\r
72                                         <listitem><systemitem class="osname">Ubuntu</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command \r
73                                         <command>sudo su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>\r
74                                 </itemizedlist>\r
75                                 <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 \r
76                                 switch from the <systemitem class="username">root</systemitem> user to the <systemitem class="username">opensrf</systemitem> user, issue the command \r
77                                 <command>su - opensrf</command>. Once you have become a non-root user, to become the <systemitem class="username">root</systemitem> user again, simply issue \r
78                                 the command <command>exit"</command>.</para>\r
79                         </note>\r
80                         <procedure>\r
81                                 <step>\r
82                                         <title>Add the OpenSRF User</title>\r
83                                         <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 \r
84                                         <command>/bin/bash</command> to inherit a reasonable environment:</para>\r
85 <screen>\r
86 <userinput>useradd -m -s /bin/bash opensrf</userinput>\r
87 <userinput>passwd opensrf</userinput>\r
88 </screen>\r
89                                 </step>\r
90                                 <step>\r
91                                         <title>Download and Unpack Latest OpenSRF Version</title>\r
92                                         <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract the latest version of OpenSRF. The latest version can be found here: \r
93                                         <ulink url="http://evergreen-ils.org/downloads/OpenSRF-1.2.2.tar.gz"></ulink></para>\r
94 <screen>\r
95 <userinput>wget http://evergreen-ils.org/downloads/OpenSRF-1.2.2.tar.gz</userinput>\r
96 <userinput>tar zxf OpenSRF-1.2.2.tar.gz</userinput>\r
97 </screen>               \r
98                                         <para>The new directory <filename class="directory">/home/opensrf/OpenSRF-1.2.2</filename> will be created.</para>\r
99                                 </step>\r
100                                 <step>\r
101                                         <title>Install Prerequisites to Build OpenSRF</title>\r
102                                         <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 \r
103                                         software using the <command>make</command> utility.</para>\r
104                                         <para>As the <systemitem class="username">root</systemitem> user, enter the commands show below to build the prerequisites from the software distribution that \r
105                                         you just downloaded and unpacked. Remember to replace <emphasis>[DISTRIBUTION]</emphasis> in the example with the keyword corresponding to the actual \r
106                                         <systemitem class="osname">Linux</systemitem> distribution listed in the <link linkend="serversideinstallation-keywords-opensrf">distribution \r
107                                         keywords</link>table.</para>\r
108 <screen>\r
109 <userinput>cd /home/opensrf/OpenSRF-1.2.2</userinput>\r
110 <userinput>make -f src/extras/Makefile.install [DISTRIBUTION]</userinput>\r
111 </screen>\r
112                                 \r
113                                         <table xml:id="serversideinstallation-keywords-opensrf">\r
114                                                 <title>Keywords Targets for <application>"make"</application> Command</title>\r
115                                                 <tgroup align="left" cols="2" colsep="1" rowsep="1">\r
116                                                         <colspec colnum="1" colwidth="1.0*"/>\r
117                                                         <colspec colnum="2" colwidth="3.0*"/>\r
118                                                         <thead>\r
119                                                                 <row>\r
120                                                                         <entry>Keyword</entry>\r
121                                                                         <entry>Description</entry>\r
122                                                                 </row>\r
123                                                         </thead>\r
124                                                         <tbody>\r
125                                                                 <row>\r
126                                                                         <entry>debian-lenny</entry>\r
127                                                                         <entry>for Debian Lenny (5.0)</entry>\r
128                                                                 </row>\r
129                                                                 <row>\r
130                                                                         <entry>debian-etch</entry>\r
131                                                                         <entry>for Debian Etch (4.0)</entry>\r
132                                                                 </row>\r
133                                                                 <row>\r
134                                                                         <entry>ubuntu-karmic</entry>\r
135                                                                         <entry>for Ubuntu Karmic (9.10)</entry>\r
136                                                                 </row>\r
137                                                                 <row>\r
138                                                                         <entry>ubuntu-intrepid</entry>\r
139                                                                         <entry>for Ubuntu Jaunty (9.04) or Intrepid (8.10)</entry>\r
140                                                                 </row>\r
141                                                                 <row>\r
142                                                                         <entry>ubuntu-hardy</entry>\r
143                                                                         <entry>for Ubuntu Hardy (8.04)</entry>\r
144                                                                 </row>\r
145                                                         </tbody>\r
146                                                 </tgroup>\r
147                                         </table>\r
148                                         <indexterm>\r
149                                                 <primary>ZZZ-REVIEW</primary>\r
150                                                 <secondary>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </secondary>\r
151                                         </indexterm>\r
152                                         <caution>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </caution>\r
153                                         <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 \r
154                                         the initial CPAN configuration prompt to allow it to automatically configure itself to download and install Perl modules from CPAN. The CPAN installer will \r
155                                         ask you a number of times whether it should install prerequisite modules - say <literal>Yes</literal>.</para>\r
156                                 </step>\r
157                                 <step>\r
158                                         <title>Configure OpenSRF</title>\r
159                                         <para>As the <systemitem class="username">opensrf</systemitem> user, return to the OpenSRF build directory and use the <command>configure</command> \r
160                                         utility to prepare for the next step of compiling and linking the software. You can include the  <option>--enable-python</option> and \r
161                                         <option>--enable-java</option> configuration options if you wish to include support for Python and Java, respectively:</para>\r
162 <screen>\r
163 <userinput>cd /home/opensrf/OpenSRF-1.2.2</userinput>\r
164 <userinput>./configure --prefix=/openils --sysconfdir=/openils/conf</userinput>\r
165 <userinput>make</userinput>\r
166 </screen>\r
167                                 \r
168                                 </step>\r
169                                 <step>\r
170                                         <title>Compile, Link and Install OpenSRF</title>\r
171                                         <para>As the <systemitem class="username">root</systemitem> user, return to the OpenSRF build directory and use the <command>make</command> utility to compile, \r
172                                         link and install OpenSRF:</para>                        \r
173 <screen>\r
174 <userinput>cd /home/opensrf/OpenSRF-1.2.2</userinput>\r
175 <userinput>make install</userinput>\r
176 </screen>\r
177                                 </step>\r
178                                 <step>\r
179                                         <title>Update the System Dynamic Library Path</title>\r
180                                         <para>As the <systemitem class="username">root</systemitem> user, you must update the system dynamic library path to make your system recognize the newly \r
181                                         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 \r
182                                         command <command>ldconfig</command> to automatically read the file and modify the system dynamic library path:</para>\r
183                                 \r
184 <screen>\r
185 <userinput>echo "/openils/lib" > /etc/ld.so.conf.d/osrf.conf</userinput>\r
186 <userinput>ldconfig</userinput>\r
187 </screen>\r
188                                 </step>\r
189                                 <step>\r
190                                         <title>Define Public and Private OpenSRF Domains</title>\r
191                                         <para>Define your public and private OpenSRF domains. For security purposes, OpenSRF uses Jabber domains to separate services into public and private realms. \r
192                                         Throughout these instructions, we will use the example domains <systemitem class="domainname">public.localhost</systemitem> for the public domain and \r
193                                         <systemitem class="domainname">private.localhost</systemitem> for the private domain. On a single-server system, the easiest way to define public and \r
194                                         private domains is to define separate host names by adding entries to the file <filename>/etc/hosts</filename>.</para>\r
195                                         <para>As the <systemitem class="username">root</systemitem> user, edit the file <filename>/etc/hosts</filename> and add the following entries for \r
196                                         our example domains:</para>\r
197 <screen>\r
198 127.0.1.2       public.localhost        public\r
199 127.0.1.3       private.localhost       private\r
200 </screen>\r
201                                 </step>\r
202                                 <step>\r
203                                         <title>Change File Ownerships</title>\r
204                                         <para>As the <systemitem class="username">root</systemitem> user, change the ownership of files installed in the directory \r
205                                         <filename class="directory">/openils</filename> to the <systemitem class="username">opensrf</systemitem> user:</para>\r
206 <screen>\r
207 <userinput>chown -R opensrf:opensrf /openils</userinput>\r
208 </screen>\r
209                                 </step>\r
210                                 <step>\r
211                                         <title>Stop the <systemitem class="service">ejabberd</systemitem> Service</title>\r
212                                         <para>As the <systemitem class="username">root</systemitem> user, stop the <systemitem class="service">ejabberd</systemitem> service:</para>\r
213 <screen>\r
214 $ /etc/init.d/ejabberd stop\r
215 </screen>\r
216                                 \r
217                                         <para>If <systemitem class="service">ejabberd</systemitem> eeports that it is already stopped, it may have run into a problem starting back at the \r
218                                         installation stage. One possible fix is to kill any remaining <systemitem class="daemon">beam</systemitem> and \r
219                                         <systemitem class="daemon">epmd</systemitem> processes, then edit the configuration file <filename>/etc/ejabberd/ejabberd.cfg</filename> to hardcode a \r
220                                         domain:</para>\r
221 <screen>\r
222 <userinput>epmd -kill</userinput>\r
223 <userinput>killall beam; killall beam.smp</userinput>\r
224 <userinput>rm /var/lib/ejabberd/*</userinput>\r
225 <userinput>echo 'ERLANG_NODE=ejabberd@localhost' >> /etc/default/ejabberd</userinput>\r
226 </screen>\r
227                                 \r
228                                 </step>\r
229                                 <step>\r
230                                         <title>Edit the <systemitem class="service">ejabberd</systemitem> configuration</title>\r
231                                         <para>As the <systemitem class="username">root</systemitem> user, edit the file <filename>/etc/ejabberd/ejabberd.cfg</filename> and make the following \r
232                                         changes:</para>\r
233                                         <itemizedlist>\r
234                                                 <listitem>Change <literal>{hosts, ["localhost"]}.</literal> to <literal>{hosts, ["localhost", "private.localhost", "public.localhost"]}.</literal></listitem>\r
235                                                 <listitem>Change <literal>{max_user_sessions, 10}.</literal> to <literal>{max_user_sessions, 10000}.</literal> If you see something like this instead: \r
236                                                 <literal>{access, max_user_sessions, [{10, all}]}.</literal>, then change it to <literal>{access, max_user_sessions, [{10000, all}]}.</literal></listitem>\r
237                                                 <listitem>Change all three occurrences of <literal>max_stanza_size</literal> to <literal>2000000</literal>.</listitem>\r
238                                                 <listitem>Change both occurrences of <literal>maxrate</literal> to <literal>500000</literal>.</listitem>\r
239                                                 <listitem>Comment out the line <literal>{mod_offline, []}</literal> by placing two <literal>%</literal> comment signs in front.</listitem>\r
240                                         </itemizedlist>\r
241                                 </step>\r
242                                 <step xml:id="serversideinstallation-opensrf-continued">\r
243                                         <title>Restart the <systemitem class="service">ejabberd</systemitem> service</title>\r
244                                         <para>As the <systemitem class="username">root</systemitem> user, restart the <systemitem class="service">ejabberd</systemitem> service to test the configuration \r
245                                         changes and to register your users:</para>\r
246 <screen>\r
247 <userinput>/etc/init.d/ejabberd start</userinput>\r
248 </screen>                       \r
249                                 </step>\r
250                                 <step>\r
251                                         <title>Register <systemitem class="username">router</systemitem> and <systemitem class="username">ejabberd</systemitem> users</title>\r
252                                         <para>On each domain, you need two <systemitem class="service">ejabberd</systemitem> users to manage the OpenSRF communications:</para>\r
253                                         <itemizedlist>\r
254                                                 <listitem>a <systemitem class="username">router</systemitem> user, to whom all requests to connect to an OpenSRF service will be routed; this \r
255                                                 <systemitem class="service">ejabberd</systemitem> user must be named <systemitem class="username">router</systemitem></listitem>\r
256                                                 <listitem>an <systemitem class="username">opensrf</systemitem> user, which clients use to connect to OpenSRF services; this user can be named anything you \r
257                                                 like, but we will use <literal>opensrf</literal> in our examples</listitem>\r
258                                         </itemizedlist>\r
259                                         <para>As the <systemitem class="username">root</systemitem> user, use the <command>ejabberdctl</command> utility to register your ejabber users \r
260                                         <emphasis>router</emphasis> and <emphasis>opensrf</emphasis> for the OpenSRF router service on each domain. The users should have different passwords on \r
261                                         each domain. The syntax for registering a user with ejabberdctl is  <command>ejabberdctl register &lt;user&gt; &lt;domain&gt; &lt;password&gt;</command>\r
262                                         These users will correspond to those configured in the file <filename>/openils/conf/opensrf_core.xml</filename>:</para>\r
263 <screen>\r
264 <userinput>ejabberdctl register router private.localhost  &lt;password&gt;</userinput>\r
265 <userinput>ejabberdctl register opensrf private.localhost &lt;password&gt;</userinput>\r
266 <userinput>ejabberdctl register router public.localhost   &lt;password&gt;</userinput>\r
267 <userinput>ejabberdctl register opensrf public.localhost  &lt;password&gt;</userinput>\r
268 </screen>\r
269                                 </step>\r
270                                 <step>\r
271                                         <title>Create configuration files</title>\r
272                                         <para>As the <systemitem class="username">opensrf</systemitem> user, use the example templates to create the configuration files \r
273                                         <filename>/openils/conf/opensrf_core.xml</filename> and <filename>/openils/conf/opensrf.xml</filename>:</para>\r
274 <screen>\r
275 <userinput>cd /openils/conf</userinput>\r
276 <userinput>cp opensrf.xml.example      opensrf.xml</userinput>\r
277 <userinput>cp opensrf_core.xml.example opensrf_core.xml</userinput>\r
278 </screen>\r
279                                 </step>\r
280                                 <step>\r
281                                         <title>Edit opensrf_core.xml</title>\r
282                                         <para>Edit the file <filename>/openils/conf/opensrf_core.xml</filename> to change the <systemitem class="service">ejabberd</systemitem> usernames and passwords as \r
283                                         follows.</para>\r
284                                         <note>\r
285                                                 <para>\r
286                                                         <emphasis>The following example uses common XPath syntax on the left-hand side to indicate the approximate position needing changes within the XML \r
287                                                         file.</emphasis>\r
288                                                 </para>\r
289                                         </note>\r
290                                                 \r
291                                                 <para>/config/opensrf/username = <systemitem class="username">opensrf</systemitem></para>\r
292                                                 <para>/config/opensrf/passwd = password for <systemitem class="domainname">private.localhost</systemitem> \r
293                                                 <systemitem class="username">opensrf</systemitem> user</para>\r
294                                                 <para>/config/opensrf/passwd = password for <systemitem class="domainname">private.localhost</systemitem> \r
295                                                 <systemitem class="username">opensrf</systemitem>  user</para>\r
296                                                 <para>/config/gateway/username = <systemitem class="username">opensrf</systemitem></para>\r
297                                                 <para>/config/gateway/passwd = password for <systemitem class="domainname">public.localhost</systemitem>\r
298                                                 <systemitem class="username">opensrf</systemitem>  user</para>\r
299                                                 <para>/config/routers/router/transport  (first entry, where \r
300                                                 <quote>transport/server</quote> ==<systemitem class="domainname">public.localhost</systemitem>)</para>\r
301                                                         <itemizedlist>\r
302                                                                 <listitem>username = <systemitem class="username">router</systemitem></listitem> \r
303                                                                 <listitem>password = password for <systemitem class="domainname">public.localhost</systemitem> \r
304                                                                 <systemitem class="username">router</systemitem> \r
305                                                                 user</listitem>\r
306                                                         </itemizedlist>\r
307                                                 \r
308                                                 <para>/config/routers/router/transport  (second entry, where \r
309                                                 <quote>transport/server</quote> == <systemitem class="domainname">private.localhost</systemitem>) </para>\r
310                                                         <itemizedlist>\r
311                                                                 <listitem>username = <systemitem class="username">router</systemitem></listitem> \r
312                                                                 <listitem>password = password for <systemitem class="domainname">private.localhost</systemitem> \r
313                                                                 <systemitem class="username">router</systemitem> \r
314                                                                 user</listitem>\r
315                                                         </itemizedlist>\r
316                                                 \r
317                                         <para>You also need to specify the domains from which <systemitem class="service">OpenSRF</systemitem> will accept and to which \r
318                                         <systemitem class="service">OpenSRF</systemitem> will make connections. If you are installing <application>OpenSRF</application> on a single server and using the \r
319                                         <systemitem class="domainname">private.localhost</systemitem> / <systemitem class="domainname">public.localhost</systemitem> domains, these will already be set to \r
320                                         the correct values. Otherwise, search and replace to match your values.</para>\r
321                                 </step>\r
322                                 <step>\r
323                                         <title>Modify the file <filename>opensrf.xml</filename></title>\r
324                                         <para>As the <systemitem class="username">opensrf</systemitem> user, edit the file <filename>/openils/conf/opensrf.xml</filename> to set the location of the \r
325                                         persistent database in the <literal>dbfile</literal> element near the end of the file:</para>\r
326 <programlisting language="xml"><![CDATA[\r
327 <!-- Example of an app-specific setting override -->\r
328 <opensrf.persist>\r
329   <app_settings>\r
330     <dbfile>/tmp/persist.db</dbfile>\r
331   </app_settings>\r
332 </opensrf.persist>\r
333 ]]></programlisting>\r
334                                 </step>\r
335                                 <step>\r
336                                         <title>Create Configuration Files for Users Needing <command>srfsh</command></title>\r
337                                         <para>In this section you will set up a special configuration file for each user who will need to run the <command>srfsh</command> \r
338                                         (pronounced <emphasis>surf shell</emphasis>) utility.</para>\r
339                                         <para>The software installation will automatically create <command>srfsh</command>. This is a command line diagnostic tool for testing and interacting with \r
340                                         <application>OpenSRF</application>. It will be used in a future step to complete and test the Evergreen installation. \r
341                                         See <xref linkend="serversideinstallation-testing"/> for further information.</para>\r
342                                         <para>As the <systemitem class="username">root</systemitem> user, copy the short sample configuration file <filename>/openils/conf/srfsh.xml.example</filename> \r
343                                         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, \r
344                                         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 \r
345                                         home directory.</para>\r
346                                         <itemizedlist>\r
347                                                 <listitem>Modify <literal>domain</literal> to be the router hostname (following our domain examples, \r
348                                                 <systemitem class="domainname">private.localhost</systemitem> will give <application>"srfsh"</application> access to all OpenSRF services, \r
349                                                 while <systemitem class="domainname">public.localhost</systemitem> will only allow access to those OpenSRF services that are publicly exposed).</listitem>\r
350                                                 <listitem>Modify <literal>username</literal> and <literal>password</literal> to match the <literal>opensrf</literal> Jabber user for the chosen \r
351                                                 domain</listitem>\r
352                                                 <listitem>Modify <literal>logfile</literal> to be the full path for a log file to which the user has write access</listitem>\r
353                                                 <listitem>Modify <literal>loglevel</literal> as needed for testing</listitem>\r
354                                         </itemizedlist>                 \r
355 <programlisting language="xml"><![CDATA[\r
356 <?xml version="1.0"?>\r
357 <!-- This file follows the standard bootstrap config file layout -->\r
358 <!-- found in opensrf_core.xml -->\r
359 <srfsh>\r
360 <router_name>router</router_name>\r
361 <domain>private.localhost</domain>\r
362 <username>opensrf</username>\r
363 <passwd>privsrf</passwd>\r
364 <port>5222</port>\r
365 <logfile>/tmp/srfsh.log</logfile>\r
366 <!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->\r
367 <loglevel>4</loglevel>\r
368 </srfsh>\r
369 ]]></programlisting>\r
370                                 </step>\r
371                                 <step>\r
372                                         <title>Modify Environmental Variable PATH for <systemitem class="username">opensrf</systemitem> User</title>\r
373                                         <para>As the <systemitem class="username">opensrf</systemitem> user, modify the environmental variable <envar>PATH</envar> by adding a new file path to \r
374                                         the <systemitem class="username">opensrf</systemitem> user's shell configuration file <filename>.bashrc</filename>:</para>\r
375 <screen>\r
376 <userinput>echo "export PATH=/openils/bin:\$PATH" >> ~/.bashrc</userinput>\r
377 </screen>\r
378                                 \r
379                                 </step>\r
380                                 <step>\r
381                                         <title>Start OpenSRF</title>\r
382                                         <para>As the <systemitem class="username">root</systemitem> user, start the <systemitem class="service">ejabberd</systemitem> and \r
383                                         <systemitem class="service">memcached</systemitem> services:</para>                     \r
384 <screen>\r
385 <userinput>/etc/init.d/ejabberd start</userinput>\r
386 <userinput>/etc/init.d/memcached start</userinput>\r
387 </screen>                       \r
388                                         <para>Finally, as the <systemitem class="username">opensrf</systemitem> user, start OpenSRF:</para>\r
389 <screen>\r
390 <userinput>start the OpenSRF service:</userinput>\r
391 <userinput>use "-l" to force hostname to be "localhost"</userinput>\r
392 <userinput>osrf_ctl.sh -l -a start_all</userinput>    \r
393 </screen>\r
394                                         <note>\r
395                                                 <para>If you receive the error message <errortext>bash: osrf_ctl.sh: command not found</errortext>, then your environment variable <envar>PATH</envar> does \r
396                                                 not include the <filename class="directory">/openils/bin</filename> directory; \r
397                                                 this should have been set by <filename>.bashrc</filename> when you logged in as the <systemitem class="username">opensrf</systemitem> user, but you \r
398                                                 can manually set it using the following command:</para>\r
399                                                 <screen><userinput>export PATH=$PATH:/openils/bin</userinput></screen>\r
400                                         </note>\r
401                                         <para>You can also start Evergreen <emphasis role="bold">without</emphasis> the <option>-l</option> flag, but <command>osrf_ctl.sh</command> must know the \r
402                                         fully qualified domain name for the system on which it will execute. That hostname may have been specified in the configuration file \r
403                                         <filename>opensrf.xml</filename>, \r
404                                         which you configured in a previous step.</para>\r
405                                 </step>\r
406                                 <step>\r
407                                         <title>Test connections to OpenSRF</title>\r
408                                         <para>Once you have installed and started OpenSRF, as the <systemitem class="username">root</systemitem> user, test your connection to \r
409                                         <systemitem class="service">OpenSRF</systemitem> \r
410                                         using the <command>srfsh</command> utility and trying to call the <command>add</command> method on the OpenSRF \r
411                                         <systemitem class="service">math</systemitem> service:</para>\r
412                                 \r
413 <screen>\r
414 <userinput>/openils/bin/srfsh</userinput>\r
415 <prompt>srfsh#</prompt> <userinput>request opensrf.math add 2 2</userinput>\r
416 Received Data: 4\r
417 ------------------------------------\r
418 Request Completed Successfully\r
419 Request Time in seconds: 0.007519\r
420 ------------------------------------\r
421 <prompt>srfsh#</prompt>\r
422 </screen>\r
423                                 \r
424                                         <para>For other <command>srfsh</command> commands, type <userinput>help</userinput> in at the prompt.</para>\r
425                                 </step>\r
426                                 <step>\r
427                                         <title>Stopping OpenSRF</title>\r
428                                         <para>As the <systemitem class="username">opensrf</systemitem> user, stop OpenSRF:</para>\r
429 <screen>\r
430 <userinput>osrf_ctl.sh -l -a stop_all</userinput>\r
431 </screen>               \r
432                                 </step>\r
433                         </procedure>\r
434                 </section>\r
435                 <section xml:id="serversideinstallation-ubuntudebian">\r
436                         <title>Installing Evergreen 1.6.0.7 On <systemitem class="osname">Ubuntu</systemitem> or <systemitem class="osname">Debian</systemitem></title>\r
437                         <para>This section outlines the installation process for the latest stable version of Evergreen.</para>\r
438                         <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 \r
439                         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 \r
440                         around a few known issues.</para>\r
441                         <note>\r
442                                 <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 \r
443                                 of <systemitem class="osname">Ubuntu</systemitem>. These instructions assume the Server edition.</para>\r
444                                 <para>In the following instructions, you are asked to perform certain steps as either the <systemitem class="username">root</systemitem> user, the \r
445                                 <systemitem class="username">opensrf</systemitem> user, or the <systemitem class="username">postgres</systemitem> user.</para>\r
446                                 <itemizedlist>\r
447                                         <listitem><systemitem class="osname">Debian</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command \r
448                                         <command>su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>\r
449                                         <listitem><systemitem class="osname">Ubuntu</systemitem> -- To become the <systemitem class="username">root</systemitem> user, issue the command <command>sudo \r
450                                         su -</command> and enter the password of the <systemitem class="username">root</systemitem> user.</listitem>\r
451                                 </itemizedlist>\r
452                                 <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 \r
453                                 switch from the <systemitem class="username">root</systemitem> user to the <systemitem class="username">opensrf</systemitem> user, issue the command \r
454                                 <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 \r
455                                 command <command>exit</command>.</para>\r
456                         </note>\r
457                         <procedure>\r
458                                 <step>                                  \r
459                                         <title>Install OpenSRF</title>\r
460                                         <para>Evergreen software is integrated with and depends on the Open Service Request Framework (OpenSRF) software system. For further information on installing, \r
461                                         configuring and testing OpenSRF, see <xref linkend="serversideinstallation-opensrf"/>.</para>\r
462                                         <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 \r
463                                         further Evergreen installation steps until you have verified that OpenSRF has been successfully installed.</para>\r
464                                 </step>\r
465                                 <step>\r
466                                         <title>Download and Unpack Latest Evergreen Version</title>\r
467                                         <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract the latest version of Evergreen. The latest version can be found here: \r
468                                         <ulink url="http://evergreen-ils.org/downloads/Evergreen-ILS-1.6.0.7.tar.gz"></ulink></para>\r
469 <screen>\r
470 <userinput>wget http://evergreen-ils.org/downloads/Evergreen-ILS-1.6.0.7.tar.gz</userinput>\r
471 <userinput>tar zxf Evergreen-ILS-1.6.0.7.tar.gz</userinput>\r
472 </screen>\r
473                                         <para>The new directory <filename class="directory">/home/opensrf/Evergreen-ILS-1.6.0.7</filename> will be created.</para>\r
474                                 </step>\r
475                                 <step>\r
476                                         <title>Install Prerequisites to Build Evergreen</title>\r
477                                         <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 \r
478                                         the software using the <command>make</command> utility.</para>\r
479                                         <para>As the <systemitem class="username">root</systemitem> user, enter the commands show below to build the prerequisites from the software distribution that you \r
480                                         just downloaded and unpacked. Remember to replace <emphasis>[distribution]</emphasis> in the example with the keyword corresponding to the actual \r
481                                         <systemitem class="osname">Linux</systemitem> distribution listed in the \r
482                                         <link linkend="serversideinstallation-keywords-evergreen">distribution keywords</link> table.</para>\r
483 <screen>\r
484 <userinput>cd /home/opensrf/Evergreen-ILS-1.6.0.7</userinput>\r
485 <userinput>make -f Open-ILS/src/extras/Makefile.install [distribution]</userinput>\r
486 </screen>\r
487                                         <table xml:id="serversideinstallation-keywords-evergreen">\r
488                                                 <tgroup align="left" cols="2" colsep="1" rowsep="1">\r
489                                                         <colspec colnum="1" colwidth="1.0*"/>\r
490                                                         <colspec colnum="2" colwidth="3.0*"/>\r
491                                                         <thead>\r
492                                                                 <row>\r
493                                                                         <entry>Keyword</entry>\r
494                                                                         <entry>Description</entry>\r
495                                                                 </row>\r
496                                                         </thead>\r
497                                                         <tbody>\r
498                                                                 <row>\r
499                                                                         <entry>debian-lenny</entry>\r
500                                                                         <entry>for Debian Lenny (5.0), the most recent version</entry>\r
501                                                                 </row>\r
502                                                                 <row>\r
503                                                                         <entry>debian-etch</entry>\r
504                                                                         <entry>for Debian Etch (4.0)</entry>\r
505                                                                 </row>\r
506                                                                 <row>\r
507                                                                         <entry>ubuntu-karmic</entry>\r
508                                                                         <entry>for Ubuntu Lucid (10.04) [same as for Karmic]</entry>\r
509                                                                 </row>\r
510                                                                 <row>\r
511                                                                         <entry>ubuntu-karmic</entry>\r
512                                                                         <entry>for Ubuntu Karmic (9.10)</entry>\r
513                                                                 </row>\r
514                                                                 <row>\r
515                                                                         <entry>ubuntu-intrepid</entry>\r
516                                                                         <entry>for Ubuntu Intrepid (8.10)</entry>\r
517                                                                 </row>\r
518                                                                 <row>\r
519                                                                         <entry>ubuntu-hardy</entry>\r
520                                                                         <entry>for Ubuntu Hardy (8.04)</entry>\r
521                                                                 </row>\r
522                                                                 <row>\r
523                                                                         <entry>ubuntu-gutsy</entry>\r
524                                                                         <entry>for Ubuntu Gutsy (7.10)</entry>\r
525                                                                 </row>\r
526                                                                 <row>\r
527                                                                         <entry>gentoo</entry>\r
528                                                                         <entry>generic for Gentoo versions</entry>\r
529                                                                 </row>\r
530                                                                 <row>\r
531                                                                         <entry>centos</entry>\r
532                                                                         <entry>generic for Centos versions</entry>\r
533                                                                 </row>\r
534                                                         </tbody>\r
535                                                 </tgroup>\r
536                                         </table>\r
537                                         <indexterm>\r
538                                                 <primary>ZZZ-REVIEW</primary>\r
539                                                 <secondary>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </secondary>\r
540                                         </indexterm>\r
541                                         <caution>ADD INFO FOR OTHER LINUX DISTRIBUTIONS </caution>\r
542                                 </step>\r
543                                 <step xml:id="serversideinstallation-postgresql-default">\r
544                                         <title>(OPTIONAL) Install the PostgreSQL Server</title>\r
545                                         <para>Since the PostgreSQL server is usually a standalone server in multi-server production systems, the prerequisite installer Makefile in the previous step \r
546                                         does not automatically install PostgreSQL. If your PostgreSQL server is on a different system, just skip this step.</para>\r
547                                         <para>For further information on manually installing PostgreSQL, visit the <link xl:href="http://www.postgresql.org/">PostgreSQL Site</link>.</para>\r
548                                         <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 \r
549                                         required PostgreSQL server packages:</para>\r
550                                         <screen><userinput>su - root</userinput></screen>\r
551                                         <para>For <systemitem class="osname">Debian Lenny</systemitem> and <systemitem class="osname">Ubuntu Hardy (8.04)</systemitem>:</para>\r
552                                         <screen><userinput>make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_83</userinput></screen>\r
553                                         <para>For <systemitem class="osname">Ubuntu Karmic (9.10)</systemitem> and <systemitem class="osname">Ubuntu Lucid (10.04)</systemitem>:</para>\r
554                                         <screen><userinput>make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_84</userinput></screen>\r
555                                         <note>\r
556                                                 <para>Postgresql 8.3 or 8.4 are the recommended versions to work with Evergreen 1.6. If you have an older version of PostgreSQL, you should upgrade before \r
557                                                 installing Evergreen. To find the running version of PostgreSQL, switch to the <systemitem class="username">postgres</systemitem> user and run the \r
558                                                 <command>psql</command>. Then type <userinput>SELECT version();</userinput> to get detailed information of your version of PostgreSQL.</para>\r
559                                         </note>\r
560                                 </step>\r
561                                 <step performance="optional">\r
562                                         <title>Install Perl Modules on PostgreSQL Server</title>\r
563                                         <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>\r
564                                         <para>Otherwise, if your PostgreSQL server is running on another system, then as the <systemitem class="username">root</systemitem> user install the following Perl \r
565                                         modules on that system:</para>\r
566                                         <para>ensure the gcc compiler is installed:</para>\r
567 <screen>\r
568 <userinput>apt-get install gcc</userinput>\r
569 </screen>\r
570                                 <para>install the Perl modules</para>\r
571 <screen>\r
572 <userinput>perl -MCPAN -e shell</userinput>\r
573 <prompt>cpan></prompt> <userinput>install JSON::XS</userinput>\r
574 <prompt>cpan></prompt> <userinput>install MARC::Record</userinput>\r
575 <prompt>cpan></prompt> <userinput>install MARC::File::XML</userinput>\r
576 </screen>\r
577                                 <para>For more information on installing Perl Modules vist the <link xl:href="http://www.cpan.org/">CPAN</link> site.</para>\r
578                                 </step>                                 \r
579                                 <step>\r
580                                         <title>Update the System Dynamic Library Path</title>\r
581                                         <para>As the <systemitem class="username">root</systemitem> user, you must update the system dynamic library path to make your system recognize the newly \r
582                                         installed libraries. Do this by creating the new file <filename>/etc/ld.so.conf.d/eg.conf</filename> containing two new library path.</para> \r
583                                         <para>Create a file named /etc/ld.so.conf.d/eg.conf containing the following lines:</para>                      \r
584 <programlisting>\r
585 /usr/local/lib\r
586 /usr/local/lib/dbd\r
587 </programlisting>\r
588                                         <para>Then run the command <command>ldconfig</command> to automatically read the file and modify the system dynamic library path:</para>\r
589                                         <screen><userinput>ldconfig</userinput></screen>\r
590                         \r
591                                 </step>\r
592                                 <step preformance="optional">\r
593                                         <title>Restart the PostgreSQL Server</title>\r
594                                         <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 \r
595                                         PostgreSQL. If PostgreSQL is running on another system, you may skip this step.</para>          \r
596                                         <screen><userinput>/etc/init.d/postgresql-[PGSQL_VERSION] restart</userinput></screen>\r
597                                         <para>Where <literal>PGSQL_VERSION</literal> is your installed PostgreSQL version (e.g. <literal>8.3</literal>).</para>\r
598                                 </step>\r
599                                 <step xml:id="serversideinstallation-configure">\r
600                                         <title>Configure Evergreen</title>\r
601                                         <para>As the <systemitem class="username">opensrf</systemitem> user, return to the Evergreen build directory and use the <command>configure</command> utility to \r
602                                         prepare for the next step of compiling and linking the software:</para>\r
603 <screen>\r
604 <userinput>cd /home/opensrf/Evergreen-ILS-1.6.0.7</userinput>\r
605 <userinput>./configure --prefix=/openils --sysconfdir=/openils/conf</userinput>\r
606 <userinput>make</userinput>\r
607 </screen>\r
608                                 </step>\r
609                                 <step xml:id="serversideinstallation-compilingevergreen">\r
610                                         <title>Compile, Link and Install Evergreen</title>\r
611                                         <para>In this step you will actually compile, link and install Evergreen and the default Evergreen Staff Client.</para>\r
612                                         <para>As the <systemitem class="username">root</systemitem> user, return to the Evergreen build directory and use the <command>make</command> utility as \r
613                                         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>\r
614                                         <para>For further information on manually building the Staff Client, see <xref linkend="serversideinstallation-building-staffclient"/>.</para>\r
615 <screen>\r
616 <userinput>cd /home/opensrf/Evergreen-ILS-1.6.0.7</userinput>\r
617 <userinput>make STAFF_CLIENT_BUILD_ID=rel_1_6_0_7 install</userinput>\r
618 </screen>\r
619                                         <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>\r
620                                         <para>To complete the Staff Client installation, as the <systemitem class="username">root</systemitem> user create a symbolic link named <emphasis>server</emphasis> \r
621                                         in the head of the Staff Client directory <filename class="directory">/openils/var/web/xul</filename> that points to the subdirectory \r
622                                         <filename class="directory">/server</filename> of the new Staff Client build:</para>    \r
623 <screen>\r
624 <userinput>cd /openils/var/web/xul</userinput>\r
625 <userinput>ln -sf rel_1_6_0_7/server server</userinput>\r
626 </screen>\r
627                                 </step>\r
628                                 <step>\r
629                                         <title>Copy the OpenSRF Configuration Files</title>\r
630                                         <para>As the <systemitem class="username">root</systemitem> user, copy the example OpenSRF configuration files into place. This replaces the configuration \r
631                                         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 \r
632                                         purposes. Finally, change the ownership on the installed files to the <systemitem class="username">opensrf</systemitem> user:</para>\r
633 <screen>\r
634 <userinput>cp /openils/conf/opensrf.xml.example      /openils/conf/opensrf.xml</userinput>\r
635 <userinput>cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml</userinput>\r
636 <userinput>cp /openils/conf/oils_web.xml.example     /openils/conf/oils_web.xml</userinput>\r
637 <userinput>chown -R opensrf:opensrf /openils/</userinput>\r
638 </screen>\r
639                                 </step>\r
640                                 <step>\r
641                                         <title>Create and Configure PostgreSQL Database</title>\r
642                                         <para>As the <systemitem class="username">postgres</systemitem> user on your PostgreSQL server, create the Evergreen database.</para>\r
643                                         <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 \r
644                                         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 \r
645                                         server packages on <systemitem class="osname">Ubuntu 8.04</systemitem>, the path would be \r
646                                         <filename class="directory">/usr/share/postgresql/8.3/contrib/</filename>.</para>\r
647                                         <substeps>\r
648                                                 <step>\r
649                                                         <para>\r
650                                                                 <emphasis role="bold">Create and configure the database</emphasis>\r
651                                                         </para>\r
652                                                         <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL system create the PostgreSQL database, then set some internal \r
653                                                         paths:</para>\r
654                                                         <para>Create the database:</para>\r
655 <screen>\r
656 <userinput>createdb -E UNICODE evergreen</userinput>\r
657 <userinput>createlang plperl   evergreen</userinput>\r
658 <userinput>createlang plperlu  evergreen</userinput>\r
659 <userinput>createlang plpgsql  evergreen</userinput>\r
660 </screen>\r
661                                                         <para>Adjust the paths:</para>\r
662 <screen>\r
663 <userinput>psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/tablefunc.sql evergreen</userinput>\r
664 <userinput>psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/tsearch2.sql  evergreen</userinput>\r
665 <userinput>psql -f /usr/share/postgresql/PGSQL_VERSION/contrib/pgxml.sql     evergreen</userinput>\r
666 </screen>\r
667                                                         <para>Where <literal>PGSQL_VERSION</literal> is your installed PostgreSQL version (e.g. <literal>8.3</literal>).</para>\r
668                                                 </step>\r
669                                                 <step>\r
670                                                         <title>Create a new Evergreen superuser</title>\r
671                                                         <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL system, create the new database \r
672                                                         <systemitem class="username">evergreen</systemitem> user and assign a password:</para>                          \r
673                                                         <screen><userinput>createuser -P -s evergreen</userinput></screen>      \r
674                                                         <para>Enter the password twice for new role when prompted.</para>                                       \r
675                                                 </step>\r
676                                                 <step>\r
677                                                         <title>Create Database Schema</title>\r
678                                                         <para>As the <systemitem class="username">root</systemitem> user, create the database schema and configure your system with the corresponding \r
679                                                         database authentication details for the <emphasis>evergreen</emphasis> database user that you created in the previous step.</para>\r
680                                                         <para>Enter the following commands and replace <emphasis>HOSTNAME, PORT, PASSWORD</emphasis> and <emphasis>DATABASENAME</emphasis> with appropriate \r
681                                                         values.</para>\r
682 <screen>\r
683 <userinput>cd /home/opensrf/Evergreen-ILS-1.6.0.7</userinput>\r
684 <userinput>perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \\r
685         --service all --create-schema --create-bootstrap --create-offline \\r
686         --hostname HOSTNAME --port PORT \\r
687         --user evergreen --password PASSWORD --database DATABASENAME</userinput>\r
688 </screen>\r
689                                                         <para>On most systems, <emphasis>HOSTNAME</emphasis> will be <emphasis role="bold">localhost</emphasis>, <emphasis>PORT</emphasis> will be \r
690                                                         <emphasis role="bold">5432</emphasis>, and <emphasis>PASSWORD</emphasis> and <emphasis>DATABASENAME</emphasis> will be\r
691                                                          <emphasis role="bold">evergreen</emphasis>.</para>\r
692                                                         <note>\r
693                                                                 <para>If you are entering the above command on a single line, do not include the <literal>\</literal> (backslash) characters. \r
694                                                                         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 \r
695                                                                         that the command is continued on the next line.</para>\r
696                                                         </note>\r
697                                                 </step>\r
698                                                 <step>\r
699                                                         <title>Modify the Apache configuration files for the Evergreen site.</title>\r
700                                                         <substeps>\r
701                                                                 <step>\r
702                                                                         <para>Enable some built-in Apache modules with the utility <command>a2enmod</command>, and install some additional Apache \r
703                                                                         configuration files. As the <systemitem class="username">root</systemitem> user, enable some modules in the Apache server, then copy \r
704                                                                         the new configuration files to the Apache server directories:</para>\r
705                                                                         <para>Enable the required Apache Modules:</para>\r
706 <screen>\r
707 <userinput>a2enmod ssl       # enable mod_ssl</userinput>\r
708 <userinput>a2enmod rewrite    # enable mod_rewrite</userinput>\r
709 <userinput>a2enmod expires    # enable mod_expires</userinput>\r
710 <userinput>cd /home/opensrf/Evergreen-ILS-1.x.x.x</userinput>\r
711 </screen>               \r
712                                                                 </step>\r
713                                                                 <step>\r
714                                                                         <para>Copy the Apache configuration files from the Evergreen installation dierectory:</para>\r
715 <screen>\r
716 <userinput>cp Open-ILS/examples/apache/eg.conf   /etc/apache2/sites-available/</userinput>\r
717 <userinput>cp Open-ILS/examples/apache/eg_vhost.conf   /etc/apache2/</userinput>\r
718 <userinput>cp Open-ILS/examples/apache/startup.pl      /etc/apache2/</userinput>\r
719 </screen>\r
720                                         \r
721                                                                 </step>\r
722                                                                 <step xml:id="serversideinstallation-createsslkey">\r
723                                                                         <para>Create a new Security Certificate (SSL Key) for the Apache server with the command <command>openssl</command>. For a \r
724                                                                         public production server you should configure or purchase a signed SSL certificate, but for now you can just use a \r
725                                                                         self-signed certificate and accept the warnings in the Staff Client and browser during testing and development:</para>\r
726 <screen>\r
727 <userinput>mkdir /etc/apache2/ssl</userinput>\r
728 <userinput>cd /etc/apache2/ssl</userinput>\r
729 <userinput>openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key</userinput>\r
730 </screen>\r
731                                                 \r
732                                                                         <note>\r
733                                                                                 <para>This generates a self-signed SSL certificate. You should acquire a proper SSL certificate for a public \r
734                                                                                 production system to avoid warning messages when users login to their account through the OPAC or when staff \r
735                                                                                 login through the staff client.</para>\r
736                                                                                 <para>For further information on getting a proper SSL certificate, see <xref linkend="serversideinstallation-ssl"/>.</para>\r
737                                                                         </note>\r
738                                                                 </step>\r
739                                                                 <step>\r
740                                                                 <para>Several changes are needed in the new Apache configuration file <filename>/etc/apache2/sites-available/eg.conf</filename>. \r
741                                                                 As the <systemitem class="username">root</systemitem> user, edit the file and make the following changes:</para>\r
742                                                                 <substeps>\r
743                                                                         <step>\r
744                                                                                 <para>Comment out the line <literal>Listen 443</literal>, since it conflicts with the same declaration in the configuration \r
745                                                                                 file: <filename>/etc/apache2/ports.conf</filename>. <systemitem class="osname">Debian Etch</systemitem> users should not \r
746                                                                                 do this since the conflict does not apply to that OS.</para>    \r
747                                                                         </step>\r
748                                                                         <step>  \r
749                                                                                 <para>For the <systemitem class="osname">Linux</systemitem> distributions \r
750                                                                                 <systemitem class="osname">Ubuntu Hardy</systemitem> \r
751                                                                                 or <systemitem class="osname">Debian Etch</systemitem>, as the <systemitem class="username">root</systemitem> user, edit the \r
752                                                                                 Apache configuration file <filename>/etc/apache2/apache2.conf</filename> and change <literal>User www-data</literal> to \r
753                                                                                 <literal>User opensrf</literal>.</para>                                                                 \r
754                                                                                 <para>For the <systemitem class="osname">Linux</systemitem> distributions <systemitem class="osname">Ubuntu \r
755                                                                                 Karmic</systemitem> or  <systemitem class="osname">Ubuntu Lucid</systemitem> or \r
756                                                                                 <systemitem class="osname">Debian Lenny</systemitem>, as the <systemitem class="username">root</systemitem> user, \r
757                                                                                 edit the Apache configuration file <filename>/etc/apache2/envvars</filename> and \r
758                                                                                 change the line <literal>export APACHE_RUN_USER=www-data</literal> to  <literal>export APACHE_RUN_USER=opensrf</literal>.\r
759                                                                                 </para>\r
760                                                                                 <para>The following updates are needed to allow the logs to function properly, but it may break other Apache applications \r
761                                                                                 on your server.</para>\r
762                                                                         </step>\r
763                                                                 </substeps>     \r
764                                                         </step>\r
765                                                         <step>\r
766                                                                 <para>As the <systemitem class="username">root</systemitem> user, edit the Apache configuration file \r
767                                                                 <filename>/etc/apache2/apache2.conf</filename> and add the lines <literal>KeepAliveTimeout 1</literal> and \r
768                                                                 <literal>MaxKeepAliveRequests 100</literal>, or modify any existing lines.</para>\r
769                                                         </step>\r
770                                                 </substeps>\r
771                                         </step>\r
772                                         <step performance="optional">\r
773                                                 <title>Performance Modifications for Apache</title>\r
774                                                 <para>Some further configuration changes to Apache may be necessary for busy systems. These changes increase the number of Apache server processes that are \r
775                                                 started to support additional browser connections.</para>\r
776                                                 <para>As the <systemitem class="username">root</systemitem> user, edit the Apache configuration file <filename>/etc/apache2/apache2.conf</filename>, \r
777                                                 locate and modify the section related to <emphasis>prefork configuration</emphasis> to suit the load on your system.</para>\r
778                                                 \r
779 <programlisting language="xml"><![CDATA[\r
780 <IfModule mpm_prefork_module>\r
781    StartServers           20\r
782    MinSpareServers         5\r
783    MaxSpareServers        15\r
784    MaxClients            150\r
785    MaxRequestsPerChild 10000\r
786 </IfModule>\r
787 ]]></programlisting>                                            \r
788                                         </step>\r
789                                         <step>\r
790                                                 <para>Finally, as the <systemitem class="username">root</systemitem> user, execute the following Apache configuration commands to disable the default \r
791                                                 <emphasis>It Works</emphasis> web page and to enable the Evergreen web site:</para>\r
792 <screen>\r
793 <userinput>a2dissite default</userinput>\r
794 <userinput>a2ensite eg.conf</userinput>\r
795 </screen>                               \r
796                                         </step>\r
797                                 </substeps>\r
798                         </step>\r
799                         <step xml:id="serversideinstallation-opensrf-config">\r
800                                 <title>Modify the OpenSRF Configuration File</title>\r
801                                 <para>As the <systemitem class="username">opensrf</systemitem> user, edit the OpenSRF configuration file <filename>/openils/conf/opensrf_core.xml</filename> to \r
802                                 update the Jabber usernames and passwords, and to specify the domain from which we will accept and to which we will make connections.</para>\r
803                                 <para>If you are installing Evergreen on a single server and using the <systemitem class="domainname">private.localhost</systemitem> / \r
804                                 <systemitem class="domainname">public.localhost</systemitem> domains, these will already be set to the correct values. Otherwise, search and replace to match \r
805                                 your customized values.</para>\r
806                                 <para>The following example uses common XPath syntax on the left-hand side to indicate the approximate position needing changes within the XML file:</para>\r
807                                 <para>/config/opensrf/username = <systemitem class="username">opensrf</systemitem></para>\r
808                                         <para>/config/opensrf/passwd = password for <systemitem class="domainname">private.localhost</systemitem>\r
809                                         <systemitem class="username">opensrf</systemitem> user</para>\r
810                                         <para>/config/gateway/username = <systemitem class="username">opensrf</systemitem></para>\r
811                                         <para>/config/gateway/passwd = password for <systemitem class="domainname">public.localhost</systemitem> \r
812                                         <systemitem class="username">opensrf</systemitem>  user</para>\r
813                                         <para>/config/routers/router/transport  (first entry, where <quote>transport/server</quote> == <systemitem class="domainname">public.localhost</systemitem>)</para>\r
814                                                 <itemizedlist>\r
815                                                         <listitem>username = <systemitem class="username">router</systemitem></listitem> \r
816                                                         <listitem>password = password for <systemitem class="domainname">public.localhost</systemitem> <systemitem class="username">router</systemitem> \r
817                                                         user</listitem>\r
818                                                 </itemizedlist>\r
819                                         <para>/config/routers/router/transport  (second entry, where <quote>transport/server</quote> == <systemitem \r
820                                         class="domainname">private.localhost</systemitem>) </para>\r
821                                                 <itemizedlist>\r
822                                                         <listitem>username = <systemitem class="username">router</systemitem></listitem> \r
823                                                         <listitem>password = password for <systemitem class="domainname">private.localhost</systemitem> <systemitem class="username">router</systemitem> \r
824                                                         user</listitem>\r
825                                                 </itemizedlist>\r
826                                         \r
827                         </step>\r
828                         <step xml:id="serversideinstallation-srfsh">\r
829                                 <title>Create Configuration Files for Users Needing <application>"srfsh"</application></title>\r
830                                 <para>The software installation will automatically create a utility named <command>srfsh</command> (surf shell). This is a command line diagnostic tool for \r
831                                 testing and interacting with the OpenSRF network software. It will be used in a future step to complete and test the Evergreen installation. \r
832                                 See <xref linkend="serversideinstallation-testing"/> for further information.</para>\r
833                                 <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 \r
834                                 file <filename>/openils/conf/srfsh.xml.example</filename> to the file <filename>.srfsh.xml</filename> (note the leading dot!) in the home directory of \r
835                                 each user who will use <command>srfsh</command>. Finally, edit each users' <filename>.srfsh.xml</filename> file and make the following changes:</para>\r
836                                 <substeps>\r
837                                         <step>\r
838                                                 <para>Modify <emphasis role="bold">domain</emphasis> to be the router hostname (following our domain examples, \r
839                                                 <systemitem class="domainname">private.localhost</systemitem>> will give <application>"srfsh"</application> access to all OpenSRF services, \r
840                                                 while <systemitem class="domainname">public.localhost</systemitem> will only allow access to those OpenSRF services that are publicly exposed).</para>\r
841                                         </step>\r
842                                         <step>\r
843                                                 <para>Modify <emphasis role="bold">username</emphasis> and <emphasis role="bold">password</emphasis> to match the \r
844                                                 <systemitem class="username">opensrf</systemitem> Jabber user for the chosen domain.</para>\r
845                                         </step>\r
846                                         <step>\r
847                                                 <para>Modify <emphasis role="bold">logfile</emphasis> to be the full path for a log file to which the user has write access.</para>\r
848                                         </step>\r
849                                         <step>\r
850                                                 <para>Modify <emphasis role="bold">loglevel</emphasis> as needed for testing.</para>\r
851                                         </step>\r
852                                 </substeps>\r
853 <programlisting language="xml"><![CDATA[\r
854 <?xml version="1.0"?>\r
855 <!-- This file follows the standard bootstrap config file layout -->\r
856 <!-- found in opensrf_core.xml -->\r
857 <srfsh>\r
858 <router_name>router</router_name>\r
859 <domain>private.localhost</domain>\r
860 <username>opensrf</username>\r
861 <passwd>evergreen</passwd>\r
862 <port>5222</port>\r
863 <logfile>/tmp/srfsh.log</logfile>\r
864 <!-- 0 None, 1 Error, 2 Warning, 3 Info, 4 debug, 5 Internal (Nasty) -->\r
865 <loglevel>4</loglevel>\r
866 </srfsh>\r
867 ]]></programlisting>\r
868                         </step>\r
869                         <step xml:id="serversideinstallation-opensrf-env">\r
870                                 <title>Modify the OpenSRF Environment</title>\r
871                                  <para>Modify the shell configuration file <filename>~/.bashrc</filename> for <systemitem class="username">opensrf</systemitem> by adding a Perl environmental \r
872                                 variable and execute the shell configuration file to load the new variables into your current environment.</para>\r
873                                 <note>\r
874                                         <para>\r
875                                                 <emphasis>In a multi-server environment, you must add any modifications to <filename>~/.bashrc</filename> to the top of the file \r
876                                                 <emphasis>before</emphasis> the line <literal>[ -z "$PS1" ] &amp;&amp; return </literal>. This will allow headless (scripted) logins to \r
877                                                 load the correct environment.</emphasis>\r
878                                         </para>\r
879                                 </note>\r
880 <screen>\r
881 <userinput>echo "export PERL5LIB=/openils/lib/perl5:\$PERL5LIB" >> ~/.bashrc</userinput>\r
882 <userinput>. ~/.bashrc</userinput>\r
883 </screen>\r
884                         </step>\r
885                         <step xml:id="serversideinstallation-starting">\r
886                                 <title>Start Evergreen</title>\r
887                                 <substeps>\r
888                                         <step>\r
889                                                 <para>As the <systemitem class="username">root</systemitem> user, start the <systemitem class="service">ejabberd</systemitem> and \r
890                                                 <systemitem class="service">memcached</systemitem> services (if they are not already running):</para>\r
891 <screen>\r
892 <userinput>/etc/init.d/ejabberd start</userinput>\r
893 <userinput>/etc/init.d/memcached start</userinput>\r
894 </screen>\r
895                                         </step>\r
896                                         <step>\r
897                                                 <para>As the <systemitem class="username">opensrf</systemitem> user, start Evergreen.</para>\r
898                                                 <para>Use the flag <option>-l</option> to force Evergreen to use <systemitem class="domainname">localhost</systemitem> \r
899                                                 (your current system) as the hostname. \r
900                                                 Using the <option>start_all</option> option will start the OpenSRF <systemitem class="service">router</systemitem> , \r
901                                                 <systemitem class="service">Perl</systemitem> , and <systemitem class="service">C</systemitem> services:</para>                                         \r
902                                                 <screen>$ osrf_ctl.sh -l -a start_all</screen>\r
903                                                 <note>\r
904                                                         <para>\r
905                                                                 <emphasis>You can also start Evergreen <emphasis role="bold">without</emphasis> the <option>-l</option> flag, but the \r
906                                                                 <command>osrf_ctl.sh</command> utility must know the fully qualified domain name for the system on which it will execute. \r
907                                                                 That hostname may have been specified in the configuration file <filename>opensrf.xml</filename>, which you configured in a \r
908                                                                 previous step.</emphasis>\r
909                                                         </para>\r
910                                                         <para>Use the <command>hostname</command> command to determine the fully qualified domain name of your system.</para>\r
911                                                 </note>\r
912                                                 <itemizedlist>\r
913                                                         <listitem>\r
914                                                                 <para>If you receive an error message similar to <emphasis>osrf_ctl.sh: command not found</emphasis>, then your environment \r
915                                                                 variable <envar>PATH</envar> does not include the directory <filename class="directory">/openils/bin</filename>. \r
916                                                                 As the <systemitem class="username">opensrf</systemitem> user, edit the configuration file <filename>/home/opensrf/.bashrc</filename> \r
917                                                                 and add the following line: <literal>export PATH=$PATH:/openils/bin</literal></para>\r
918                                                         </listitem>\r
919                                                         <listitem>\r
920                                                                 <para>If you receive an error message similar to <errortext>Can't locate OpenSRF/System.pm in @INC ... \r
921                                                                 BEGIN failed--compilation aborted</errortext>, then your environment variable <emphasis role="bold">PERL5LIB</emphasis> does not \r
922                                                                 include the directory <filename class="directory">/openils/lib/perl5</filename>. As the \r
923                                                                 <systemitem class="username">opensrf</systemitem> user, edit the configuration file <filename>/home/opensrf/.bashrc</filename> \r
924                                                                 and add the following line: <literal>export PERL5LIB=$PERL5LIB:/openils/lib/perl5</literal></para>\r
925                                                         </listitem>\r
926                                                 </itemizedlist>\r
927                                         </step>\r
928                                         <step>\r
929                                                 <para>As the <systemitem class="username">opensrf</systemitem> user, generate the Web files needed by the Staff Client and catalog, \r
930                                                 and calculate the proximity of locations in the Organizational Unit tree (which allows <emphasis>Holds</emphasis> to work properly).</para>\r
931                                                 <para>You must do this the first time you start Evergreen, and after making any changes to the library hierarchy.</para>\r
932 <screen>\r
933 <userinput>cd /openils/bin</userinput>\r
934 <userinput>./autogen.sh -c /openils/conf/opensrf_core.xml -u</userinput>\r
935 Updating Evergreen organization tree and IDL using '/openils/conf/opensrf_core.xml'\r
936 Updating fieldmapper\r
937 </screen>\r
938                                         </step>\r
939                                         <step>\r
940                                                 <para>As the <systemitem class="username">root</systemitem> user, restart the Apache Web server:</para>\r
941                                                 <screen>/etc/init.d/apache2 restart</screen>\r
942                                                 <note><para>If the Apache Web server was running when you started the OpenSRF services, you might not be able to successfully log in to the OPAC or Staff \r
943                                                 Client until the Apache Web server is restarted.</para></note>\r
944                                         </step>\r
945                                 </substeps>\r
946                         </step>\r
947                 </procedure>\r
948         </section>              \r
949         <section xml:id="serversideinstallation-testing">\r
950                                 <title>Testing the Installation</title>\r
951                                 <para>This section describes several simple tests you can perform to verify that the Evergreen server-side software has been installed and configured properly \r
952                                 and is running as expected.</para>\r
953                                 <simplesect xml:id="serversideinstallation-testing-connections">\r
954                                         <title>Testing Connections to Evergreen</title>\r
955                                         <para>Once you have installed and started Evergreen, test your connection to Evergreen. As the <systemitem class="username">opensrf</systemitem> user start \r
956                                         the <command>srfsh</command> application and try logging onto the Evergreen server using the default administrator username and password. Following \r
957                                         is sample output generated by executing that script after a successful Evergreen installation:</para>                   \r
958 <screen>\r
959 <userinput>/openils/bin/srfsh</userinput>\r
960 <prompt>srfsh%</prompt> <userinput>login admin open-ils</userinput>\r
961 Received Data: "250bf1518c7527a03249858687714376"\r
962 ------------------------------------\r
963 Request Completed Successfully\r
964 Request Time in seconds: 0.045286\r
965 ------------------------------------\r
966 Received Data: {\r
967    "ilsevent":0,\r
968    "textcode":"SUCCESS",\r
969    "desc":" ",\r
970    "pid":21616,\r
971    "stacktrace":"oils_auth.c:304",\r
972    "payload":{\r
973       "authtoken":"e5f9827cc0f93b503a1cc66bee6bdd1a",\r
974       "authtime":420\r
975    }\r
976 }\r
977 ------------------------------------\r
978 Request Completed Successfully\r
979 Request Time in seconds: 1.336568\r
980 ------------------------------------\r
981 </screen>\r
982                                         <para>The first argument is how many sets of 4 queries (+ - * /) are sent to <systemitem class="service">opensrf.math</systemitem>. When the response is \r
983                                         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 \r
984                                         all.</para>\r
985                                         <para>For other <application>"srfsh"</application> commands, type <userinput>help</userinput> in at the prompt.</para>\r
986                                         <para/>\r
987                                         <para>If this test fails or you have any other problems during installation, refer to the <xref linkend="troubleshooting" /> chapter.</para>\r
988                                 </simplesect>\r
989                         </section>\r
990                         <section xml:id="serversideinstallation-virtual">\r
991                         <title>Installing In Virtualized Unix Environments</title>\r
992                         <para>Evergreen software currently runs as a native application on any of several well-known <systemitem class="osname">Linux</systemitem> distributions (e.g., \r
993                         <systemitem class="osname">Ubuntu</systemitem> and <systemitem class="osname">Debian</systemitem>). It does not run as a native application on the \r
994                         <systemitem class="osname">Windows</systemitem> operating system (e.g., <systemitem class="osname">WindowsXP</systemitem>, \r
995                         <systemitem class="osname">WindowsXP Professional</systemitem>, <systemitem class="osname">Windows7</systemitem>), but the software can be installed and run on \r
996                         <systemitem class="osname">Windows</systemitem> via a virtualized Linux-guest Operating System (using, for example, <application>"VirtualBox"</application> \r
997                         or <application>"VMware"</application> to emulate a <systemitem class="osname">Linux</systemitem> environment).</para>\r
998                         <indexterm>\r
999                                 <primary>ZZZ-REVIEW</primary>\r
1000                                 <secondary>ADD CONTENT FOR INSTALLING EVERGREEN IN VIRTUALIZED UNIX ENVIRONMENTS </secondary>\r
1001                         </indexterm>\r
1002                         <caution>ADD CONTENT FOR INSTALLING EVERGREEN IN VIRTUALIZED UNIX ENVIRONMENTS </caution>\r
1003                         <simplesect xml:id="serversideinstallation-virtualized-virtualbox">\r
1004                                 <title>VirtualBox</title>\r
1005                                 <indexterm>\r
1006                                         <primary>ZZZ-REVIEW</primary>\r
1007                                         <secondary>ADD CONTENT FOR VirtualBox </secondary>\r
1008                                 </indexterm>\r
1009                                 <caution>ADD CONTENT FOR VirtualBox </caution>\r
1010                         </simplesect>\r
1011                         <simplesect xml:id="serversideinstallation-virtualized-vmware">\r
1012                                 <title>VMware</title>\r
1013                                 <indexterm>\r
1014                                         <primary>ZZZ-REVIEW</primary>\r
1015                                         <secondary>ADD CONTENT FOR VMware </secondary>\r
1016                                 </indexterm>\r
1017                                 <caution>ADD CONTENT FOR VMware </caution>\r
1018                         </simplesect>\r
1019                         <simplesect xml:id="serversideinstallation-virtualized-virtualpc">\r
1020                                 <title>VirtualPC</title>\r
1021                                 <indexterm>\r
1022                                         <primary>ZZZ-REVIEW</primary>\r
1023                                         <secondary>ADD CONTENT FOR VirtualPC </secondary>\r
1024                                 </indexterm>\r
1025                                 <caution>ADD CONTENT FOR VirtualPC </caution>\r
1026                         </simplesect>\r
1027                 </section>\r
1028         </section>\r
1029 </chapter>\r