sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common postgresql-9.4 postgresql-contrib-9.4 libpq-dev
psql --version
sudo -u postgres createuser -P <your_username>
sudo -u postgres createdb -O <your_username> <name_of_your_database>
psql -h localhost -U <your_username> <name_of_your_database>
If all works well, you should see output like:
psql (9.4.15)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
test-database=>
Type \q
to quit.
Posted by hashharvest to Rails CheatSheets (2017-11-17 07:57)