Friday, June 20, 2008

PostgreSQL Server Installation from Source (Mac OS X 10.5)

Compilation and installation is straight forward for the most part.
Get the source 8.3.3 (Current latest): http://www.postgresql.org/ftp/source/v8.3.3/

1. Un-tar and Un-bzip: tar xvjf postgresql-8.3.3.tar.bz2
2. Change into uncompressed directory: cd postgresql-8.3.3
3. Configure script: ./configure --prefix=/usr/local/pgsql (Default prefix options)
4. Compille: make
5. Install: make install
6. Add /usr/local/pgsql/bin to your path.

You are finished if you need this just for development.

Role to run the server.
$ sudo dscl . -create /Users/
$ sudo dscl . -create /Users/ UniqueID
$ sudo dscl . -create /Users/ PrimaryGroupID
$ sudo dscl . -create /Users/ UserShell
$ sudo dscl . -create /Users/ NFSHomeDirectory
$ sudo dscl . -create /Groups/
$ sudo dscl . -create /Groups/ PrimaryGroupID

and should be postgres. However you can customize this.

Useful Commands

pg_ctl: Controls server operation.
PGDATA: Environment variable that points to your path to store data.
initdb: Initializes database path. Uses PGDATA

More to come later. Yes you can use an automated installer. No you won't have the latest version.

No comments: