Text Size: Normal / Large

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.


User Comments


Clay Ginsburg <cginsburg AT gmail.com>
09 Jan 2006 21:18:58

If you are using macOS X and standard ./configure does not work and you use fink, try
./configure --with-includes=/sw/include --with-libraries=/sw/lib  .  This causes the installer to look at your fink installed packages as well.

Jae <tonyjeon AT hotmail.com>
10 Jan 2006 19:38:58

if "adduser" is not found, then use "useradd" for SUSE.

Niranga Dharmaratna <niranga AT nirmani.com>
03 Feb 2006 15:26:50

If the ./configure script throws an error for readline lib;
Check if you have both readline & readline-devel installed. Try re-installing both. Check ncurses installation if it still fails.

Alex <almos AT ukr.net>
06 Mar 2006 22:00:15

On FreeBSD compilation process takes enormous amount of time, on Celeron 2.4Ghz, 512MB RAM, more than 2-3 hours, and even more.

Gypsy Rogers <postgresql AT gypsy.org>
12 Mar 2006 19:57:59

If you install on FreeBSD with ports and end up here because you are looking for the initdb command you should realize that the default user from ports is pgsql not postgres and the programs are installed in /usr/local/bin not /usr/local/pgsql/bin/

*binarystar* <postgresql AT binarystar.org>
12 Apr 2006 11:38:29

As pointed out, on openSuse 10 you need to ensure that the readline & readline-devel libraries are properly installed,

I ended up ( after a fiar few ./configure problems ) having success with

rpm-Uvh --force --replacefiles readline-5.0-9.i586.rpm readline-devel-5.0-9.i586.rpm

I hope this is useful to some other poor soul ;)

Richard Troy <RTroy AT ScienceTools.com>
20 Apr 2006 19:30:11

If using Red Hat Linux Fedora Core (and probably other Red Hat versions), and you install from RPMs:

1) Your directory is /var/lib/pgsql instead of /usr/local/pgsql, and the binaries will be inserted into /usr/bin instead of /usr/local/pgsql/bin. Thus, all of the executables are already in the default BASH path as setup by a fresh installation.

2) I've never had to add the postgres user - already there.

3) Importantly, start, stop, restart with:

/sbin/service postgresql {start | stop | restart | (others?) }

This will put log messages in /var/lib/pgsql/pgstartup.log On the first run, it'll error out about this file - it's normal.

Fabian <fabian.seoane AT gmail.com>
07 May 2006 10:54:02

On Ubuntu, same thing as on Fedora if you install from DEBs.

James P <james AT digitalchicago.net>
07 May 2006 14:21:40

If you read the notes on the FreeBSD source install above taking hours...  Don't be scared off by that.  Of course the easiest way is just to install from ports, but if you're a source nut its not a 3 hour process (of course that depends on your hardware).  I built from source on a heavily loaded server with duel P3 600's - 512 RAM and it finished within 10 min from gmake to gmake install.  I've tested the same thing on a single P3 500 and got similar results.

James Bannon <james.bannon AT ntlworld.com>
18 May 2006 16:27:58

Don't forget to set the PGDATA environment variable to /var/lib/pgsql/data in the postgres user's .bash_profile. This avoids having to specify -D. Same for any user who will be allowed to connect to the server.

On FC5, if you start the postgresql daemon before running initdb, it will automatically initialise the database server for you. However, in pg_hba.conf it sets the default permissions to ident sameuser meaning that the database cannot be accessed properly. Edit the file, specify trust and restrat the server using pg_ctl. Then you can proceed to add users etc. Once that's done permissions can be set to md5 and the server can be restarted.

Tamas Vincze <tom AT vincze.org>
10 Jun 2006 20:31:18

On FC5 to make the ident authentication work I had to remove the -E switch from the server_args line of /etc/xinetd.d/auth which disables the encryption of user names.

Sam Fourman Jr. <sfourman AT gmail.com>
29 Aug 2006 20:03:47

built PostgreSQL 8.1.4 from source on OpenBSD in less than 12 min on a Dual PIII, you must install gmake from ports first no big deal

John A. <jca AT fundingworks.biz>
09 Sep 2006 17:10:52

The FreeBSD package only takes awhile if you don't have any of the other packages installed that it depends upon and what options you want installed when config runs for the package.  Keep in mind that if you install all options and all dependant package options it will take awhile.  A more accurate assessment of the compile time of the FreeBSD pgsql packages is after all dependancies have been installed then installing just the client and server packages.  From make to installation was a couple of hrs on a dual P-II/300 with a RAID controller but that included all of the dependant packages plus the bells & whistles I specified to include when configure ran for the package and the respective dependant packages.  When you make a port from the FreeBSD ports list, it will go out and compile everything you need for that port to work.  A much welcome feature of the FreeBSD ports and packages collection.

Andreas <rtl AT mytrashmail.com>
15 Sep 2006 20:31:29

In order to increase the compilation speed slightly add a '-pipe' gcc option to CFLAGS variable.

<efarrugi AT gmu.edu>
02 Oct 2006 18:12:06

A bunch of regression tests failed on my OpenBSD installation. The culprit? I was compiling the code as a normal user, and OpenBSD sets lower limits for users than it does for root and daemon and staff accounts, in particular with respect to process, file, and stack limits. And "make check" is very resource intensive.

Try "ulimit -a" to list your limits, and compare those with root's. If you can't compile as root, modify login.conf and add a new login class. Set the compiling user's login class to that new login class using usermod.

Zhao Kai <peter.zhaokai AT gmail.com>
14 Oct 2006 17:27:43

Explaination of 2>&1 n>&m: Swap Standard Output and Standard Error

How-To-Install and Linux Commands
For some practical install experience, please see the book "Practical PostgreSQL", Chapter 2. Installing PostgreSQL
E.g.
Example 2-10. The gmake install command
$ su -c "gmake install"
Using the su -c command lets you save a step by only logging you in as the root user for the duration of the command’s execution.

Add Comment

Please use this form to add your own comments regarding your experience with particular features of PostgreSQL, clarifications of the documentation, or hints for other users. Please note, this is not a support forum, and your IP address will be logged. If you have a question or need help, please see the faq, try a mailing list, or join us on IRC. Note that submissions containing URLs or other keywords commonly found in 'spam' comments may be silently discarded. Please contact the webmaster if you think this is happening to you in error.

In order to submit a comment, you must have a community account.

* Comment
 

* denotes required field

Privacy Policy | Project hosted by hub.org | Designed by tinysofa
Copyright © 1996 – 2007 PostgreSQL Global Development Group