Skip to content

Instantly share code, notes, and snippets.

@3h5a9
Last active August 27, 2021 08:40
Show Gist options
  • Save 3h5a9/f9e388509335e618f50273540d518ae9 to your computer and use it in GitHub Desktop.
Save 3h5a9/f9e388509335e618f50273540d518ae9 to your computer and use it in GitHub Desktop.
Install PostgreSQL latest version on Elementary OS
Install
------------------
sudo apt-get install curl ca-certificates gnupg && curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update && sudo apt-get install postgresql-12
Create a new user
------------------
sudo -u postgres createuser -D -A -P username
Create database
------------------
sudo -u postgres createdb --owner=username databasename
Accessing PostgreSQL
------------------
sudo -u postgres psql
Change user to SUPERUSER
------------------
ALTER USER username WITH SUPERUSER;
SOURCE: [https://computingforgeeks.com/install-postgresql-12-on-ubuntu/]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment