Skip to content

Instantly share code, notes, and snippets.

@jose8a
Last active March 1, 2016 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jose8a/55dae50e23ee38565447 to your computer and use it in GitHub Desktop.
Save jose8a/55dae50e23ee38565447 to your computer and use it in GitHub Desktop.
#!/bin/bash
### System upgrade and PG Install
#```
sudo apt-get update
#sudo apt-get dist-upgrade
sudo apt-get install postgresql postgresql-contrib
#```
### Switch to User Postgres and
### ... change postgres user default password and perms
#```pg
# $> sudo -u postgres psql
# postgres=> alter user postgres password 'apassword';
# postgres=> create user yerusername createdb createuser password 'somepass';
# postgres=> create database yerusername owner yerusername;
# postgres=> \q
# $>
#```
### ... now as your regular user 'yerusername' you can connect to postgres, and
### ... have the privileges to create new users and databases.
###
### ... That sequence also modified the postgres user's password in case you
### ... change the default authentication method to md5 (this is set in
### ... pg_hba.conf, see the documentation for more details)
### Editing server configs ... then restarting server to allow changes to take effect
#```
sudo /etc/init.d/postgresql reload
sudo /etc/init.d/postgresql restart
#```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment