Skip to content

Instantly share code, notes, and snippets.

@dakoctba
Last active August 29, 2015 14:03
Show Gist options
  • Save dakoctba/3532b4e23d9b32657c99 to your computer and use it in GitHub Desktop.
Save dakoctba/3532b4e23d9b32657c99 to your computer and use it in GitHub Desktop.
PostgreSQL 9.4 & Vagrant (para usar com Rails)

Antes de tudo vamos corrigir o locale

Instalação

sudo apt-get remove postgresql -y
sudo apt-get install postgresql libpq-dev -y

Alterando permissões

Substitua a linha local all postgres peer por local all postgres md5 no arquivo /etc/postgresql/9.1/main/pg_hba.conf Reinicie o postgres com o comando sudo service postgresql restart


Adicione essas linhas no final do arquivo /etc/bash.bashrc

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Execute os comandos:

sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales

sudo su postgres

psql

update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';

Antes de tudo vamos corrigir o locale

Adicione essas linhas no final do arquivo /etc/bash.bashrc

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Execute os comandos:

sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales

Instalação

sudo apt-get remove postgresql-9.1 -y
sudo apt-get install postgresql-9.1 libpq-dev -y

Alterando permissões

Substitua a linha local all postgres peer por local all postgres md5 no arquivo /etc/postgresql/9.1/main/pg_hba.conf

####Restart

sudo 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment