# run as root
root$ apt-get update && apt-get upgrade
root$ echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" >> /etc/apt/sources.list
root$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
root$ apt-get update -y
root$ apt-get install postgresql-9.5 -y
# you don't want to stay logged in as root
root$ adduser testUser
root$ usermod -aG sudo testUser
Do the rest of this guide while logged in as your new user.
In order to use postgresql, you'll need a user/password on postgres, as well as
a database. First, use su
to become the postgres
user, and
make a user on postgres
with your username:
$ sudo su - postgres
postgres$ createuser testUser
psql
launches the postgres prompt, which you'll use in order to set your
password. \q
quits the postgres prompt, returning you to the bash command
line.
postgres$ psql
postgres=> ALTER USER "testUser" WITH PASSWORD 'PASSWORD';
# outputs: ALTER ROLE
postgres=> \q
Finally, create the database while logged in as the postgres
user.
postgres$ createdb testDb
postgres$ exit
Then you can login to the database with
$ psql testDb
sudo systemctl disable postgresql
sudo systemctl enable postgresql
sudo service postgresql restart
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04
https://github.com/interledgerjs/ilp-kit/blob/master/docs/SETUP.md#get-a-server-instance
Importing a dump from google cloud:
create table, create user, check that pg_hba.conf has the auth method for user set as md5, run command
psql -U user db_name < sql_dump