Skip to content

Postgres SQL

alochym01 edited this page May 5, 2018 · 4 revisions

Postgres SQL

  • version 9.6

Install Postgres SQL

  1. yum install -y epel-release
  2. yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
  3. yum install -y postgresql96-server net-tools

Postgres SQL Configuration

  1. Initialize
  • /usr/pgsql-9.6/bin/postgresql96-setup initdb
  1. Configuration Postgres SQL config file
  • vi /var/lib/pgsql/9.6/data/pg_hba.conf
# TYPE  	DATABASE	USER		ADDRESS		METHOD
# "local" is for Unix domain socket connections only
local		all             all                     	ident
# IPv4 local connections:
host    	all             all       	127.0.0.1/32   	md5
  1. Startup
  • systemctl start postgresql-9.6.service
  1. Start up at boot time
  • systemctl enable postgresql-9.6.service
  1. Common CLI
  • Create user
    • postgres# CREATE USER "freeswitch" WITH PASSWORD 'password';
  • Create database
    • postgres# CREATE DATABASE freeswitch;
  • Grant privileges
    • postgres# grant all privileges on database freeswitch to freeswitch;
  • Testing login to Postgres SQL
    • [hadn@localhost ~]$ psql -d freeswitch -U freeswitch -W -h 127.0.0.1
Clone this wiki locally