postgreSQL - ThuyNT13/my_setup GitHub Wiki

Install postgreSQL

Get packages:

sudo apt-get install postgresql libpq-dev

Install gem:

gem install pg

Check that postgreSQL installed:

pg -V

Setup PostgreSQL user role

To start off, sudo to su (Superuser/root) and as superuser access postgres:

user@ $ sudo su
root@ # su postgres

From postgres command prompt, enter code to create user:

postgres@ $ createuser thuy -d -s -r

Exit from postgres and from su:

postgres@ $ exit
root@ # exit

PostgreSQL code explanation:

  • -d = can create new databases
  • -s = superuser
  • -r = can create new roles)

Note that you will most certainly want superuser privileges in order to disable referential integrity and other issues that can pop up.


References