martedì 11 gennaio 2011

Install PostgreSQL 8.4 on Ubuntu 10.10

PostgreSQL is a database management system relational database and object-oriented free, released under the BSD license.

To install from Ubuntu to run in console the following line:
sudo apt-get install postgresql postgresql-client pgadmin3
This installs the engine and pgadmin3 client, a graphical tool to manage databases.
The next thing is to change the administrator password system PostgreSQL:
sudo passwd postgres
Now we must change the password of "user postgres" on the engine, it first entered with the following line:
psql -h localhost -U postgres -W template1
and then enter the following command:
ALTER USER postgres WITH PASSWORD 'password';
Finally out of postgres, enter the following command:
With this we have installed PostgreSQL. Settings
We set up remote access to our motor. This step is optional, only if you want to allow access to our server from other hosts.
First we edit the file postgresql.conf:
sudo gedit /etc/postgresql/8.4/main/postgresql.conf
Look for the line:
# Listen_addresses = 'localhost'
and change it to:
listen_addresses = '*'
We also look for the following line:
# Password_encryption = on
and change it to:
password_encryption = on
Now we edit the file "pg_hba.conf"
sudo gedit /etc/postgresql/8.4/main/pg_hba.conf
Modify the lines:

# Database administrative login by UNIX sockets
local   all         postgres                          ident


# "local" is for Unix domain socket connections only
local   all         all                               ident
# IPv4 remote connections:
host    all         all          md5
# IPv4 local connections:
host    all         all          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

We do this to use MD5 authentication with the user postgres.

Finally sent to restart:
sudo /etc/init.d/postgresql-8.4 restart
More information about the configuration:

The following video shows how to connect to PostgreSQL pgadmin3 and how to use:

18 commenti:

  1. Thanks Diego, I've always used MySQL for my local development of jugevents, though postgresql is the db used in production.
    I hope this post helps me to successfully install postgresql on my netbook running ubuntu, I'll let you know if I succeed with this :)

  2. I have always used PostgreSQL Parancoe! :) If you want to create a post on how to configure it. I've always found it good, at least for now! Do you think there are important differences between MySQL and PostgreSQL?

  3. Hi!

    I followed as instructed.. But couldnt find the below lines.

    We also look for the following line:

    # Password_encryption = on

    and change it to:

    password_encryption = on

    And finally when sudo /etc/init.d/postgresql-8.4 restart

    the output goes as

    sudo: /etc/init.d/postgresql-8.4: command not found

    Please advise.
    Thanks in advance.

  4. Hello, probably you are not properly installed PostgreSQL, or you installed a different version. You should try to see what version you have installed.
    So you need to start postgresql execute a different command:

    sudo /etc/init.d/postgresql restart-XXX

    Try to write: sudo /etc/init.d/postgresql .. and press the TAB key to auto-completion.

    Regarding the line that you can not find, it's really weird. control well. But you have a blank file? maybe you were wrong file because you have a different version:
    sudo gedit/etc/postgresql/XXX/main/postgresql.conf

  5. $ sudo apt-get install postgresql postgresql-client pgadmin3
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package postgresql
    E: Unable to locate package postgresql-client
    E: Unable to locate package pgadmin3

  6. The post is very informative. It is a pleasure reading it. I have also bookmarked you for checking out new posts. thanks for showing my comment in your site ...... by OPS 571 Final Exam provider.

  7. I must thank you for the efforts you have put in writing this blog. I’m hoping to view the same high-grade content by you in the future as well. In truth, your creative writing abilities has encouraged me to get my very own website now ;). ..... by BIS 220 Week 5 provider.

  8. I simply scan through the full item of yours and it had been rather smart. this can be an outsized article thanks for distributing this informative information. i will be able to visit your diary oftentimes for a few latest post!!! by MGT 311 Week 2 Individual Assignment

  9. I appear consideration it. I desire to catch included on this topic…I am appreciating enough efforts and success you put in your website,by MGT 311 Final Exam

  10. I impressed with this post. I rarely found this. I came across this and interesting stuff is present ETH 316 Final provider

  11. Great content i would be glad if you still post these type of Articles so that i can gain lot of information.For more information please go through
    MGT 498 Week 4

  12. The column is actual informative. It is a amusement account it. I accept additionally bookmarked you for blockage out fresh posts. acknowledgment for assuming my animadversion in your armpit ETH 316 Final provider

  13. Thanks for sharing this terribly informative post! this can be therefore fascinating to know. I really love reading your stuff being sent LDR 531 Week 3 Assignment

  14. The first thing is that you have to plan your time. It means that you have to share your study load on all of the months of the semester. When doing so you have already acquired the required knowledge before the exam day approaches....for more information you can also go through
    MGT 498

  15. I appearance up almanac it. I anguish for to bolt included this topic…i am apropos the time and accomplishment you put in your site, by MGT 521 provider

  16. I charge acknowledge you for the efforts you accept put in autograph this blog. I’m acquisitive to appearance the aforementioned high-grade agreeable by you in the approaching as well. In truth, your artistic autograph abilities has encouraged me to get my actual own website now by
    MGT 420 Week 2 provider.

  17. Thank you so much for providing this valuable information. It is very important to us. You Posted a Good Stuff... by MGT 521 Entire Course provider

  18. I think this is among the most significant information for me.And i’m glad reading your article. But want to remark on few general things, The web site style is great, the articles is really nice : D. Good job, cheers