Atualizar versao do postgres no ubuntu (9.1 para a 9.3)

Posted About 10 years ago. Visible to the public.

Passo 1 ( https://wiki.postgresql.org/wiki/Apt Show archive.org snapshot )
Adicione o pacote do postgres no arquivo:
sudo vim /etc/apt/sources.list.d/pgdg.list
Pacote
deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main
Adicione a chave do repositório e atualize:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade

Passo 2
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
\q #sair so psql
service postgresql stop
Migração dos bancos

/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
logout #voltar para o usuario anterior
sudo apt-get remove postgresql-9.1
sudo vim /etc/postgresql/9.3/main/postgresql.conf #personalize as configurações
sudo service postgresql restart
Victor Carvalho
Last edit
About 10 years ago
Posted by Victor Carvalho to ZeroGlosa (2014-03-21 19:11)