This page in other versions: 9.0 / 9.1 / 9.2 / 9.3  |  Development versions: devel / 9.4  |  Unsupported versions: 7.1 / 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3 / 8.4

Chapter 14. Installation Instructions

This chapter describes the installation of PostgreSQL from the source code distribution. (If you are installing a pre-packaged distribution, such as an RPM or Debian package, ignore this chapter and read the packager's instructions instead.)

14.1. Short Version

./configure
gmake
su
gmake install
adduser 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 -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

The long version is the rest of this chapter.

Comments


March 22, 2005, 2:34 a.m.

How to do it in FreeBSD:

$ su
# cd /usr/ports/databases/postgresqlXX-server/ (replace XX with the version number)
# make install

{wait}

# cd /usr/local/pgsql/
# mkdir data
# chown pgsql data
# su - pgsql
$ /usr/local/bin/initdb -D /usr/local/pgsql/data
$ /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
$ /usr/local/bin/createdb test
$ /usr/local/bin/psql test

done.


April 1, 2005, 11:25 p.m.

The ODBC driver has been moved out of the PostgreSQL tree into a separate package. To get the ODBC driver code go to http://www.postgresql.org/ftp/odbc/versions/src/


April 9, 2005, 8:52 a.m.

How to do it in Gentoo:

$ su
# emerge postgresql

{wait}

# cd /var/lib/postgresql/
# mkdir data
# chown postgres data
# su - postgres
$ /usr/local/bin/initdb -D /usr/local/pgsql/data
$ cd /var/lib/postgresql/data/
$ pg_ctl start -D /var/lib/postgresql/data/ -l logfile
$ /usr/local/bin/createdb test
$ /usr/local/bin/psql test

For more infos:

HOWTO Configure Postgresql in Gentoo
------------------------------------
http://gentoo-wiki.com/HOWTO_Configure_Postgresql


April 18, 2005, 9:36 p.m.

On (Open)Darwin you can use DarwinPorts ( http://darwinports.opendarwin.org/ ) to install PostgreSQL8. After installing the port system itself (see: http://darwinports.opendarwin.org/docs/ch01s03.html ) you just type:

sudo port install postgresql8

Then you can add a user,
- on Mac OS X using NetInfo Manager (the easiest way to do this is to make a copy of the already existing mysql user and change this afterwards: choose a free uid and gid (I took 73) set the shell to some shell (for instance /bin/sh and the home to /usr/local/pgsql.

- If you're on OpenDarwin, you can use some of the available adduser scripts on the net ( for instance: download http://www.opendarwin.org/pipermail/hackers/attachments/20040615/d29608ba/adduser.bin from http://www.opendarwin.org/pipermail/hackers/2004-June/004307.html rename it to .tgz instead of .bin, unpack it, check it with a text editor, change permissions to make it executable, run it).

the rest is pretty much the same, you just have to change every "/usr/local/pgsql/" into "/opt/local" (this is the default location where darwinports installs everything) or whatever prefix you've chosen for darwinports. initdb f.i. resides here by default: /opt/local/bin/initdb . I think you get the idea.


June 2, 2005, 2:25 p.m.

On CentOS4 (RHES-4) use:
/var/lib/pgsql/data

rather than:
/usr/local/pgsql/data


July 4, 2005, noon

Using darwinports on OS X: install with the server variant and a user named postgresql8 is automatically created.

sudo port install postgresql8 +server

this will install everything under /opt/local


July 13, 2005, 8:55 a.m.

The previous comment on how to do it in FreeBSD is not the usual way.

# su
# cd /usr/ports/databases/postgresql80-server/
# make install
As you wish add clean or distclean to the previous line.

Obviously creating the required folders and starting postgresql as the pgsql user should be left to the scripts provided by the port.

# echo "postgresql_enable=\"YES\"" >> /etc/rc.conf
# /usr/local/etc/rc.d/010.pgsql.sh initdb

To start it without doing a reboot
# /usr/local/etc/rc.d/010.pgsql.sh start

To create a database
# createdb mydb -U pgsql -O pgsql


Aug. 7, 2005, 7:35 p.m.

In Debian the following packages are necessary.

libreadline4-dev
zlib1g-dev.


Sept. 11, 2005, 10:17 p.m.

Redhat 7.3. mucho frustration with Readline:

Not sure what the magic bullet was, but I installed:

ncurses-devel
libtermcap-devel
readline-devel
zlib-devel

before config would get all the way through. I also added refs to the libs but I think the above was probably all it needed.


Sept. 30, 2005, 4 a.m.

How to do it in debian:
#apt-get install postgresql
{wait and choose pg_data path}
//thats all!


Oct. 1, 2005, 7:46 p.m.

Correction in debian install. You can't install PostgreSQL 8 in Debian Sarge (current stable) with default apt-get configuration. Instead It will install version 7.4.x.

(If you are beginner Debian user, don't try apt-get to install newest version. Compile it from sources)


May 6, 2006, 3:15 a.m.

Compiling from source worked fine for me on Sarge with postgresql-8.1.3.

Additional installs:

libreadline4-dev
zlib1g-dev
termcap-compat

Tweeks:

create a link from make to gmake

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group