Install Postgres 8 on Centos

How to Install Postgres 8 on RHEL/Centos in 3 minutes

I want to share quick and specific instructions for the installation of the Postgres 8 database on Red Hat Enterprise Linux 5 / Centos 5. I am using Yum for this installation. To make sure that you have everything needed do:

yum list | grep postresql


and verify that you see:

postgresql.i386, postgresql-server.i386 and postgres-libs.i386 (i386 if on non-64 bit version)


Centos installation comes with postgresql-lib installed. If it does not, do:

yum install postgresql-libs


Now, the general installation. As root install postgres core:

yum install postgresql


Install postgres server:

yum install postgresql-server


Now create postgres user:

adduser postgres


Create the datafile for the database:

mkdir -p /usr/local/pgsql/data


Change ownership of the data files to the postgres user:

chown postgres /usr/local/pgsql/data


Now assume the role of a postgres user:

su - postgres


Important note: Installation of the postgres executables on Centos 5 / RHEL 5 is /usr/bin not /usr/local as Postgres official documentation suggests.

Initialize the datafiles for the database:

/usr/bin/initdb -D /usr/local/pgsql/data


Start the database with initialized datafiles as the background process (&) and log all messages and errors (2&1) in the logfile:

/usr/bin/postgres -D /usr/local/pgsql/data > logfile 2>&1 &


Create the test database:

/usr/bin/createdb test


Log in to the test database:

/usr/bin/psql test


You should see "Welcome to Postgres 8..." intro message and prompt:

test=#

Komentarze

Popularne posty z tego bloga

Set up JBoss AS 5.1.0 and Seam 2.2.0 in Ubuntu 9.04