Re: Setting up Postgresql on Linux

From: Ron St-Pierre <rstpierre(at)syscor(dot)com>
To: pcampaigne(at)charter(dot)net, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Setting up Postgresql on Linux
Date: 2004-03-02 16:08:49
Message-ID: 4044B191.2080707@syscor.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Phil Campaigne wrote:

> Hello,
> I originally installed postgresql as root user and now I am setting up
> a development environment with cvs and a java ide and tomcat. I have
> everything with the exception of postgresql integreted using a
> non-root user.
> THe process I am using is to logon as postges and start the database
> and do queries from the command line using psql. Then I logoff and
> logon as phil and start tomcat and my java ide.
>
> 1.Is there a better way to start the database and the web application?
>
> 2. During setup of postgresql I chown and ghgrp the /usr/local/pgsql
> directoy tree to postgres?
>
> 3.However my development environment(i.e. jdbc connection from my
> application) doesn't seem to have permission to access to all the
> files it needs in postgres?
>
> 4. Is is best to install postgresql as user "phil" in order to gain
> access for my integrated develoment environment?
>
> thanks,
> Phil
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>
For aditional reference you can check out the docs at
http://www.postgresql.org/docs/7.4/static/postmaster-start.html
especially section 16.3 as it pertains to linux (assuming that's your
os). Below are some of the steps I use when I install postgres on a new
machine, check out steps 10 and 11 specifically:

---- my instructions ----
8. Install:

# cd /usr/local/postgresql-7.x
# make install
# make install-all-headers
# cd /usr/local
# chown -R postgres.postgres pgsql

9. Initialize the database as user postgres:

# su - postgres
# initdb -E UNICODE -D /usr/local/pgsql/data

10. Configure (as root) the PostgreSQL SysV Script. This script is
useful for starting, stopping, and checking the status of PostgreSQL.

# cd /usr/local/src/postgresql-7.x
# cp contrib/start-scripts/linux /etc/init.d/postgres
# chmod 755 /etc/init.d/postgres

To have PostgreSQL start automatically when the computer boots add
symbolic links from the correct /etc/rc*.d/ directories to
/etc/init.d/postgres. If the normal runlevel is 3 then you really only
need to add it to rc3.d:

# ln -s /etc/init.d/postgres /etc/rc2.d/S85postgres
# ln -s /etc/init.d/postgres /etc/rc3.d/S85postgres

etc ...

11. Start PostgreSQL for the first time:

# /etc/init.d/postgres start

12. Create a new db:

# su - postgres
$ createdb testdb
$ psql testdb

----\ my instructions ----
Ron

*Note:* these are taken from the book Practical Postgres by Worsley and
Drake and are slightly(? can't remember, it's been so long since I made
the list) modified.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2004-03-02 16:48:04 Re: How to Cancel a query ?
Previous Message Karl O. Pinc 2004-03-02 15:52:27 Max/min of 2 values function, plpgsql efficency?