Halo, saya akan menjelaskan cara install postgresql 12 di Centos 7. Dan cara membuat database postgresql dijelaskan di bawah ini.
—————-postgresql single-instance instalasi————————-
paket repo
#yum install centos-release-scl-rh
# yum install llvm-toolset-7-clang
************************************************** ********************************
# yum install -y epel-release
# yum install llvm5.0-devel
*************************instalasi perangkat lunak postgresql************************* *********
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
# Dapatkan alias dan fungsi
if [ -f ~/.bashrc ]; lalu
. ~/.bashrc
fi
# Lingkungan khusus pengguna dan program startup
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PATH:/usr/pgsql-12/bin/
ekspor PGDATA=/postgres/data
ekspor PGUSER=postgres
ekspor PGDATABASE=postgres
ekspor PGPORT=5432
ekspor PGLOCALDIR=/usr/pgsql-12/share/locale
ekspor PATH
************************************************** ****************************
initdb -D /postgres/data
status pg_ctl
pg_ctl stop
pg_ctl start
# Versi DB:12
# Jenis OS:linux
# Jenis DB:web
# Total Memori (RAM):32 GB
# Jumlah CPU:4
# Nomor koneksi:500
# Penyimpanan Data:hdd
listen_addresses ='*'
port =5432
max_connections =500
shared_buffers =8GB
efektif_cache_size =24GB
maintenance_work_mem =2GB
checkpoint_completion_target =0,7
wal_buffers =16MB
default_statistics_target =100
random_page_cost =4
efektif_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 mulai ulang
/postgres/data/pg_hba.conf
host semua semua **************** md5
host semua semua ************* md5
host semua semua **************** md5
pg_ctl muat ulang
psql
CREATE DATABASE tayfun ENCODING='UTF-8′ LC_COLLATE =‘tr_TR.UTF-8′ LC_CTYPE='tr_TR.UTF-8' TEMPLATE template0;
BUAT PASSWORD pengguna penguji PERAN ‘testuser123!’ PENGGUNA SUPER CREATEDB LOGIN INHERIT CREATEROLE;
grant connect di database tayfun ke testuser dengan opsi grant;
ubah pemilik database tayfun menjadi testuser;