Merge remote-tracking branch 'upstream/master'
[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 running 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 2.0</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                                 2.0:</para>\r
60 <screen><userinput>\r
61 wget http://open-ils.org/downloads/opensrf-2.0.1.tar.gz\r
62 tar xzf opensrf-2.0.1.tar.gz\r
63 </userinput></screen>\r
64                                 <para>A new directory opensrf-2.0.1 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-2.0.1\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>fedora13</option> for <systemitem class="osname">Fedora 13</systemitem>\r
85                                                 <indexterm><primary>Linux</primary><secondary>Fedora</secondary></indexterm></para>\r
86                                         </listitem>                     \r
87                                         <listitem>\r
88                                                 <para><option>ubuntu-lucid</option> for <systemitem class="osname">Ubuntu Lucid Lynx\r
89                                                 (10.04)</systemitem><indexterm><primary>Linux</primary><secondary>Ubuntu</secondary></indexterm></para>\r
90                                         </listitem>\r
91                                         <listitem>\r
92                                                 <para><option>centos</option> for <systemitem class="osname">CentOS 5</systemitem>\r
93                                                 <indexterm><primary>Linux</primary><secondary>CentOS</secondary></indexterm></para>\r
94                                         </listitem>\r
95                                         <listitem>\r
96                                                 <para><option>rhel</option> for <systemitem class="osname">Red Hat Enterprise Linux 5</systemitem>\r
97                                                 <indexterm><primary>Linux</primary><secondary>Red Hat</secondary></indexterm></para>\r
98                                         </listitem>\r
99                                 </itemizedlist>\r
100 <screen><userinput>\r
101 make -f src/extras/Makefile.install [distribution]\r
102 </userinput></screen>\r
103                                 <para>This will install a number of packages required by OpenSRF on your system, \r
104                                 including some Perl modules from <systemitem class="resource">CPAN</systemitem><indexterm><primary>Perl</primary><secondary>CPAN</secondary>\r
105                                 </indexterm>. You can type <userinput>no</userinput> to the initial <systemitem class="resource">CPAN</systemitem> \r
106                                 configuration prompt to allow it to automatically configure itself to download \r
107                                 and install Perl modules from <systemitem class="resource">CPAN</systemitem>. The <systemitem class="resource">CPAN</systemitem> installer will ask you a number of \r
108                                 times whether it should install prerequisite modules - type <userinput>yes</userinput>.</para>\r
109                         </step>\r
110                         <step>  \r
111                                 <para>As the <systemitem class="username">opensrf</systemitem> user, configure and compile OpenSRF:</para> \r
112                                 <note>You can include the <option>–enable-python</option> and <option>–enable-java</option> configure options if \r
113                                 you want to include support for Python<indexterm><primary>Python</primary></indexterm> and Java\r
114                                 <indexterm><primary>Java</primary></indexterm>, respectively.</note>\r
115 <screen><userinput>\r
116 cd /home/opensrf/opensrf-2.0.1\r
117 ./configure --prefix=/openils --sysconfdir=/openils/conf\r
118 make\r
119 </userinput></screen>           \r
120                         </step>\r
121                         <step>  \r
122                                 <para>As the <systemitem class="username">root</systemitem> user, return to your OpenSRF build directory and install \r
123                                 OpenSRF:</para>\r
124 <screen><userinput>\r
125 cd /home/opensrf/opensrf-2.0.1\r
126 make install\r
127 </userinput></screen>\r
128                         </step>\r
129                         <step>\r
130                                 <para>As the <systemitem class="username">root</systemitem> user, change the ownership of the installed files to the \r
131                                 <systemitem class="username">opensrf</systemitem> user:</para>\r
132                                 <screen><userinput>chown -R opensrf:opensrf /openils</userinput></screen>\r
133                         </step>                 \r
134                         <step>\r
135                                 <para>Jot down the usernames/passwords of the two Jabber users created when OpenSRF was previously installed these users will correspond to \r
136                                 entries in opensrf_core.xml. </para>\r
137                         </step>\r
138                         <step>\r
139                                 <para>Important: Backup your current opensrf.xml and opensrf_core.xml configuration files.</para>\r
140 <screen>\r
141 <userinput>cp -p /openils/conf/opensrf.xml /openils/conf/opensrf.xml.backup</userinput>\r
142 <userinput>cp -p /openils/conf/opensrf_core.xml /openils/conf/opensrf_core.xml.backup</userinput>\r
143 </screen>\r
144                         </step>\r
145                         <step>\r
146                                 <para>As the <systemitem class="username">opensrf</systemitem> user, copy the <filename>/openils/conf/opensrf_core.xml</filename> and \r
147                                 <filename>/openils/conf/opensrf.xml</filename> configuration files from the example templates:</para>\r
148 <screen>\r
149 <userinput>cp /openils/conf/opensrf.xml.example /openils/conf/opensrf.xml</userinput>\r
150 <userinput>cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml</userinput>\r
151 </screen>\r
152                                 <para>Edit <filename>/openils/conf/opensrf_core.xml</filename> to change the Jabber usernames and passwords you jotted down earlier.</para> \r
153                         </step>\r
154                         <step>\r
155                                 <para>As the <systemitem class="username">root</systemitem> user, Run the following command:</para>\r
156 <screen>\r
157 <userinput>ldconfig</userinput>\r
158 </screen>\r
159                         </step>\r
160                         <step>\r
161                                 <para>Restart and Test OpenSRF</para>\r
162 <screen><userinput>\r
163 osrf_ctl.sh -l -a start_all\r
164 /openils/bin/srfsh\r
165 srfsh#  request opensrf.math add 2 2\r
166 </userinput></screen>\r
167                                 <para>You should see output such as:</para>\r
168 <screen>\r
169 Received Data: 4\r
170 \r
171 ------------------------------------\r
172 Request Completed Successfully\r
173 Request Time in seconds: 0.007519\r
174 ------------------------------------\r
175 \r
176 srfsh#\r
177 </screen>       \r
178                         </step> \r
179                         <step>                  \r
180                                 <para>If test completed successful restore your Evergreen configuration files:</para>\r
181 <screen><userinput>\r
182 cp /openils/conf/opensrf.xml.backup /openils/conf/opensrf.xml\r
183 cp /openils/conf/opensrf_core.xml.backup /openils/conf/opensrf_core.xml\r
184 </userinput></screen>\r
185                 \r
186                                 <para>and move on to the next section to upgrade Evergreen. Otherwise, refer to the <link linkend="troubleshooting">troubleshooting</link> chapter \r
187                                 of this documentation.</para> \r
188                         </step> \r
189                 </procedure>    \r
190         </section>\r
191         <section xml:id="upgradingevergreen-upgrading_from_1.6_to_2.0">\r
192                 <title>Upgrade <application>Evergreen</application> from 1.6.1 to 2.0</title>\r
193                 <note>\r
194                         <para>PostgreSQL 8.4 is the minimum supported version of PostgreSQL.</para> \r
195                         <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
196                         these distributions, you may want to upgrade befor installing Evergreen 2.0. For instructions on upgrading these distribuitions, visit the \r
197                         <ulink url="http://www.debian.org/releases/squeeze/">Debian</ulink> or <ulink url="https://help.ubuntu.com/community/LucidUpgrades">Ubuntu</ulink> websites.</para>\r
198                 </note>\r
199                 <procedure>\r
200                         <step>\r
201                                 <para>As the <systemitem class="username">opensrf</systemitem> user, download and extract <application>Evergreen 2.0</application>\r
202                                 </para>\r
203 <screen><userinput>\r
204 wget http://www.open-ils.org/downloads/Evergreen-ILS-2.0.10.tar.gz\r
205 tar xzf Evergreen-ILS-2.0.10.tar.gz\r
206 </userinput></screen>\r
207                                 <note><para>For the latest edition of Evergreen 2.0, check the Evergreen download page at\r
208                                 <ulink url="http://www.open-ils.org/downloads.php" /> and adjust upgrading instructions accordingly.</para></note>\r
209                         </step>\r
210                         <step>\r
211                                 <para>As the <systemitem class="username">root</systemitem> user, install the prerequisites:</para> \r
212                                 <screen><userinput>cd /home/opensrf/Evergreen-ILS-2.0.10</userinput></screen>   \r
213                                 <para>On the next command, replace <option>[distribution]</option> with one of \r
214                                 these values for your distribution of Debian or Ubuntu:</para>\r
215                                 <itemizedlist>\r
216                                         \r
217                                         <listitem>\r
218                                                 <para><option>debian-squeeze</option> for <systemitem class="osname">Debian Squeeze (6.0)</systemitem></para>\r
219                                         </listitem>\r
220                                         \r
221                                         <listitem>\r
222                                                 <para><option>ubuntu-lucid</option> for  <systemitem class="osname">Ubuntu Lucid Lynx \r
223                                                 (10.04)</systemitem></para>\r
224                                         </listitem>\r
225                                 </itemizedlist>\r
226                                 <screen><userinput>make -f Open-ILS/src/extras/Makefile.install <option>[distribution]</option></userinput></screen>\r
227                         </step>\r
228                         <step>\r
229                                 <para>As the <systemitem class="username">opensrf</systemitem> user, configure and compile \r
230                                 <application>Evergreen</application>:</para>\r
231                                 <screen><userinput>cd /home/opensrf/Evergreen-ILS-2.0.10</userinput></screen>\r
232                                 <screen><userinput>./configure --prefix=/openils --sysconfdir=/openils/conf</userinput></screen>\r
233                                 <screen><userinput>make</userinput></screen>\r
234                         </step>\r
235                         <step>\r
236                                 <para>As the <systemitem class="username">root</systemitem> user, install \r
237                                 <application>Evergreen</application>:</para>\r
238                                 <screen><userinput>make STAFF_CLIENT_BUILD_ID=rel_2_0_10 install</userinput></screen>\r
239                         </step>\r
240                         <step>\r
241                                 <para>As the <emphasis>root</emphasis> user, change all files to be owned by the \r
242                                 <emphasis>opensrf</emphasis> user and group:</para>\r
243                                 <screen><userinput>chown -R opensrf:opensrf /openils</userinput></screen>\r
244                         </step>                 \r
245                         <step>\r
246                                 <para>As the <systemitem class="username">opensrf</systemitem> user, update server symlink in <filename class="directory">/openils/var/web/xul/</filename>:</para>\r
247 <screen><userinput>\r
248 cd /openils/var/web/xul/\r
249 rm server\r
250 ln -s rel_2_0_10/server\r
251 </userinput></screen>\r
252                         </step>\r
253                         <step>\r
254                                 <para>Change to the <application>Evergreen</application> installation \r
255                                 directory:</para>\r
256                                 <screen><userinput>cd /home/opensrf/Evergreen-ILS-2.0.10</userinput></screen>\r
257                         </step>\r
258 \r
259                         <step>\r
260                                 <para>Update the <database>evergreen</database> database:</para>\r
261                                 <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
262                                 <note><para>The <filename>1.6.1-2.0-upgrade-db.sql</filename> upgrade script may take a long time (hours) to process \r
263                                  on larger systems.</para></note>\r
264 <screen>\r
265 <userinput>\r
266 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql evergreen\r
267 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.0-2.0.1-upgrade-db.sql evergreen\r
268 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.1-2.0.2-upgrade-db.sql evergreen\r
269 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.2-2.0.3-upgrade-db.sql evergreen\r
270 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.3-2.0.4-upgrade-db.sql evergreen\r
271 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.4-2.0.5-upgrade-db.sql evergreen\r
272 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.5-2.0.6-upgrade-db.sql evergreen\r
273 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.6-2.0.7-upgrade-db.sql evergreen\r
274 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.7-2.0.8-upgrade-db.sql evergreen\r
275 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.8-2.0.9-upgrade-db.sql evergreen\r
276 psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/2.0.9-2.0.10-upgrade-db.sql evergreen\r
277 \r
278 </userinput>\r
279 </screen>       \r
280                              \r
281                         </step>\r
282 <step>\r
283                                 <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
284                                 <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
285                                 the revised NACO normalization routine.</para>\r
286                                 <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
287                                 may take several hours.</para></note>\r
288 <screen><userinput>perl Open-ILS/src/sql/Pg/reingest-1.6-2.0.pl</userinput></screen>\r
289 <screen><userinput>psql -U evergreen -h localhost -f Open-ILS/src/sql/Pg/reingest-1.6-2.0.sql evergreen</userinput></screen>\r
290                         </step>\r
291                         <step>\r
292                                 <para>As the <systemitem class="username">opensrf</systemitem> user, \r
293                                 copy <filename>/openils/conf/oils_web.xml.example</filename> to <filename>/openils/conf/oils_web.xml</filename>\r
294                                 . (If upgrading from 1.6.1.x, <filename>oils_web.xml</filename> should already exist.)</para>\r
295                                 <indexterm><primary>configuration files</primary><secondary>oils_web.xml</secondary></indexterm>\r
296                                 <screen><userinput>cp /openils/conf/oils_web.xml.example /openils/conf/oils_web.xml</userinput></screen>\r
297                         </step>\r
298                         <step>\r
299                                 <para>Update <filename>opensrf_core.xml</filename> and <filename>opensrf.xml</filename> by copying the new example files \r
300                                 (<filename>/openils/conf/opensrf_core.xml.example</filename> and <filename>/openils/conf/opensrf.xml</filename>).</para>\r
301                                 <indexterm><primary>configuration files</primary><secondary>opensrf.xml</secondary></indexterm>\r
302                                 <screen><userinput>cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml</userinput></screen>\r
303                                 <indexterm><primary>configuration files</primary><secondary>opensrf_core.xml</secondary></indexterm>\r
304                                 <screen><userinput>cp /openils/conf/opensrf.xml.example /openils/conf/opensrf.xml</userinput></screen>\r
305                                 <caution><para>Copying these configuration files will remove any customizations you have made to them. Remember to redo your customizations after copying \r
306                                 them.</para></caution>\r
307                         </step>\r
308                         <step>\r
309                                 <para>Update <filename>opensrf.xml</filename> with the database connection info:</para>\r
310 <screen><userinput>\r
311 perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \\r
312 --service all --create-offline --user evergreen --password evergreen \ \r
313 --hostname localhost --port 5432 --database evergreen\r
314 </userinput></screen>\r
315                         </step>\r
316                         <step>\r
317                                 <para>Update /etc/apache2/startup.pl by copying the example from \r
318                                 Open-ILS/examples/apache/startup.pl.</para><indexterm><primary>configuration files</primary><secondary>startup.pl</secondary></indexterm>\r
319                         </step>\r
320                         <step>\r
321                                 <para>Update /etc/apache2/eg_vhost.conf by copying the example from \r
322                                 Open-ILS/examples/apache/eg_vhost.conf.</para><indexterm><primary>configuration files</primary><secondary>eg_vhost.conf</secondary></indexterm>\r
323                         </step>\r
324                         <step>\r
325                         <para>Update /etc/apache2/sites-available/eg.conf by copying the example from Open-ILS/\r
326                         examples/apache/eg.conf.</para><indexterm><primary>configuration files</primary><secondary>eg.conf</secondary></indexterm>\r
327                         </step>\r
328                         <caution>\r
329                                 <para>Copying these Apache configuration files will remove any customizations you have made to them. Remember to redo your customizations after copying \r
330                                 them. For example, if you purchased an SSL certificate, you \r
331                                 will need to edit <filename>eg.conf</filename> to point to the appropriate SSL certificate files.</para>\r
332                                 <indexterm><primary>SSL</primary><secondary>certificates</secondary></indexterm>\r
333                         </caution> \r
334                 </procedure>    \r
335         </section>\r
336         <section xml:id="testing_after_upgrade">\r
337                 <title>Restart Evergreen and Test</title>\r
338                 <procedure>\r
339                         <step>\r
340                                 <para>As the <systemitem class="username">opensrf</systemitem> user, start all \r
341                                 <application>Evergreen</application> and <application>OpenSRF</application> \r
342                                 services:</para>\r
343                                 <screen><userinput>osrf_ctl.sh -l -a start_all</userinput></screen>\r
344                         </step>\r
345                         <step>\r
346                                 <para>As the <systemitem class="username">opensrf</systemitem> user, run <command>autogen</command> to refresh the static \r
347                                 organizational data files:</para><indexterm><primary>autogen</primary></indexterm>\r
348 <screen><userinput>\r
349 cd /openils/bin\r
350 ./autogen.sh -c /openils/conf/opensrf_core.xml -u\r
351 </userinput></screen>\r
352                                         \r
353                         </step>\r
354                         <step>\r
355                                 <para>Start <command>srfsh</command> and try logging in  using your <application>Evergreen</application>\r
356                                 username and password:</para>\r
357 <screen>\r
358 <userinput>/openils/bin/srfsh</userinput>\r
359 <prompt>srfsh%</prompt> <userinput>login <option>username</option> <option>password</option></userinput>\r
360 </screen> \r
361                         </step> \r
362                         <step>\r
363                                 <para>Start the <application>Apache</application> web server.</para>\r
364                         </step>\r
365                 </procedure>\r
366                 <note>\r
367                         <para>If you encounter errors, refer to the <link linkend="troubleshooting">troubleshooting \r
368                         section</link> of this documentation for tips \r
369                         on finding solutions and seeking further assistance from the Evergreen community.</para>  \r
370                 </note>\r
371         </section>\r
372 <section xml:id="upgrading_Postgresqlto9.0">\r
373                 <title>Upgrading PostgreSQL from 8.4 to 9.0</title>\r
374                 <simplesect>\r
375                         <title>Upgrading PostgreSQL on Debian Squeez</title>\r
376                         <procedure>\r
377                                 <step>\r
378                                         <para>Stop Evergreen and disconnect clients from database.</para>\r
379                                 </step>                 \r
380                                 <step>\r
381                                         <para>Add the following line to <filename>/etc/apt/sources.list</filename>:</para> \r
382 <programlisting>\r
383 deb http://www.backports.org/debian squeeze-backports main contrib non-free\r
384 </programlisting>\r
385                                 </step>\r
386                                 <step>\r
387                                         <para>Update the sources list on your server.</para>\r
388 <screen><userinput>                             \r
389 apt-get update\r
390 </userinput></screen>\r
391                                 </step>\r
392                                 <step>\r
393                                         <para>Backup your databases</para>\r
394 <screen><userinput>                             \r
395 $ pg_dump [db connect args] [db name] > evergreen-backup.sql\r
396 </userinput></screen>\r
397                                 </step>\r
398                                 <step>\r
399                                         <para>Install PostgreSQL 9.0 as well as the client, contrib and plperl support packages.</para>\r
400 <screen><userinput>                             \r
401 apt-get -t squeeze-backports install postgresql-9.0 postgresql-client-9.0 postgresql-contrib-9.0 postgresql-plperl-9.0\r
402 </userinput></screen>\r
403                                 </step>\r
404                                 <step>\r
405                                         <para>Drop the empty 9.0 cluster.</para>\r
406 <screen><userinput>                             \r
407 pg_dropcluster --stop 9.0 main\r
408 </userinput></screen>\r
409                                 </step>\r
410                                 <step>\r
411                                         <para>Update the 8.4 cluster (with evergreen database) to 9.0</para>\r
412 <screen><userinput>                             \r
413 pg_upgradecluster 8.4 main\r
414 </userinput></screen>\r
415                                 </step>\r
416                                 <step>\r
417                                         <para>Test by logging into psql, checking the postgrSQL version and running a simple SELECT query.</para>\r
418 <screen><userinput>     \r
419 psql -U evergreen                       \r
420 evergreen=# select version();\r
421 evergreen=# select count(*) from biblio.record_entry;\r
422 </userinput></screen>\r
423                                 </step>\r
424                                 <step>\r
425                                         <para>Restart Evergreen and Apache.</para>\r
426                                 </step>\r
427                                 <step>\r
428                                         <para>Drop old 8.4 cluster (optional).</para>\r
429 <screen><userinput>     \r
430 pg_dropcluster 8.4 main\r
431 </userinput></screen>\r
432                                 </step>\r
433                         </procedure>\r
434                 </simplesect>\r
435                         <simplesect>\r
436                         <title>Upgrading PostgreSQL on Ubuntu 10.04</title>\r
437                         <procedure>\r
438                                 <step>\r
439                                         <para>Stop Evergreen and disconnect clients from database.</para>\r
440                                 </step>                 \r
441                                 <step>\r
442                                         <para>Add the backport repository to your repository sources list:</para> \r
443 <screen><userinput>\r
444 sudo add-apt-repository ppa:pitti/postgresql\r
445 </userinput></screen>\r
446                                 </step>\r
447                                 <step>\r
448                                         <para>Update the sources list on your server.</para>\r
449 <screen><userinput>                             \r
450 apt-get update\r
451 </userinput></screen>\r
452                                 </step>\r
453                                 <step>\r
454                                         <para>As the <systemitem class="username">postgres</systemitem> user, backup your PostgreSQL databases.</para>\r
455 <screen><userinput><![CDATA[                            \r
456 pg_dumpall > data\r
457 ]]></userinput></screen>\r
458                                 </step>\r
459                                 <step>\r
460                                         <para>As <systemitem class="username">root</systemitem>, remove PostgreSQL 8.4 and install 9.0.</para>\r
461 <screen><userinput>                             \r
462 aptitude purge postgresql-8.4\r
463 aptitude install postgresql-9.0 postgresql-client-9.0 postgresql-contrib-9.0 postgresql-plperl-9.0\r
464 </userinput></screen>\r
465                                 </step>\r
466                                 <step>\r
467                                         <para>as the <systemitem class="username">postgres</systemitem> user, recreate empty evergreen databases with required language supports.</para>\r
468 <screen><userinput>\r
469 dropdb evergreen\r
470 createdb -T template0 --lc-ctype=C --lc-collate=C -E UNICODE evergreen\r
471 createlang plperl   evergreen\r
472 createlang plperlu  evergreen\r
473 createlang plpgsql  evergreen\r
474 psql -f /usr/share/postgresql/9.0/contrib/tablefunc.sql evergreen\r
475 psql -f /usr/share/postgresql/9.0/contrib/tsearch2.sql  evergreen\r
476 psql -f /usr/share/postgresql/9.0/contrib/pgxml.sql     evergreen\r
477 </userinput></screen>\r
478                                 </step>\r
479                                 <step>\r
480                                         <para>Update the 8.4 cluster (with evergreen database) to 9.0.</para>\r
481 <screen><userinput>                             \r
482 pg_upgradecluster 8.4 main\r
483 </userinput></screen>\r
484                                 </step>\r
485                                 <step>\r
486                                         <para>as the <systemitem class="username">postgres</systemitem> user, load data from backup into PostgreSQL 2.0.10.0.</para>\r
487 <screen><userinput><![CDATA[                            \r
488 psql < data\r
489 ]]></userinput></screen>\r
490                                 </step>\r
491                                 <step>\r
492                                         <para>Restart Evergreen and Apache.</para>\r
493                                 </step>\r
494                                 <step>\r
495                                         <para>Test by logging into psql, checking the postgrSQL version and running a simple SELECT query.</para>\r
496 <screen><userinput>     \r
497 psql -U evergreen                       \r
498 evergreen=# select version();\r
499 evergreen=# select count(*) from biblio.record_entry;\r
500 </userinput></screen>\r
501                                 </step>\r
502                         </procedure>\r
503                 </simplesect>\r
504         </section>\r
505 </chapter>\r