My system's locale is en_US.UTF-8. Because of that, the postgreSQL installation uses this locale by default for the cluster during installation.

Creating new cluster 9.3/main ...
  config /etc/postgresql/9.3/main
  data   /var/lib/postgresql/9.3/main
  locale en_US.UTF-8
  port   5432

But I want my postgreSQL server to install with locale pt_BR.UTF-8. Is it possible?


I just found a solution for this problem! Here it is..

1- Stop and drop your current cluster:

$ sudo pg_dropcluster --stop 9.3 main

2- Create a new cluster with the correct locale:

$ sudo locale-gen pt_BR.UTF-8
$ sudo pg_createcluster --locale pt_BR.UTF-8 9.3 main

3- Confirm it worked as expected:

$ sudo -u postgres psql
=> show LC_COLLATE;

Simply install it using below commands :

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

and then change the datastorage location :


eg : vi /etc/postgresql/8.4/main/postgresql.conf

Search for "data_directory" and provide your new datapath, now save the file and restart the postgresSQL service to reflect this new change.

Considered : your new path is /Database/Storage

Make sure, datapath is accessible only by postgres user - command to do that.

chown postgres.postgres /Database/Storage chmod 700 /Database/Storage

Hopes this helps,

  • But.. by "locale" in this context I'm referring to en_US.UTF8, pt_BR.UTF8, etc.. – tessiof Dec 6 '14 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.