Re: - Mailing list pgsql-general

From Robert B. Easter
Subject Re:
Date
Msg-id 00052303282701.00239@comptechnews
Whole thread Raw
In response to  ("Janet" <janet@chinasystems-cn.com>)
Responses RE:
List pgsql-general
Maybe try getting postgresql-7.0.tar.gz. from www.postgresql.org.  Then do
something like the following commands:

su -
groupadd postgres
adduser postgres
    Note: make postgres user with default group postgres
cd /usr/local/src
tar -xvzf postgresql-7.0.tar.gz
cd postgresql-7.0
less INSTALL
./configure
    --prefix=/usr/local/pgsql
    --with-perl --with-tcl
    --with-maxbackends=256
make
make install
cd doc
make install
cd /usr/local
chown -R postgres:postgres pgsql
cd /etc
vi profile
    Note:    add /usr/local/pgsql/bin to PATH
        add /usr/local/pgsql/man to MANPATH
        set PGLIB=/usr/local/pgsql/lib
        set PGDATA=/usr/local/pgsql/data
    Then exit and log back in to take effect.
su - postgres
initdb
exit

Now you can start the database.  To start it, you can use pg_ctl that comes
with postgresql, or you can make a script like the following
/etc/rc.d/init.d/postgresql:

#!/bin/sh
# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting postgres Postmaster daemon:"
        if [ -z "`pidof -s postmaster`" ]
        then
                su postgres -c "/usr/local/pgsql/bin/postmaster -S -D /usr/local/pgsql/data &"
                echo -n " postmaster"
        else
                echo -n " (already running)"
        fi
        echo
        #touch /var/lock/subsys/postgres
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down postgres Postmaster daemon: "
        killall -TERM postmaster 2>/dev/null
        killall -TERM postgres 2>/dev/null
        echo postmaster postgres
        rm -f /tmp/.s.PGSQL.5432
        ;;
  *)
        echo "Usage: postgres {start|stop}"
        exit 1
esac
exit 0

Now start the database:
/etc/rc.d/init.d/postgresql start
You will have to add this into your startup scripts.
/etc/rc.d/init.d/postgresql stop,  can be put in your shutdown scripts.

Then do the following with the server started:

su - postgres
createuser <some username>
    Do this for each user you will have.

Once you have your user created, you can login to the user and run:

createdb
    Note: creates a database called <username> by default.
psql
    Note: connect to your <username> database by default.

At this point you'll be able to start using SQL and create tables etc.
I think these instructions are ok.  Hope it helps.


On Tue, 23 May 2000, Janet wrote:
> Hello!
>
> I don't know if there is the right place to ask my question. If not, please
> accept my apology.
>
> I'm totally new to Linux. And I have troubles using the PostgreSQL.
>
> I installed Redhat 6.0 and find there is postgresql already installed on my
> computer.
> Running the following command I get:
> ////////////////////////////////////////////////////
> $rpm -ql postgresql
> /etc/rc.d/init.d/postgresql
> /usr/bin/cleardbdir
> /usr/bin/createdb
> /usr/bin/createuser
> /usr/bin/destroydb
> /usr/bin/destroyuser
> /usr/bin/initdb
> /usr/bin/initlocation
> /usr/bin/pg_passwd
> /usr/bin/pg_version
> /usr/bin/postgres
> /usr/bin/postmaster
> /usr/doc/postgresql-6.4.2
> .....
> ((All the /usr/doc entried are omitted here since they are too many)
> ......
> //var/lib/pgsql
> ///////////////////////////////////////////
>
> I thought it's ok to start the postgresql server, so I run the following
> command but it complains:
> (the command was found in the "/etc/rc.d/init.d/postgresql" file)
> //////////////////////////////////////////////
> $postmaster -i -D/var/lib/pgsql
> /usr/bin/postmaster does not find the database system.  Expected to find it
> in the PGDATA directory "/var/lib/pgsql", but unable to open file with
> pathname "/var/lib/pgsql/base/template1/pg_class".
>
> No data directory -- can't proceed.
> ////////////////////////////////////////////
>
> I read the installation instruction of the PostgreSQL but it teaches you how
> to install from the beginning and expect you to use the file
> "postgresql-v6.4.tar.gz", which I haven't got on my computer.
>
> I also tried to run the following command:
> $initdb
> but it cannot work yet.
>
> Someone told me I should establish a data store for the PostgreSQL. What's
> that? How to?
>
> Do I need to download "postgresql-v6.4.tar.gz" to re-install the PostgreSQL?
> Or how can I
> solve my problem? What's in the earth wrong? What's indeed the PGDATA mean?
>
> Any suggestion or hints are appreciated greatly!
>
> With my best regard:
> Janet
--
Robert B. Easter
reaster@comptechnews.com

pgsql-general by date:

Previous
From: Sungchul Park
Date:
Subject: Join with other database's table
Next
From: Sungchul Park
Date:
Subject: Re: Join with other database's table