0% found this document useful (0 votes)
7 views2 pages

PGSQL

Uploaded by

pratik.kotecha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

PGSQL

Uploaded by

pratik.kotecha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

( PGSQL )

How to change PostgreSQL's data directory on Linux

Mar 25, 2021

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/


pgdg-redhat-repo-latest.noarch.rpm

yum install clang-devel libpq llvm-devel libicu-devel cmake-filesystem -y

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/


pgdg-redhat-repo-latest.noarch.rpm
yum -y module disable postgresql ( centos 8.5 use only command )

yum install centos-release-scl-rh


yum install postgresql13-devel-13.6 postgresql13-contrib-13.6 postgresql13-docs-
13.6 postgresql13-server-13.6 postgresql13-libs-13.6 postgresql13-13.6 -y

#rpm -Uvh libpqxx-7.7.5-10.rhel8.x86_64.rpm


#rpm -Uvh libpqxx-devel-7.7.5-10.rhel8.x86_64.rpm
#tar zxvpf pgsql13.6-4.tar.gz
#cd pgsql13.6-4

rpm -Uvh postgresql13-libs-13.6-4PGDG.rhel8.x86_64.rpm


rpm -Uvh postgresql13-13.6-4PGDG.rhel8.x86_64.rpm
rpm -Uvh postgresql13-devel-13.6-4PGDG.rhel8.x86_64.rpm
rpm -Uvh postgresql13-server-13.6-4PGDG.rhel8.x86_64.rpm
rpm -Uvh postgresql13-contrib-13.6-4PGDG.rhel8.x86_64.rpm
rpm -Uvh postgresql13-docs-13.6-4PGDG.rhel8.x86_64.rpm

postgresql-13-setup initdb

cd /var/lib/pgsql/13/data/

Add or edit the following line in your postgresql.conf

vim postgresql.conf

listen_addresses = '*'

max_connections = 2000

systemctl enable --now postgresql-13.service

su - postgres

psql

ALTER USER postgres WITH PASSWORD 'getuatuser_123';

\q

exit

Edit the following line in your pg_hba.conf

vim pg_hba.conf
# Comment the below line

#local all all peer


local all all md5

# Append the below line TYPE DATABASE USER CIDR-ADDRESS METHOD


host all all 0.0.0.0/0 md5

systemctl restart postgresql-13.service

psql -U postgres

CREATE USER getuatuser WITH SUPERUSER PASSWORD 'getuatuser_123';


CREATE USER greek_ro WITH PASSWORD '123456';
CREATE USER greek_rw WITH PASSWORD '123456';

alter user greek_ro nologin;


alter user greek_rw nologin;

grant greek_rw to getuatuser;

CREATE database gmx_2504;

GRANT CONNECT ON DATABASE gmx_2504 TO greek_ro;


GRANT CONNECT ON DATABASE gmx_2504 TO greek_rw;

-----------------------------------------------------------------------------------
----------------------------------------------------------------------------

free -h

lscpu

( check all ram , cpu, version and search crome https://pgtune.leopard.in.ua/


(pgtune) all details are fill and output copy to server paste command )

(calculate RAM & CPU )

psql -U postgres

(Password: getuatuser_123)

(COPY COMMAND PASTE )

\q

You might also like