quarta-feira, 15 de março de 2017

How to install PostgreSQL 9.6 on Ubuntu/Debian/Linux

1. Introduction

This post gathers information about install PostgreSQL 9.6 on Ubuntu Server

2. Step-by-Step


  • Follow step by step from reference https://raonyguimaraes.com/how-to-install-postgresql-9-6-on-ubuntudebianlinux-mint/
  • Complete steps from reference http://askubuntu.com/questions/831292/how-to-install-postgresql-9-6-on-any-ubuntu-version

    $ sudo apt-get update
    $ sudo apt-get install postgresql-9.6
    $ sudo passwd postgres # password = postgres
    $ sudo service postgresql start


  • Test PostgreSQL database connection method peer

    $ su postgres # passwd = postgres


  • Create a PostgreSQL sample database called "database_name"

    $ createdb database_name
    $ psql -d database_name
    database_name=# \q


  • Configure PostgreSQL to allow remote IP address to access PostgreSQL

    $ exit # default user
    $ sudo cp /etc/postgresql/9.6/main/pg_hba.conf /etc/postgresql/9.6/main/pg_hba.conf.bkp.2017-03-15
    $ sudo cp /etc/postgresql/9.6/main/postgresql.conf /etc/postgresql/9.6/main/postgresql.conf.bkp.2017-03-15
    $ sudo vim /etc/postgresql/9.6/main/pg_hba.conf
        :
        host    all             all             10.0.2.0/24            md5
        :
    $ sudo vim /etc/postgresql/9.6/main/postgresql.conf
        :
        listen_addresses = '*'        
        :
    $ sudo service postgresql stop
    $ sudo service postgresql start
    $ sudo service postgresql status


  • Create a PostgreSQL database user called "admin" identified by password "admin"

    $ su postgres # passwd = postgres
    $ psql
    database_name=# CREATE USER admin WITH PASSWORD 'admin';
    database_name=# GRANT postgres TO admin;
    database_name=# \q
    $ psql -h 127.0.0.1 -d database_name -U admin # passwd = admin
    database_name=# \q
    $ psql -h 10.0.2.15 -d database_name -U admin # passwd = admin
    database_name=# \q


3. References




Nenhum comentário:

Postar um comentário