Skip to content

Instantly share code, notes, and snippets.

@gustavocoleta
Last active April 12, 2021 17:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gustavocoleta/3df3644ff04b8b5b1c51548cf91e9254 to your computer and use it in GitHub Desktop.
Save gustavocoleta/3df3644ff04b8b5b1c51548cf91e9254 to your computer and use it in GitHub Desktop.
PostgreSQL Installation in Linux CentOS 7
  1. Instalar os packages:
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql11
yum install postgresql11-server
yum install postgresql96-contrib
  1. Inicializar o banco de dados e habilitar o início automático:
/usr/pgsql-11/bin/postgresql-11-setup initdb
systemctl enable postgresql-11
systemctl start postgresql-11
  1. Alterar senha do usuário e criar banco de dados:
sudo passwd postgres
su - postgres
psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'newpassword';"
psql postgres
CREATE DATABASE nomedobanco;
  1. Editar o arquivo '/var/lib/pgsql/11/data/pg_hba.conf' com as propriedades:
# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
  1. Editar o arquivo '/var/lib/pgsql/11/data/postgresql.conf' as propriedades:
listen_addresses = '*'
datestyle = 'iso, dmy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment