Skip to content

PostgreSQL Notes Linux

[1] Install PostgreSQL on Ubuntu 20.04

  • Run sudo apt update
  • Run sudo apt install postgresql postgresql-contrib
  • After the installation is complete you can access postgres by running sudo -i -u postgres.

[2] Create User

  • Run sudo -u postgres createuser --interactive
  • Enter the password
  • Make the user the name name as your ubuntu user
  • Choose "Y" for superuser
  • Now you can run psql postgres to access the postgres CLI (this brings up the postgres database itself).

[3] Install pgAdmin

  • Create the file pgdg.list in /etc/apt/sources.list.d/
  • Add this to the file: deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main
  • Run sudo apt-get update
  • Run sudo apt-get install pgadmin4
  • create a master password for pgAdmin4

wiki.postgresql.org