Installasi Postgresql 12 Pada Linux Debian 10

Assalamualaikum,Wr,Wb

Mari Kita Mulai,


Silahkan Update Terlebih dahulu :

sudo apt update

Kemudian Upgrade 


sudo apt -y upgrade

Mulai Installasi :

sudo apt -y install gnupg2 

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list 
sudo apt update
sudo apt -y install postgresql-12 postgresql-client-12

Cek Status Installasi :

systemctl status postgresql.service
systemctl status postgresql@12-main.service

Kemudian Enable Postgresql :
 systemctl is-enabled postgresql

Masuk ke Postgresql , membuat Password user Postgres , membuat database :

sudo su - postgres
psql -c "alter user postgres with password 'silahkan_isikan_password_anda'"
psql
postgres=# \conninfo
postgres=# CREATE DATABASE database_anda;
postgres=# CREATE USER user_untuk_database WITH ENCRYPTED PASSWORD 'password_user_database'; 
postgres=# GRANT ALL PRIVILEGES ON DATABASE database_anda to user_untuk_database; 
postgres=# \l
postgres-# \c database_anda
Remote Connection Postgresql :

pico  /etc/postgresql/12/main/postgresql.conf
listen_addresses = '*'
pico  /etc/postgresql/12/main/pg_hba.conf

host    all             all             0.0.0.0/0            md5


sudo systemctl restart postgresql

Demikian Installasi Postgresql Pada Debian 10

Terimakasih,

Wassalamualaikum,Wr,Wb

Share: