Skip to content

Instantly share code, notes, and snippets.

@jadercorrea
Created May 9, 2016 13:38
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jadercorrea/bd9c21067ae590059e9fb152b4a1387b to your computer and use it in GitHub Desktop.
Save jadercorrea/bd9c21067ae590059e9fb152b4a1387b to your computer and use it in GitHub Desktop.
Postgres install commands for Elementary OS
Postgres
$ sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
$ wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-common
$ sudo apt-get install postgresql-9.3 libpq-dev
$ sudo -u postgres createuser username -s
Acessar postgres:
$ sudo -u postgres psql
Mudar senha:
postgres=# \password username
Sair:
\q
@anwar1211
Copy link

sorry why my postgresql haven't installed?,permission I is still the beginner and maybe what from my network or data update is old?

@KanagawaMarcos
Copy link

stills works like charm. (Elementary OS Juno)

@jadercorrea
Copy link
Author

stills works like charm. (Elementary OS Juno)

Glad to hear that, @marcos-costa.

@Krishnakp12
Copy link

Worked perfectly for me thank you so much @jadecorrea just a small doubt where do we enter for username and password

@e184439
Copy link

e184439 commented Jan 25, 2023

Had to do a bit of modification to the commands to work in elementary OS 6.1 Jólnir.

  1. Replaced precise to focal (Ubuntu 20.04 LTS):

sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main' > /etc/apt/sources.list.d/pgdg.list"

  1. Replaced postgresql-9.3 to postgresql-9.6 (version latest i see at the time of writing)

sudo apt-get install postgresql-9.6 libpq-dev

Every other command is the same.

@kancilciliq
Copy link

thanks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment