Skip to content

Instantly share code, notes, and snippets.

@yaodong
Last active August 29, 2015 14:05
Show Gist options
  • Save yaodong/b4f7b914ce2b6c00ee80 to your computer and use it in GitHub Desktop.
Save yaodong/b4f7b914ce2b6c00ee80 to your computer and use it in GitHub Desktop.
Install PostgreSQL on Ubuntu 14.04

update every time

sudo apt-get update
sudo apt-get dist-upgrade

install prefer apt-get

sudo apt-get install postgresql postgresql-contrib postgresql-clien

switch to psql console

sudo su - postgres
psql # under user posgres

user postgres is created by postgresql with no password, DO NOT change it by sudo passwd postgres.

http://serverfault.com/questions/110154/whats-the-default-superuser-username-password-for-postgres-after-a-new-install

change password for postgres

# sudo su - postgres psql
\password postgres

create a new user and db for your application

# sudo su - postgres psql
create user USER_NAME with password 'PASSWORD';
create database DB_NAME;
grant all privileges on database DB_NAME to USER_NAME;

you should read this:

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