Skip to content

Instantly share code, notes, and snippets.

@bvajda
Created August 19, 2011 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvajda/1156568 to your computer and use it in GitHub Desktop.
Save bvajda/1156568 to your computer and use it in GitHub Desktop.
PostgreSQL on Ubuntu 11.04

Installing PostgreSQL on Ubuntu 11.04

1 if add-apt-repository is not installed, install it with:

sudo apt-get install python-software-properties

2 don't forget ssh server:

sudo apt-get install openssh-server

3 install the server

sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql

4 initialize the database as postgres, hash the password, set a superuser (same as the server account), ask for a password

sudo su postgres
initdb -D /usr/local/pgsql/data -A md5 --username=postgres -W

5 accept external connections

# edit /usr/local/pgsql/data/postgresql.conf
listen_addresses = '*'

6 add external users:

# edit /usr/local/pgsql/data/pg_hba.conf (e.g.):
host	all		all		172.16.38.1/32		md5

7 start server

/usr/lib/postgresql/9.0/bin/pg_ctl -D /usr/local/pgsql/data/ -l /var/log/postgresql/serverlog start

8 stop server

/usr/lib/postgresql/9.0/bin/pg_ctl -D /usr/local/pgsql/data/ stop

in case you need to login as postgres:

sudo su postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment