RE: - Mailing list pgsql-general
From | Charlie Derr |
---|---|
Subject | RE: |
Date | |
Msg-id | LOBBJCAMDNLNCGCCHGEIMEMCEMAA.drivel_drool@bigfoot.com Whole thread Raw |
In response to | Re: ("Robert B. Easter" <reaster@comptechnews.com>) |
Responses |
RE:
|
List | pgsql-general |
First of all, thank you very much for this detailed answer. (and also thanx to Janet for asking :-] ) I am a postgresql newbie as well, and this is very very helpful. I had been trying to get things to work under NT, but decided to reboot to linux and try it there when I saw these detailed instructions. Fantastic stuff. Thank you so much Mr. Easter. ~ ~ Maybe try getting postgresql-7.0.tar.gz. from www.postgresql.org. Then do ~ something like the following commands: ~ ~ su - ~ groupadd postgres ~ adduser postgres I found that on RedHat 6.1, I was only able to add a user or a group if I was actually logged in as root. "su" didn't do it for me. ~ 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 cd /src ~ ./configure ~ --prefix=/usr/local/pgsql ~ --with-perl --with-tcl ~ --with-maxbackends=256 ~ make ~ make install cd .. ~ 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. I found that this affected "my" environment variables, but it didn't affect the environment variables for the postgres user i had created, so i added these statements to the /home/postgres/.bashrc file. Is this good enough? Or is there somewhere else that i should set these vars instead? ~ su - postgres ~ initdb I got an error message here about needing to set PGDATA or use the --pgdata switch (unfortunately i didn't paste the error message onto a floppy like i thought i could so i could read it here in NT) -- i did make sure i had created an empty data directory though ~ exit ~ ~ Now you can start the database. And that's as far as I got. I'll start it as soon as I'm sure I've got everything right. I'm presently trying the same (well,... similar) instructions on NT. The obvious question is what to do about creating a user. On NT it just isn't possible to su postgres initdb exit So does that mean i just run it as myself? This is in a non-production environment on my workstation, where I'm hoping to eventually be addressing the database w/zope. Again, I can't thank this list enough for all the great info i've picked up while lurking, ~c ~ 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. ~ sorry for the waste of bandwidth but that stuff is just too valuable to snip :-]
pgsql-general by date: