July 11th, 2002, 05:02 PM
Installing PostgreSQL (Shell Scripts Provided)
As requested by many people, my latest tutorial is an installation guide for PostgreSQL.
It details only the standard install procedure, as many other, less common, installs are
documented in the PostgreSQL documentation. The only benefit of this over the PostgreSQL
documentation is that noty only does it tell you the commands you need to execure to install
PostgreSQL, it also provides three scripts in a .tar.gz file.
This script installs PostgreSQL (to /usr/local/bin/pgsql, by default).
This script must be run with root privileges in order for the make and make install to work,
so remember to 'su' before running this.
This script should be run as the user created in the pgsql-install script, usually postgres.
Remember, therefore, to do a 'su - postgres' before running this. This script should be run
once only, and creates PostgreSQL's database directory and starts PostgreSQL.
This script is used for subsequent runs of PostgreSQL. Remember that you do not need to run
this immediately after pgsql-firstrun, as pgsql-firstrun starts PostgreSQL anyway.
This script should be run on boot-up to start the PostgreSQL service, and should be run as
the user created in the install script, usually postgres. Remember to 'su - postgres' before
running this one.
Installing & Running PostgreSQL
Creating A Database
tar xf- postgresql-7.2.1.tar
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data >logfile 2>&1 &
To create a new database, you can use the following:
Replace 'test' with the name of the database you wish to create. For further details about
using PostgreSQL, consult a manual, as it is beyond the scope of this tutorial, which
concentrates on installation only.
From the command line, PostgreSQL can be started as follows:
Replace 'test' with the name of your database. From this console, you can issue SQL commands
to the database, such as:
The \q at the end exits the PostgreSQL console.
CREATE TABLE services (service text,port number,description text);
INSERT INTO services VALUES ('Apache',80,'Apache HTTPd');
INSERT INTO services VALUES ('SSH',22,'OpenSSH');
To use the scripts, do the following:
tar xf- pgsql-scripts.tar
I accept absolutely no responsibility for anything these scripts do to your machine, if they kill it its your fault for running them, I do not guarantee in any way that they do what they're supposed to, although I hope they do.
July 11th, 2002, 05:11 PM
The ZIP file
The tutorial, in text format, with the .tar.gz file of the scripts, compressed for safe-keeping and future reference.
For any other documentation, go to PostgreSQL.org