Thursday, June 4, 2009

Tutorial: How To Install Postgres on Ubuntu

The Ubuntu Synaptic package manager will help you here. Make sure you install these two packages:

  • postgresql
  • pgAdmin 3

After install, you will need to change the default password for the postgres user.

  • sudo -u postgres psql postgres
  • \password postgres
  • Provide your password of choice

Now, launch the pgAdmin console via the menu Applications -> Programming -> pgAdmin 3. Log in using these values:

  • localhost
  • user: postgres
  • password you just set

Create a non-Admin user (aka login role):

  • Right click on Login Roles in the tree, select New Login Role...
  • Name: myuser
  • Password: mypassword
  • If needed, check the box for Superuser privs, Create... privs

Finally, to allow the build to operate without prompting for passwords, you need to:

  • Open the file ~/.pgpass for edit (or create, if doesn't exist)
  • Add this line:
    • localhost:5432:*:myuser:mypassword

You should be able to use Postgres like a champ now. You can now login with the new user using pgAdmin

No comments:

Post a Comment