Skip to content

Instantly share code, notes, and snippets.

@ehsanatwork
Last active Aug 27, 2021
Embed
What would you like to do?
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