Installing PostgreSQL (Shell Scripts Provided)
Results 1 to 2 of 2

Thread: Installing PostgreSQL (Shell Scripts Provided)

  1. #1
    Senior Member
    Join Date
    Oct 2001
    Posts
    677

    Installing PostgreSQL (Shell Scripts Provided)

    Installing PostgreSQL
    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.

    pgsql-install
    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.

    pgsql-firstrun
    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.

    pgsql-start
    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
    Code:
    su
    gunzip postgresql-7.2.1.tar.gz
    tar xf- postgresql-7.2.1.tar
    cd ./postgresql-7.2.1
    ./configure
    gmake
    gmake install
    useradd postgres
    mkdir /usr/local/pgsql/data
    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 &
    Creating A Database
    To create a new database, you can use the following:
    Code:
    /usr/local/pgsql/bin/createdb test
    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.

    Using PostgreSQL
    From the command line, PostgreSQL can be started as follows:
    Code:
    /usr/local/pgsql/bin/psql test
    Replace 'test' with the name of your database. From this console, you can issue SQL commands

    to the database, such as:
    Code:
    CREATE TABLE services (service text,port number,description text);
    INSERT INTO services VALUES ('Apache',80,'Apache HTTPd');
    INSERT INTO services VALUES ('SSH',22,'OpenSSH');
    \q
    The \q at the end exits the PostgreSQL console.

    The Scripts
    To use the scripts, do the following:
    Code:
    gunzip pgsql-scripts.tar.gz
    tar xf- pgsql-scripts.tar
    Disclaimer
    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.
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Posts
    677

    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
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •