Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to install postgreSQL on freebsd?

Status
Not open for further replies.

samansk

Technical User
Dec 7, 2000
44
I wnat step by step suggestion to install pgsql on freebsd box?
 
I know this is an old thread, but I recently compiled postgres 7.1.2, on FreeBSD 4.2, and everything went very smoothly, according to the INSTALL directions, although my post-install setup, was a little different:

Main install

1. unzip, untar source, enter source dir,
2. ./configure --with-perl --enable-odbc
3. gmake, su to root, gmake install
4. add a new user called postgres
5. su - postgres
6. /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

Post-install config

1. su to root
2. cd /usr/local/pgsql
(I can't remember whether the "data" directory already existed or I created one)
3. chown -R postgres data
4. chmod -R 700 data
5. edit /etc/rc.local, add:
su -l postgres -c "/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data -s -l /usr/local/pgsql/data/serverlog" (one line)
echo -n ' postgresql\n'

6. Go to original source dir:
cp contrib/start-scripts/freebsd /usr/local/sbin/postctrl
7. chmod 700 /usr/local/sbin/postctrl
8. Edit /usr/local/sbin/postctrl in the following section:
Code:
## EDIT FROM HERE

# Installation prefix
prefix=/usr/local/pgsql

# Data directory
PGDATA="/usr/local/pgsql/data"

# Who to run pg_ctl as, should be "postgres".
PGUSER=postgres

# Where to keep a log file
PGLOG="$PGDATA/serverlog"

## STOP EDITING HERE

That about does it. The database tables are kept in /usr/local/pgsql/data, and can only be accesses by the postgres user/process. The 2 lines in rc.local are the startup script, while the /usr/local/sbin/postctrl script is the script you can use to handle the postgres daemon from the shell in the following manner (running as root):

postctrl start
postctrl stop
postctrl restart
postctrl status

(obviously, you can name this script anything you want)

I'm not saying this is the only way to setup PostgreSQL on FreeBSD, but it works great for me. HTH

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top