Category: postgresql

Jan 25 2012

To restore a “plain” postgresql backup …

1.  Drop/Recreate the target database using PGAdmin

2.  Be sure to add logins to all roles that are referenced in the backup script.  This should only be necessary the first time.  The phonesystem db references the following logins… phonesystem, phoneadmin, logsreader.

3.  From a terminal window run the following command

sudo psql -d phonesystem -U seths -f “<path-to-backup>”

Seth

Nov 19 2011

To get postgresql running on ubuntu to listen for external connections I did this…

  1. From a terminal window run “sudo gedit” and type your password when prompted.  Gedit opens and you edit the conf files using it.
  2. Edit the file at /etc/postgresql/8.3/main/postgresql.conf and change
    listen_addresses='*'
    . This will enable TCPIP connections to the server.
  3. Edit the file at /etc/postgresql/8.3/main/pg_hba.conf and add the following line(s)
    host    all         all         192.168.0.0/16          trust
  4. This will allow tcpip connections (host) on any database (all) for any user (all) for CIDR-address 192.168.0 – any 16 high-level bits (192.168.0.0/16)  and authenticates anyone that can connect to the server-no pass (trust)
    See http://www.postgresql.org/docs/8.2/static/auth-pg-hba-conf.html for details
  5. Add any additional ip address ranges you need to that file
  6. From a new terminal window restart postgresql by typing the following command from a new terminal window…
    sudo /etc/init.d/postgresql-8.4 restart
    and type your password…if you setup the configuration correctly you should get an [OK] from the terminal.

I was also worried I would have to learn how to open up an ubuntu firewall but that was not needed.

This article helped me…

https://help.ubuntu.com/8.04/serverguide/C/postgresql.html

Seth