Introduction to PostgreSQL

October 2, 2017    PostgreSQL

PostgreSQL is an object-RDBMS (ORDBMS) developed by the PostgreSQL Global Development Group.

Installation on CentOS 6.9

Installation

sudo rpm -Uvh http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-redhat95-9.5-2.noarch.rpm

sudo yum -y install postgresql95-server postgresql95 libpqxx-devel postgresql-devel

Initializing database

sudo service postgresql-9.5 initdb

Starting Server

sudo service  postgresql-9.5 start

Auto-starting postgresql on server restart

sudo chkconfig postgresql-9.5 on

psql setup (updating default psql path to new version)

sudo mv /usr/bin/psql /usr/bin/psql-bk
sudo ln -sfn /usr/pgsql-9.5/bin/psql /usr/bin/psql

commandline postgres

sudo -u postgres psql
postgres=#
postgres=# \q

 

PostgreSQL docker instance

Downloading PostgreSQL docker image

docker pull postgres:9.6.5

Running postgres container

docker run --name postgres-5432 -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres:9.6.5