Installing Postgres 7.0

Contents

Setup a user

As root type useradd postgress to add the user and passwd postgres to set the password. Or, if you are familiar with linuxconf, you can use that instead.

Edit /home/postgres/.bash_profile and add the line:

export LD_LIBRARY_PATH=/usr/lib/pgsql

The RPMs

The source code is available for Postgres, but for now we're going to use the pre-compiled RPMs. These are available from
http://www.postgresql.org/ and at the time of writing, version 7.0.2-2 is the current release.

As always, these instructions apply to this specific version, although they may work for other versions.

I downloaded these files:

postgres-7.0.2-2.i386.rpm *
postgres-devel-7.0.2-2.i386.rpm *
postgres-jdbc-7.0.2-2.i386.rpm
postgres-odbc-7.0.2-2.i386.rpm
postgres-perl-7.0.2-2.i386.rpm
postgres-python-7.0.2-2.i386.rpm
postgres-server-7.0.2-2.i386.rpm *
postgres-tcl-7.0.2-2.i386.rpm *
postgres-test-7.0.2-2.i386.rpm
postgres-tk-7.0.2-2.i386.rpm

Put the RPMs where ever you like. I keep them in /home/postgres/RPMS, but you don't have to keep them once you've used them.

You can install them all if want, but for now we're only interested in the ones marked *. To install, you need to be root in the same directory as the RPMs. Type:
rpm -i postgres-7.0.2-2.i386.rpm
rpm -i postgres-server-7.0.2-2.i386.rpm
rpm -i postgres-tcl-7.0.2-2.i386.rpm
rpm -i postgres-devel-7.0.2-2.i386.rpm
Postgres is now installed.

Create system files

Login as postgres. Decide where you want to store the data files for your databases. I use /home/postgres/data...
mkdir /home/postgres/data
initdb -D /home/postgres/data

Hopefully you'll see a "Success" message telling you how to start the database.

Auto start

You may want Postgres to start at boot up. The startup script should have been installed from the RPM, and is in /etc/rc.d/init.d. As root, simply create a link to the startup script in /etc/rc.d/rc2.d:

ln -s ../init.d/postgresql S98postgres

Do the same in /etc/rc.d/rc3.d, /etc/rc.d/rc4.d and /etc/rc.d/rc5.d.

Michael Hinds, August 2000