postgresql single instace installations

Hello, I will explain how to install postgresql 12 on Centos 7. And how to create postgresql database is explained below.

—————-postgresql single instace installations————————-

repo package

#yum install centos-release-scl-rh

# yum install llvm-toolset-7-clang

**********************************************************************************

# yum install -y epel-release

# yum install llvm5.0-devel

**********************postgresql software installations**********************************

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

yum install -y postgresql12-server postgresql12-client postgresql12-contrib postgresql12-devel

 

mkdir /postgres/data
chown postgres:postgres /postgres/data

passwd postgres
postgres
postgres

******************************************************************************

su – postgres

vi .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PATH:/usr/pgsql-12/bin/
export PGDATA=/postgres/data
export PGUSER=postgres
export PGDATABASE=postgres
export PGPORT=5432
export PGLOCALDIR=/usr/pgsql-12/share/locale
export PATH

******************************************************************************

initdb -D /postgres/data

pg_ctl status
pg_ctl stop
pg_ctl start

 

# DB Version: 12
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 32 GB
# CPUs num: 4
# Connections num: 500
# Data Storage: hdd

listen_addresses = ‘*’
port = 5432
max_connections = 500
shared_buffers = 8GB
effective_cache_size = 24GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 4
effective_io_concurrency = 2
work_mem = 8388kB
min_wal_size = 1GB
max_wal_size = 4GB
max_worker_processes = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
max_parallel_maintenance_workers = 2

pg_ctl restart

/postgres/data/pg_hba.conf

host all all **************** md5
host all all **************** md5
host all all **************** md5

pg_ctl reload

psql

CREATE DATABASE tayfun ENCODING=’UTF-8′ LC_COLLATE = ‘tr_TR.UTF-8′ LC_CTYPE=’tr_TR.UTF-8’ TEMPLATE template0;

CREATE ROLE testuser PASSWORD ‘testuser123!’ SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;

grant connect on database tayfun to testuser with grant option;

alter database tayfun owner to testuser ;

 298 views last month,  3 views today

About tayfun inam

Computer Engineer -PostgreSql-Oracle Database Administrator I am about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 8+years experience.I have OCA,PostgreSql senior Certificates I have worked 50+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.

Leave a Reply