Skip to content

Instantly share code, notes, and snippets.

@jishanshaikh4
Created June 15, 2022 04:21
Show Gist options
  • Save jishanshaikh4/cd0bb336285f580c15b562e06c77dbcc to your computer and use it in GitHub Desktop.
Save jishanshaikh4/cd0bb336285f580c15b562e06c77dbcc to your computer and use it in GitHub Desktop.
Setup postgres in Ubuntu
# Install postgres
sudo apt update
sudo apt install postgresql postgresql-contrib
# Switch to your postgres account/user
sudo -i -u postgres
psql
OR
sudo -u postgres psql
# Create new role
sudo -u postgres createuser --interactive
Enter name of role to add: myUserName
Shall the new role be a superuser? (y/n) y
# Create new database
sudo -u postgres createdb
# Change default passwords
\password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment