Zypper Installation

From PostgreSQL wiki
Jump to navigationJump to search

PostgreSQL can be installed using RPMs (binary) managed by Zypper or YaST. This is available for the following Linux distributions (currently only s390x platforms; for the current release):

  • SUSE Linux Enterprise Server

Instructions

Import the package signing key:

SLES12-SP3

wget http://packages.2ndquadrant.com/postgresql-z/RPM-GPG-KEY-2NDQ-SLES12
rpm --import RPM-GPG-KEY-2NDQ-SLES12

SLES15

wget http://packages.2ndquadrant.com/postgresql-z/RPM-GPG-KEY-2NDQ-SLES15
rpm --import RPM-GPG-KEY-2NDQ-SLES15

Configure your Zypper repository

SLES11-SP3

Add the software repository using Zypper:

zypper addrepo -t YUM http://packages.2ndquadrant.com/postgresql-z-suse/zypper/sles-11sp3-s390x pg
zypper refresh

Source RPMs are also available and can be added with Zypper:

zypper addrepo -t YUM http://packages.2ndquadrant.com/postgresql-z-suse/zypper/sles-11sp3 pgsrc
zypper refresh

SLES12-SP3 PostgreSQL 10

Add the software repository using Zypper:

zypper addrepo -t YUM http://packages.2ndquadrant.com/postgresql-z/zypper/10/sles12-s390x pg10
zypper refresh

Source RPMs are also available and can be added with Zypper:

zypper addrepo -t YUM http://packages.2ndquadrant.com/postgresql-z/zypper/10/sles12 pg10src
zypper refresh

SLES15 PostgreSQL 10

Add the software repository using Zypper:

zypper addrepo -t YUM http://packages.2ndquadrant.com/postgresql-z/zypper/10/sles15-s390x pg10
zypper refresh

Source RPMs are also available and can be added with Zypper:

zypper addrepo -t YUM http://packages.2ndquadrant.com/postgresql-z/zypper/10/sles15 pg10src
zypper refresh

Install PostgreSQL

To list available packages:

zypper packages -N pg

For example, to install a basic PostgreSQL 9.4 server:

zypper install postgresql94-server

Other packages can be installed according to your needs.

Post-installation commands

After installing the packages, a database needs to be initialized and configured.

In the commands below, the value of <name> will vary depending on the version of PostgreSQL used.

For PostgreSQL version 9.0 and above, the <name> includes the major.minor version of PostgreSQL, e.g., postgresql-9.4

Data Directory

The PostgreSQL data directory contains all of the data files for the database. The variable PGDATA is used to reference this directory.

For PostgreSQL version 9.0 and above, the default data directory is:

/var/lib/pgsql/<name>/data

For example:

/var/lib/pgsql/9.4/data

Initialize

The first command (only needed once) is to initialize the database in PGDATA.

service <name> initdb

E.g. for version 9.4:

service postgresql-9.4 initdb

Startup

If you want PostgreSQL to start automatically when the OS starts:

chkconfig <name> on

E.g. for version 9.4:

chkconfig postgresql-9.4 on

Control service

To control the database service, use:

service <name> <command>

where <command> can be:

  • start : start the database
  • stop : stop the database
  • restart : stop/start the database; used to read changes to core configuration files
  • reload : reload pg_hba.conf file while keeping database running


E.g. to start version 9.4:

service postgresql-9.4 start