Differences between revisions 13 and 14
Revision 13 as of 2009-03-16 03:32:41
Size: 651
Editor: anonymous
Comment: converted to 1.6 markup
Revision 14 as of 2009-06-24 19:17:45
Size: 3090
Editor: ?AnttiM
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Getting Started ==
Debian specific install instructions can be found at http://www.debianhelp.co.uk/postgresql.htm
PostgreSQL has extensive and good help that should be the first source of information regarding this database product. This page outlines main differences to generic PostgreSQL installation used by Debian.
----
== Installation ==
Required packages: postgresql postgresql-client <<BR>>
`# aptitude install postgresql postgresql-client`

Recommended packages:
 * postgresql-doc - PostgreSQL documentation.
 * pgadmin3 - PostgreSQL administration GUI.

Please note that the procedural languages are installed separately (plpgsql comes by default). Perform search packaging database to find the list of possibilities:<<BR>>
`# aptitude search postgresql`

== Configuration / files ==
Debian splits the database configuration from the database files, opposed to generic PostgreSQL installation that puts everything under same directory. Note that Debian allows multiple clusters and even different versions of PostgreSQL to co-exist in same host.

Configuration files: /etc/postgresql/[version]/[cluster]/<<BR>>
Binaries: /usr/lib/postgresql/[version]<<BR>>
Data files: /var/lib/postgresql/[version]/[cluster]<<BR>>

Rest of the configuration is the same as in PostgreSQL manuals.

== pg_ctl replacement ==
pg_ctl is a PostgreSQL command line control program that can be used to control the database. Debian has made a Perl-wrapper for the pg_ctl called `/usr/bin/pg_ctlcluster`. Use the pg_ctlcluster whenever you need the pg_ctl. To customize the behavior check the `/etc/postgresql/[version]/[cluster]/pg_ctl.conf'

Debian installs SysV-init compatible (standard) start-up script `/etc/init.d/postgresql-[version]`. It can be used to start and stop the system as well. It calls pg_ctlcluster internally.

== Changing Debian default installation ==
Debian PostgreSQL installation automatically calls the initdb i.e. it initializes the cluster with default encoding and locale. Encoding can be changed later but the locale cannot. To change the locale the initdb must be run again. To change the locale (an possibly other options in initdb) do the following:
 1. Take root privileges.
 1. Move to data directory (`/var/lib/postgresql/[version]/[cluster]`)
 1. Delete everything within the data-directory: `# rm -fR *`
 1. Take postgres identity: `# su postgres`
 1. Run the initdb with your options: `# /usr/lib/postgresql/[version]/initdb -D /var/lib/postgresql/[version]/[cluster] [your other options]'
 1. Exit back to root.
 1. Start the server.
Line 11: Line 45:
 * [[http://www.debianhelp.co.uk/postgresql.htm|PostgreSQL in Debian Help]]

PostgreSQL has extensive and good help that should be the first source of information regarding this database product. This page outlines main differences to generic PostgreSQL installation used by Debian.


Installation

Required packages: postgresql postgresql-client
# aptitude install postgresql postgresql-client

Recommended packages:

  • postgresql-doc - PostgreSQL documentation.
  • pgadmin3 - PostgreSQL administration GUI.

Please note that the procedural languages are installed separately (plpgsql comes by default). Perform search packaging database to find the list of possibilities:
# aptitude search postgresql

Configuration / files

Debian splits the database configuration from the database files, opposed to generic PostgreSQL installation that puts everything under same directory. Note that Debian allows multiple clusters and even different versions of PostgreSQL to co-exist in same host.

Configuration files: /etc/postgresql/[version]/[cluster]/
Binaries: /usr/lib/postgresql/[version]
Data files: /var/lib/postgresql/[version]/[cluster]

Rest of the configuration is the same as in PostgreSQL manuals.

pg_ctl replacement

pg_ctl is a PostgreSQL command line control program that can be used to control the database. Debian has made a Perl-wrapper for the pg_ctl called /usr/bin/pg_ctlcluster. Use the pg_ctlcluster whenever you need the pg_ctl. To customize the behavior check the `/etc/postgresql/[version]/[cluster]/pg_ctl.conf'

Debian installs SysV-init compatible (standard) start-up script /etc/init.d/postgresql-[version]. It can be used to start and stop the system as well. It calls pg_ctlcluster internally.

Changing Debian default installation

Debian PostgreSQL installation automatically calls the initdb i.e. it initializes the cluster with default encoding and locale. Encoding can be changed later but the locale cannot. To change the locale the initdb must be run again. To change the locale (an possibly other options in initdb) do the following:

  1. Take root privileges.
  2. Move to data directory (/var/lib/postgresql/[version]/[cluster])

  3. Delete everything within the data-directory: # rm -fR *

  4. Take postgres identity: # su postgres

  5. Run the initdb with your options: `# /usr/lib/postgresql/[version]/initdb -D /var/lib/postgresql/[version]/[cluster] [your other options]'
  6. Exit back to root.
  7. Start the server.


DataBase


See: