Tuesday, 8 February 2011

Installing PostgreSQL 9.0.3

Not quite so straight forward as no package is available and this didn't work for me (still couldn't find package) :(.

This may come in useful if your installing Ubuntu from scratch.

So (summarised from here, which for some reason isn't quite right and pieced together from various other sources):


aptitude install libreadline5-dev
aptitude install zlib1g-dev
./configure
make
make 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
logout
cp contrib/start-scripts/linux /etc/init.d/postgresql
update-rc.d postgresql defaults
chmod 755 /etc/init.d/postgresql
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
usermod -d /usr/local/pgsql/ postgres
/etc/init.d/postgresql start
(reboot if you want to test start script... "ps aux | grep postgres" to see if it is running)
su - postgres
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
#(ctrl z to exit)
logout

To access remotely you'll need to edit hba.conf (use md5 not trust - though you won't be able to connect remotely as postgres and will need to create your own user for remote access) and edit postgres.conf - listen_addresses = '*'

No comments:

Post a Comment