How To Install Postgres on Ubuntu 20.04

How To Install Postgres on Ubuntu 20.04

  1. Update and install postgres
sudo apt update -y && sudo apt install -y postgresql postgresql-contrib
  1. Start the postgres service
sudo service postgresql start
  1. Connect to the Postgres prompt psql command as the postgres account directly with sudo:
sudo -u postgres psql
  1. Once in psql you can change password for default role postgres:
\password postgres
  1. To exit psql, type:
\q

Share Now 👇