How To Install Postgres on Ubuntu 20.04

Published on 26 November 2020 12:00 AM
This post thumbnail
  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