Fix Upgrading from review by Ben Shum.
[working/Evergreen.git] / 2.0 / admin / Upgrading-Evergreen-2.0.xml
1 <?xml version='1.0' encoding='UTF-8'?>\r
2 <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"\r
3         xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:id="upgradingevergreen-2.0">\r
4         <info>\r
5                 <title>Upgrading Evergreen to 2.0</title>\r
6                 <abstract>\r
7                         <para>This Chapter will explain the step-by-step process of upgrading <application>Evergreen\r
8                         </application> to 2.0, including steps to upgrade <application>OpenSRF</application>. Before \r
9                         upgrading, it is important to carefully plan an upgrade strategy to minimize system downtime and \r
10                         service interruptions. All of the steps in this chapter are to be completed from the command line.</para>\r
11                         \r
12                 </abstract>\r
13         </info>    \r
14                 <para>Evergreen 2.0 has several software requirements:</para>\r
15                 <itemizedlist>\r
16                         <listitem>PostgreSQL: Version 8.4 is the minimum supported version of PostgreSQL. </listitem>\r
17                         <listitem>Linux: Evergreen 2.0 has been tested on Debian Squeeze (6.0) and Ubuntu Lucid Lynx (10.04). If you are runnung an older version of these distributions, \r
18                         you may want to upgrade befor installing Evergreen 2.0. For instructions on upgrading these distributions, visit the \r
19                         <ulink url="http://www.debian.org/releases/squeeze/">Debian</ulink> or <ulink url="https://help.ubuntu.com/community/LucidUpgrades">Ubuntu</ulink> websites.</listitem>\r
20                 </itemizedlist>\r
21                 <para>In the following instructions, you are asked to perform certain steps as either the <systemitem class="username">root</systemitem>  or \r
22                 <systemitem class="username">opensrf</systemitem> user.</para>\r
23                 <itemizedlist>\r
24                         <listitem>Debian: To become the <systemitem class="username">root</systemitem> user, issue the <command>su</command> command and enter the password of the \r
25                         <systemitem class="username">root</systemitem> user.</listitem>\r
26                         <listitem>Ubuntu: To become the <systemitem class="username">root</systemitem> user, issue the <command>sudo su</command> command and enter the password of your current user.</listitem>\r
27                 </itemizedlist>\r
28                 <para>To switch from the <systemitem class="username">root</systemitem> user to a different user, issue the <command>su - [user]</command> command; for example, \r
29                 <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 exit command.</para> \r
30                 <para>In the following instructions, <filename class='directory'>/path/to/OpenSRF/</filename> represents the path to the OpenSRF source directory.</para>\r
31         <section xml:id="upgradingevergreen-stop_evergreen">\r
32                 <title>Backing Up Data</title>\r
33                 <procedure>\r
34                         <step>\r
35                                 <para>As <systemitem class="username">root</systemitem>, stop the <application>Apache</application> \r
36                                 web server<indexterm><primary>web server</primary><secondary>Apache</secondary></indexterm>.</para>\r
37                         </step>\r
38                         <step>\r
39                                 <para>As the <systemitem class="username">opensrf</systemitem> user, stop all \r
40                                 <application>Evergreen</application>\r
41                                 and <application>OpenSRF</application> services:</para>\r
42                                 <screen><userinput>osrf_ctl.sh -l -a stop_all</userinput></screen>\r
43                         </step>\r
44                         <step>\r
45                                 <para>Back up of the <filename class='directory'>/openils</filename> \r
46                                 directory.</para>\r
47                         </step>\r
48                         <step>\r
49                                 <para><link linkend="backingup">Back up the <application>evergreen\r
50                                 </application> database</link>.</para>\r
51                         </step>\r
52                 </procedure>\r
53         </section>\r
54         <section xml:id="upgradingevergreen-upgradingOpenSRF">\r
55                 <title>Upgrading OpenSRF to 1.6.2</title><indexterm><primary>OpenSRF</primary></indexterm>\r
56                 <procedure>\r
57                         <step>\r
58                                 <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract the source files for <application>OpenSRF</application> \r
59                                 1.6.2:</para>\r
60 <screen><userinput>\r
61 wget http://open-ils.org/downloads/OpenSRF-1.6.2.tar.gz\r
62 tar xzf OpenSRF-1.6.2.tar.gz\r
63 </userinput></screen>\r
64                                 <para>A new directory OpenSRF-1.6.2 is created.</para>\r
65                                 <note><para>For the latest edition of OpenSRF, check the Evergreen download page at \r
66                                 <ulink url="http://www.open-ils.org/downloads.php" />.\r
67                                 </para></note>\r
68                         </step>\r
69                         <step>  \r
70                                 <para>As the <systemitem class="username">root</systemitem> user, install the software prerequisites using the automatic \r
71                                 prerequisite installer.</para> \r
72 <screen><userinput>\r
73 aptitude install make\r
74 cd /home/opensrf/OpenSRF-1.6.2\r
75 </userinput></screen>           \r
76                                 <para>Replace <option>[distribution]</option> below with the following value \r
77                                 for your distribution:</para>\r
78                                 <itemizedlist>\r
79                                         <listitem>\r
80                                                 <para><option>debian-squeeze</option> for <systemitem class="osname">Debian Squeeze (6.0)</systemitem>\r
81                                                 <indexterm><primary>Linux</primary><secondary>Debian</secondary></indexterm></para>\r
82                                         </listitem>\r
83                                         <listitem>\r
84                                                 <para><option>ubuntu-lucid</option> for <systemitem class="osname">Ubuntu Lucid Lynx\r
85                                                 (10.04)</systemitem><indexterm><primary>Linux</primary><secondary>Ubuntu</secondary></indexterm></para>\r
86                                         </listitem>\r
87                                         <listitem>\r
88                                                 <para><option>centos</option> for <systemitem class="osname">CentOS 5</systemitem>\r
89                                                 <indexterm><primary>Linux</primary><secondary>CentOS</secondary></indexterm></para>\r
90                                         </listitem>\r
91                                         <listitem>\r
92                                                 <para><option>rhel</option> for <systemitem class="osname">Red Hat Enterprise Linux 5</systemitem>\r
93                                                 <indexterm><primary>Linux</primary><secondary>Red Hat</secondary></indexterm></para>\r
94                                         </listitem>\r
95                                 </itemizedlist>\r
96 <screen><userinput>\r
97 cd /path/to/OpenSRF\r
98 make -f src/extras/Makefile.install [distribution]\r
99 </userinput></screen>\r
100                                 <para>This will install a number of packages required by OpenSRF on your system, \r
101                                 including some Perl modules from <systemitem class="resource">CPAN</systemitem><indexterm><primary>Perl</primary><secondary>CPAN</secondary>\r
102                                 </indexterm>. You can type <userinput>no</userinput> to the initial <systemitem class="resource">CPAN</systemitem> \r
103                                 configuration prompt to allow it to automatically configure itself to download \r
104                                 and install Perl modules from <systemitem class="resource">CPAN</systemitem>. The <systemitem class="resource">CPAN</systemitem> installer will ask you a number of \r
105                                 times whether it should install prerequisite modules - type <userinput>yes</userinput>.</para>\r
106                         </step>\r
107                         <step>  \r
108                                 <para>As the <systemitem class="username">opensrf</systemitem> user, configure and compile OpenSRF:</para> \r
109                                 <note>You can include the <option>–enable-python</option> and <option>–enable-java</option> configure options if \r
110                                 you want to include support for Python<indexterm><primary>Python</primary></indexterm> and Java\r
111                                 <indexterm><primary>Java</primary></indexterm>, respectively.</note>\r
112 <screen><userinput>\r
113 cd /home/opensrf/OpenSRF-1.6.2\r
114 ./configure --prefix=/openils --sysconfdir=/openils/conf\r
115 make\r
116 </userinput></screen>           \r
117                         </step>\r
118                         <step>  \r
119                                 <para>As the <systemitem class="username">root</systemitem> user, return to your OpenSRF build directory and install \r
120                                 OpenSRF:</para>\r
121 <screen><userinput>\r
122 cd /home/opensrf/OpenSRF-1.6.2\r
123 make install\r
124 </userinput></screen>\r
125                         </step>\r
126                         <step>\r
127                                 <para>As the <systemitem class="username">root</systemitem> user, change the ownership of the installed files to the \r
128                                 <systemitem class="username">opensrf</systemitem> user:</para>\r
129                                 <screen><userinput>chown -R opensrf:opensrf /openils</userinput></screen>\r
130                         </step>\r
131                         <step>\r
132                                 <para>Restart and Test OpenSRF</para>\r
133 <screen><userinput>\r
134 osrf_ctl.sh -l -a start_all\r
135 /openils/bin/srfsh\r
136 srfsh#  request opensrf.math add 2 2\r
137 </userinput></screen>\r
138                                 <para>You should see output such as:</para>\r
139 <screen>\r
140 Received Data: 4\r
141 \r
142 ------------------------------------\r
143 Request Completed Successfully\r
144 Request Time in seconds: 0.007519\r
145 ------------------------------------\r
146 \r
147 srfsh#\r
148 </screen>       \r
149                                 <para>If test completed successfully move onto the next section. \r
150                                 Otherwise, refer to the <link linkend="troubleshooting">troubleshooting</link> chapter \r
151                                 of this documentation.</para> \r
152                         </step> \r
153                 </procedure>    \r
154         </section>\r
155         <section xml:id="upgradingevergreen-upgrading_from_1.6_to_2.0">\r
156                 <title>Upgrade <application>Evergreen</application> from 1.6.1 to 2.0</title>\r
157                 <note>\r
158                         <para>PostgreSQL 8.4 is the minimum supported version of PostgreSQL.</para> \r
159                         <para>Evergreen 2.0 has been tested on Debian Squeeze (6.0) and Ubuntu Lucid (10.04). If you are runnung an older version of \r
160                         these distributions, you may want to upgrade befor installing Evergreen 2.0. For instructions on upgrading these distribuitions, visit the \r
161                         <ulink url="http://www.debian.org/releases/squeeze/">Debian</ulink> or <ulink url="https://help.ubuntu.com/community/LucidUpgrades">Ubuntu</ulink> websites.</para>\r
162                 </note>\r
163                 <procedure>\r
164                         <step>\r
165                                 <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract <application>Evergreen 2.0</application>\r
166                                 </para>\r
167 <screen><userinput>\r
168 wget http://www.open-ils.org/downloads/Evergreen-ILS-2.0.1.tar.gz\r
169 tar xzf Evergreen-ILS-2.0.1.tar.gz\r
170 </userinput></screen>\r
171                                 <note><para>For the latest edition of Evergreen 2.0, check the Evergreen download page at\r
172                                 <ulink url="http://www.open-ils.org/downloads.php" /> and adjust upgrading instructions accordingly.</para></note>\r
173                         </step>\r
174                         <step>\r
175                                 <para>As the <systemitem class="username">root</systemitem> user, install the prerequisites:</para> \r
176                                 <screen><userinput>cd /home/opensrf/Evergreen-ILS-2.0.1</userinput></screen>    \r
177                                 <para>On the next command, replace <option>[distribution]</option> with one of \r
178                                 these values for your distribution of Debian or Ubuntu:</para>\r
179                                 <itemizedlist>\r
180                                         \r
181                                         <listitem>\r
182                                                 <para><option>debian-squeeze</option> for <systemitem class="osname">Debian Squeeze (6.0)</systemitem></para>\r
183                                         </listitem>\r
184                                         \r
185                                         <listitem>\r
186                                                 <para><option>ubuntu-lucid</option> for  <systemitem class="osname">Ubuntu Lucid Lynx \r
187                                                 (10.04)</systemitem></para>\r
188                                         </listitem>\r
189                                 </itemizedlist>\r
190                                 <screen><userinput>make -f Open-ILS/src/extras/Makefile.install <option>[distribution]</option></userinput></screen>\r
191                         </step>\r
192                         <step>\r
193                                 <para>As the <systemitem class="username">opensrf</systemitem> user, configure and compile \r
194                                 <application>Evergreen</application>:</para>\r
195                                 <screen><userinput>cd /home/opensrf/Evergreen-ILS-2.0.1</userinput></screen>\r
196                                 <screen><userinput>./configure --prefix=/openils --sysconfdir=/openils/conf</userinput></screen>\r
197                                 <screen><userinput>make</userinput></screen>\r
198                         </step>\r
199                         <step>\r
200                                 <para>As the <systemitem class="username">root</systemitem> user, install \r
201                                 <application>Evergreen</application>:</para>\r
202                                 <screen><userinput>make STAFF_CLIENT_BUILD_ID=rel_2_0_1 install</userinput></screen>\r
203                         </step>\r
204                         <step>\r
205                                 <para>Change to the <application>Evergreen</application> installation \r
206                                 directory:</para>\r
207                                 <screen><userinput>cd /home/opensrf/Evergreen-ILS-2.0.1</userinput></screen>\r
208                         </step>\r
209                         <step>\r
210                                 <para>As the <emphasis>root</emphasis> user, change all files to be owned by the \r
211                                 <emphasis>opensrf</emphasis> user and group:</para>\r
212                                 <screen><userinput>chown -R opensrf:opensrf /openils</userinput></screen>\r
213                         </step>                 \r
214                         <step>\r
215                                 <para>As the <systemitem class="username">opensrf</systemitem> user, update server symlink in <filename class="directory">/openils/var/web/xul/</filename>:</para>\r
216 <screen><userinput>\r
217 cd /openils/var/web/xul/\r
218 rm server\r
219 ln -s rel_2_0_1/server\r
220 </userinput></screen>\r
221                         </step>\r
222                         <step>\r
223                                 <para>Update the <database>evergreen</database> database:</para>\r
224                                 <note><para>It is recommended that you <link linkend="backingup">back up your Evergreen database</link> in order to restore your data if anything goes wrong.</para></note>\r
225 <screen>\r
226 <userinput>\r
227 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql evergreen\r
228 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.0-2.0.1-upgrade-db.sql evergreen\r
229 </userinput>\r
230 </screen>       \r
231                         </step>\r
232 <step>\r
233                                 <para>Run the <filename>reingest-1.6-2.0.pl</filename> script to generate an sql script. Then use the sql file to reingest bib records into your \r
234                                 <database>evergreen</database> database. This is required to make the new facet sidebar in OPAC search results work and to upgrade the keyword indexes to use \r
235                                 the revised NACO normalization routine.</para>\r
236                                 <note><para>If you are running a large Evergreen installation, it is recommend that you examine the script first. Reingesting a large number of bibliographic records \r
237                                 may take several hours.</para></note>\r
238 <screen><userinput>perl Open-ILS/src/sql/Pg/reingest-1.6-2.0.pl</userinput></screen>\r
239 <screen><userinput>psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/reingest-1.6-2.0.sql evergreen</userinput></screen>\r
240                         </step>\r
241                         <step>\r
242                                 <para>As the <systemitem class="username">opensrf</systemitem> user, \r
243                                 copy <filename>/openils/conf/oils_web.xml.example</filename> to <filename>/openils/conf/oils_web.xml</filename>\r
244                                 . (If upgrading from 1.6.1.x, <filename>oils_web.xml</filename> should already exist.)</para>\r
245                                 <indexterm><primary>configuration files</primary><secondary>oils_web.xml</secondary></indexterm>\r
246                                 <screen><userinput>cp /openils/conf/oils_web.xml.example /openils/conf/oils_web.xml</userinput></screen>\r
247                         </step>\r
248                         <step>\r
249                                 <para>Update <filename>opensrf_core.xml</filename> and <filename>opensrf.xml</filename> by copying the new example files \r
250                                 (<filename>/openils/conf/opensrf_core.xml.example</filename> and <filename>/openils/conf/opensrf.xml</filename>).</para>\r
251                                 <indexterm><primary>configuration files</primary><secondary>opensrf.xml</secondary></indexterm>\r
252                                 <screen><userinput>cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml</userinput></screen>\r
253                                 <indexterm><primary>configuration files</primary><secondary>opensrf_core.xml</secondary></indexterm>\r
254                                 <screen><userinput>cp /openils/conf/opensrf.xml.example /openils/conf/opensrf.xml</userinput></screen>\r
255                                 <caution><para>Copying these configuration files will remove any customizations you have made to them. Remember to redo your customizations after copying \r
256                                 them.</para></caution>\r
257                         </step>\r
258                         <step>\r
259                                 <para>Update <filename>opensrf.xml</filename> with the database connection info:</para>\r
260 <screen><userinput>\r
261 perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config --service all --create-offline --user evergreen \\r
262 --password evergreen --hostname localhost --port 5432 --database evergreen\r
263 </userinput></screen>\r
264                         </step>\r
265                         <step>\r
266                                 <para>Update /etc/apache2/startup.pl by copying the example from \r
267                                 Open-ILS/examples/apache/startup.pl.</para><indexterm><primary>configuration files</primary><secondary>startup.pl</secondary></indexterm>\r
268                         </step>\r
269                         <step>\r
270                                 <para>Update /etc/apache2/eg_vhost.conf by copying the example from \r
271                                 Open-ILS/examples/apache/eg_vhost.conf.</para><indexterm><primary>configuration files</primary><secondary>eg_vhost.conf</secondary></indexterm>\r
272                         </step>\r
273                         <step>\r
274                         <para>Update /etc/apache2/sites-available/eg.conf by copying the example from Open-ILS/\r
275                         examples/apache/eg.conf.</para><indexterm><primary>configuration files</primary><secondary>eg.conf</secondary></indexterm>\r
276                         </step>\r
277                         <caution>\r
278                                 <para>Copying these Apache configuration files will remove any customizations you have made to them. Remember to redo your customizations after copying \r
279                                 them. For example, if you purchased an SSL certificate, you \r
280                                 will need to edit <filename>eg.conf</filename> to point to the appropriate SSL certificate files.</para>\r
281                                 <indexterm><primary>SSL</primary><secondary>certificates</secondary></indexterm>\r
282                         </caution> \r
283                 </procedure>    \r
284         </section>\r
285         <section xml:id="testing_after_upgrade">\r
286                 <title>Restart Evergreen and Test</title>\r
287                 <procedure>\r
288                         <step>\r
289                                 <para>As the <systemitem class="username">opensrf</systemitem> user, start all \r
290                                 <application>Evergreen</application> and <application>OpenSRF</application> \r
291                                 services:</para>\r
292                                 <screen><userinput>osrf_ctl.sh -l -a start_all</userinput></screen>\r
293                         </step>\r
294                         <step>\r
295                                 <para>As the <systemitem class="username">opensrf</systemitem> user, run <command>autogen</command> to refresh the static \r
296                                 organizational data files:</para><indexterm><primary>autogen</primary></indexterm>\r
297 <screen><userinput>\r
298 cd /openils/bin\r
299 ./autogen.sh -c /openils/conf/opensrf_core.xml -u\r
300 </userinput></screen>\r
301                                         \r
302                         </step>\r
303                         <step>\r
304                                 <para>Start <command>srfsh</command> and try logging in  using your <application>Evergreen</application>\r
305                                 username and password:</para>\r
306 <screen>\r
307 <userinput>/openils/bin/srfsh</userinput>\r
308 <prompt>srfsh%</prompt> <userinput>login <option>username</option> <option>password</option></userinput>\r
309 </screen> \r
310                         </step> \r
311                         <step>\r
312                                 <para>Start the <application>Apache</application> web server.</para>\r
313                         </step>\r
314                 </procedure>\r
315                 <note>\r
316                         <para>If you encounter errors, refer to the <link linkend="troubleshooting">troubleshooting \r
317                         section</link> of this documentation for tips \r
318                         on finding solutions and seeking further assistance from the Evergreen community.</para>  \r
319                 </note>\r
320         </section>\r
321         <section xml:id="upgrading_Postgresqlto8.4">\r
322                 <title>Upgrading PostgreSQL from 8.2 to 8.4 (if required)</title>\r
323                 <para>Evergreen 1.6.1 supports PostgreSQL version 8.4 and it is recommended that you upgrade PostgreSQL when you upgrade Evergreen to 1.6.</para>\r
324                 <note><para>The order of the following steps is very important.</para></note><indexterm><primary>databases</primary><secondary>PostgreSQL</secondary></indexterm>\r
325                 <procedure>\r
326                         <step>\r
327                                 <para>As <systemitem class="username">opensrf</systemitem>, stop the evergreen and opensrf services:</para>\r
328                                 <screen><userinput>osrf_ctl.sh -l -a stop_all</userinput></screen>\r
329                         </step>                 \r
330                         <step>\r
331                                 <para><link linkend="backingup">Backup the Evergreen database data</link></para>\r
332                         </step>\r
333                         <step>\r
334                                 <para>Upgrade to Postgresql 8.4 by removing old version and installing Postgresql 8.4</para>\r
335                         </step>\r
336                         <step>                  \r
337                                 <para>Create an empty Evergreen database in postgresql 8.4 by issuing the following commands as the postgres user:</para>\r
338 <screen>\r
339 <userinput>\r
340 createdb -E UNICODE evergreen\r
341 createlang plperl   evergreen\r
342 createlang plperlu  evergreen\r
343 createlang plpgsql  evergreen\r
344 psql -f /usr/share/postgresql/8.4/contrib/tablefunc.sql evergreen\r
345 psql -f /usr/share/postgresql/8.4/contrib/tsearch2.sql evergreen\r
346 psql -f /usr/share/postgresql/8.4/contrib/pgxml.sql evergreen\r
347 </userinput>\r
348 </screen>               \r
349                         </step>\r
350                         <step>\r
351                                 <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL server, create a PostgreSQL user named <systemitem class="username">evergreen</systemitem> for the database cluster:</para>\r
352                                 <screen><userinput>createuser -P -s evergreen</userinput></screen>\r
353                                 <para>Enter the password for the new PostgreSQL superuser (<systemitem class="username">evergreen</systemitem>)</para>  \r
354                         </step>                 \r
355                         <step>\r
356                                 <para>Restore data from backup created in step 1.</para>\r
357                         </step>\r
358                         <step>\r
359                                 <para>To point tsearch2 to proper function names in 8.4, run the SQL script \r
360                                 <filename>/home/opensrf/Evergreen-ILS*/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql</filename> using the <command>psql</command> command.</para>\r
361                                 <screen><userinput>cd /home/opensrf/Evergreen-ILS*</userinput></screen>\r
362                                 <screen><userinput>psql -f /Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql evergreen</userinput></screen>\r
363                         </step>\r
364                         <step>\r
365                                 <para><link linkend="upgraderestart">Restart Evergreen and OpenSRF services</link></para>\r
366                         </step>\r
367                         <step>\r
368                                 <para>For additional information regarding upgrading PostgreSQL, see the following documentation in PostgreSQL:</para>\r
369                                 <para><ulink url="http://www.postgresql.org/docs/8.4/static/install-upgrading.html" /></para>\r
370                                 <para><ulink url="http://www.postgresql.org/docs/8.4/interactive/textsearch-migration.html" /> \r
371                                 </para>\r
372                                 <para><ulink url="http://www.postgresql.org/docs/current/static/tsearch2.html#AEN102824" /></para>\r
373                         </step>\r
374                 </procedure>\r
375         </section>\r
376 </chapter>\r