PostgreSQL is my preferred database on a Linux environment.This is the sequence I used to install it on my development machine. It is running Ubuntu 8.10 (Intrepid Ibex) beta on a VMware Workstation virtual machine.
I referred to https://help.ubuntu.com/community/PostgreSQL, http://bioinformaticsonline.co.uk/2007/02/26/postgresql_on_ubuntu_linux_how_to and http://hocuspokus.net/2007/11/05/install-postgresql-on-ubuntu-710/ and adapted the instructions a little bit.
Installing the server and basic tools
sudo apt-get install postgresql postgresql-client postgresql-contrib
That got me PostgreSQL 8.3.
Basic Server Setup
First, changing the password of the postgres user:
sudo -u postgres psql postgres ALTER USER postgres WITH ENCRYPTED PASSWORD '<***password***>'; \q
Creating the initial databases
sudo -u postgres createdb dev sudo -u postgres createdb test
That creates a database named “dev”, for development, and another named “test”, for testing.
I use schemas to have multiple applications using a single database.
Setting Up the Admin Pack
The admin pack is said enable better logging and monitoring within pgAdmin.
sudo -u postgres psql < /usr/share/postgresql/8.3/contrib/adminpack.sql
Installing pgAdmin III
pgAdmin III is a database design and management application for use with PostgreSQL.
sudo aptitude install pgadmin3
Using pgAdmin
pgadmin3
I clicked on the “Add a connection to a server” button (top left). I filled in the host (localhost) and password of the postgres user (from the previous ALTER USER command). Then I clicked OK and was connected to the local PostgreSQL server.
Incidentally, I noticed that the databases I created were set to UTF-8 encoding. Great, exactly what I wanted.
Restarting the server
If there is any need, the server can be restarted this way:
sudo /etc/init.d/postgresql-8.3 restart
Other tasks
Some times I might want to open up the server for network access and/or install phpPgAdmin to control it with a Web interface. The articles mentioned in the introduction can help with that. I don’t think I’ll have to do either thing on this development environment, though.
Conclusion
That’s it. Quick, easy and powerful. I really like Ubuntu.
Thanks,
Good entry very helpful for people new to ubuntu and postgres.
Matthew
Comment by Matthew — January 22, 2009 @ 8:45 pm
I’m totally new to postgres and a basic user of Ubuntu, and it worked perfectly for me. I’m running Ubuntu 8.10 in VMWare on my new MacBook Pro.
Thanks for the well written instructions.
Comment by TJ — January 26, 2009 @ 9:34 am
Thanks a lot for an excellent straight forward article. Your “just what you need to do” type instructions were really helpful for me.
Thank you very much :)
Comment by whoever — January 26, 2009 @ 1:56 pm
Hello,
When I run “sudo -u postgres psql postgres” I get this error:
perl: warning: Falling back to the standard locale (“C”).
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
I can find no logs about postgre and postgre is not running when I look for a process of it using ps aux | grep postgre. Any idea of how could i solve this problem?
Comment by Jl — February 11, 2009 @ 11:08 pm
Thanks a lot !!
Comment by Abhishek Sinha — February 13, 2009 @ 4:31 am
Great post!! Got me going in minutes.
Comment by sharad — March 20, 2009 @ 10:35 pm
Thanks for the article Fernando.
Comment by Nikos — April 28, 2009 @ 7:47 pm
Great tutorial. Install worked for me!
:)
Comment by Ivo — July 31, 2009 @ 10:23 pm
So great to see that there is some blog that talks more about installation on Ubuntu. It’s hard to find such resources.
Thanks for the detailed steps.
Comment by Chyne — October 6, 2009 @ 3:50 am
What a man u are.. Excellent work.. Sense and simplicity..
Comment by Risky Agrawal — May 24, 2010 @ 11:54 am
hi i got this error:
postgresql: Depends: postgresql-8.3 but it is not going to be installed
postgresql-client: Depends: postgresql-client-8.3 but it is not going to be installed
postgresql-contrib: Depends: postgresql-contrib-8.3 but it is not going to be installed
do you nkonw why?
thank’s
Comment by mahrizal — October 18, 2010 @ 1:48 am
Obama is a tool
african mango extract reviews
Comment by SwatTk1 — January 5, 2012 @ 5:09 am
Not so far I have found new cool tool to work with postgresql on ubuntu – Valentina Studio. Its free edition can do things more than many commercial tools!!
I very recommend check it. http://www.valentina-db.com/en/valentina-studio-overview
Comment by nicola — August 2, 2013 @ 5:53 am