PostgreSQL 16 Installation pada Ubuntu 22.04
Super Admin 03-02-2024 409 Tutorial
cara mudah untuk install postgres sql versi 16 di ubuntu 22 :
sudo apt update
sudo apt install gnupg2 wget vim
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
sudo apt update
sudo apt install postgresql-16 postgresql-contrib-16
sudo systemctl start postgresql
sudo systemctl enable postgresql
kemudian edit file dan ganti listen address menjadi *
sudo nano /etc/postgresql/16/main/postgresql.conf
listen_addresses = '*'
jalankan perintah :
sudo sed -i '/^host/s/ident/md5/' /etc/postgresql/16/main/pg_hba.conf
sudo sed -i '/^local/s/peer/trust/' /etc/postgresql/16/main/pg_hba.conf
echo "host all all 0.0.0.0/0 md5" | sudo tee -a /etc/postgresql/16/main/pg_hba.conf
Kemudian ganti password postgres :
sudo -u postgres psql
ALTER USER postgres PASSWORD 'VeryStronGPassWord@1137';