1
- <!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.275 2007/01/25 23:34:28 momjian Exp $ -->
1
+ <!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.276 2007/01/26 22:52:50 momjian Exp $ -->
2
2
3
3
<chapter id="installation">
4
4
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -367,36 +367,39 @@ su - postgres
367
367
]]>
368
368
369
369
<sect1 id="install-upgrading">
370
- <title>If You Are Upgrading</title>
370
+ <title>Upgrading</title>
371
371
372
372
<indexterm zone="install-upgrading">
373
373
<primary>upgrading</primary>
374
374
</indexterm>
375
375
376
376
<para>
377
- The internal data storage format changes with new releases of
378
- <productname>PostgreSQL</>. Therefore, if you are upgrading an
379
- existing installation that does not have a version number
377
+ These instructions assume that your existing installation is under the
378
+ <filename>/usr/local/pgsql</> directory, and that the data area is in
379
+ <filename>/usr/local/pgsql/data</>. Substitute your paths
380
+ appropriately.
381
+ </para>
382
+
383
+ <para>
384
+ The internal data storage format typically changes in every major
385
+ release of <productname>PostgreSQL</>. Therefore, if you are upgrading
386
+ an existing installation that does not have a version number of
380
387
<quote>&majorversion;.x</quote>, you must back up and restore your
381
- data as shown here. These instructions assume that your existing
382
- installation is under the <filename>/usr/local/pgsql</> directory,
383
- and that the data area is in <filename>/usr/local/pgsql/data</>.
384
- Substitute your paths appropriately.
388
+ data. If you are upgrading from the same major version, the new version
389
+ can use your current data files, so a backup and restore is optional.
390
+ If you wish to avoid the backup/restore, merely skip those steps below.
385
391
</para>
386
392
387
393
<procedure>
388
394
<step>
389
395
<para>
390
- Make sure that your database is not updated during or after the
391
- backup. This does not affect the integrity of the backup, but the
392
- changed data would of course not be included. If necessary, edit
393
- the permissions in the file
394
- <filename>/usr/local/pgsql/data/pg_hba.conf</> (or equivalent) to
395
- disallow access from everyone except you.
396
+ If making a backup, make sure that your database is being updated.
397
+ This does not affect the integrity of the backup, but the changed
398
+ data would of course not be included. If necessary, edit the
399
+ permissions in the file <filename>/usr/local/pgsql/data/pg_hba.conf</>
400
+ (or equivalent) to disallow access from everyone except you.
396
401
</para>
397
- </step>
398
402
399
- <step>
400
403
<para>
401
404
<indexterm>
402
405
<primary>pg_dumpall</primary>
@@ -429,9 +432,7 @@ su - postgres
429
432
430
433
<step>
431
434
<para>
432
- If you are installing the new version at the same location as the
433
- old one then shut down the old server, at the latest before you
434
- install the new files:
435
+ Shut down the old server:
435
436
<screen>
436
437
<userinput>pg_ctl stop</>
437
438
</screen>
@@ -448,38 +449,63 @@ su - postgres
448
449
449
450
<step>
450
451
<para>
451
- If you are installing in the same place as the old version then
452
- it is also a good idea to move the old installation out of the
453
- way, in case you have trouble and need to revert to it.
454
- Use a command like this:
455
- <screen>
452
+ If restoring from backup, rename or delete the old installation
453
+ directory. It is a good idea to rename the directory, rather than
454
+ delete it, in case you have trouble and need to revert to it. Keep
455
+ in mind the directory might consume significant disk space. To rename
456
+ the directory, use a command like this:
457
+ <screen>
456
458
<userinput>mv /usr/local/pgsql /usr/local/pgsql.old</>
457
459
</screen>
458
460
</para>
459
461
</step>
460
- </procedure>
461
462
462
- <para>
463
- After you have installed <productname>PostgreSQL</> &version;, create a new database
464
- directory and start the new server. Remember that you must execute
465
- these commands while logged in to the special database user account
466
- (which you already have if you are upgrading).
463
+ <step>
464
+ <para>
465
+ Install the new version of <productname>PostgreSQL</productname> as
466
+ outlined in <![%standalone-include[the next section.]]>
467
+ <![%standalone-ignore[<xref linkend="install-procedure">.]]>
468
+ </para>
469
+ </step>
470
+
471
+ <step>
472
+ <para>
473
+ Create a new database cluster if needed. Remember that you must
474
+ execute these commands while logged in to the special database user
475
+ account (which you already have if you are upgrading).
467
476
<programlisting>
468
477
<userinput>/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data</>
478
+ </programlisting>
479
+ </para>
480
+ </step>
481
+
482
+ <step>
483
+ <para>
484
+ Start the database server, again from the special database user
485
+ account:
486
+ <programlisting>
469
487
<userinput>/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data</>
470
488
</programlisting>
471
- Finally, restore your data with
489
+ </para>
490
+ </step>
491
+
492
+ <step>
493
+ <para>
494
+ Finally, restore your data from backup with
472
495
<screen>
473
496
<userinput>/usr/local/pgsql/bin/psql -d postgres -f <replaceable>outputfile</></userinput>
474
497
</screen>
475
- using the <emphasis>new</> <application>psql</>.
476
- </para>
498
+ using the <emphasis>new</> <application>psql</>.
499
+ </para>
500
+ </step>
501
+ </procedure>
477
502
478
503
<para>
479
504
Further discussion appears in
480
505
<![%standalone-include[the documentation,]]>
481
506
<![%standalone-ignore[<xref linkend="migration">,]]>
482
- which you are encouraged to read in any case.
507
+ including instructions on how the previous installation can continue
508
+ running while the new installation is installed.
483
509
</para>
484
510
</sect1>
485
511
0 commit comments