Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bruceh48/ac9f7b3599dd79fa6664b7f8e342cc02 to your computer and use it in GitHub Desktop.
Save bruceh48/ac9f7b3599dd79fa6664b7f8e342cc02 to your computer and use it in GitHub Desktop.
# -- Remove existing versions of Postgresql --
sudo apt-get --purge remove postgresql\*
apt-get update && apt-get -y install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
# -- Install Postgress repository
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
apt-get update && apt-get -y install postgresql-9.6
apt autoremove
su - postgres
psql
create database DATABASENAME;
CREATE ROLE USERNAME WITH LOGIN PASSWORD 'Getting started';
ALTER ROLE USERNAME CREATEDB;
ALTER ROLE USERNAME SET client_encoding TO 'utf8';
ALTER ROLE USERNAME SET default_transaction_isolation TO 'read committed';
ALTER ROLE USERNAME SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE DATABASENAME to USERNAME;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment