Translations: English
Search on Docs:
ActionItem Search:

PostgreSQL installation and configuration


1. Install

sudo apt-get install postgresql

2. Create user

Postgres uses the current logged user to authenticate, so you need to create an user named the same as your system username.

sudo -u postgres createuser $USER --no-superuser --createdb --no-createrole

Alternatively you can change your porstgres authentication method to trust instead of ident. This will allow you to use noosfero's default configuration file for postgresql. This can be done by editing the following file:



# "local" is for Unix domain socket connections only
# local   all             all                                     ident
local   all             all                                     trust

3. Create databases

Rails needs tree databases: development, test and production.
createdb noosfero_development
createdb noosfero_test
createdb noosfero_production
You may change the prefix for multiple installations.

4. Configure database.yml file

  • Copy config/database.yml.pgsql to config/database.yml, in the source directory
  • Edit it changing the username to the one you just created. The password is left blank, as it uses the system authentication.
  • Edit the databases names, if you have another prefix for them

5. Tunning

On production, you might consider editing /etc/postgresql/8.4/main/postgresql.conf with the following keys for better performance:
shared_buffers = 128MB
effective_cache_size = 512MB

And for localization:
datestyle = 'iso, dmy'
lc_messages = 'pt_BR.UTF-8'     # locale for system error message
          # strings
lc_monetary = 'pt_BR.UTF-8'     # locale for monetary formatting
lc_numeric = 'pt_BR.UTF-8'      # locale for number formatting
lc_time = 'pt_BR.UTF-8'       # locale for time formatting


If you are upgrading from 8.4 to 9.1, run:
sudo pg_dropcluster --stop 9.1 main
sudo pg_upgradecluster 8.4 main

Check this for more details.

Management Tools

pgAdmin is THE Open Source (GUI) management tool for your PostgreSQL databases.

$ sudo aptitude install pgadmin3

You can find other tools at PostgreSQL's wiki.

Add comment
You need to login to be able to comment.
Topic revision: r1 - 22 May 2015, UnknownUser

irc Talk with Devs Now!

Copyright © 2007-2019 by the Noosfero contributors
Colivre - Cooperativa de Tecnologias Livres