Postgresql

Setup Postgresql On Ubuntu

Posted by Weston Ganger on April 27, 2014

First get latest postgresql info and install


sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release --codename | cut -f2)-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib libpq-dev

After this is done you can setup your user in psql:


# create psql superuser with current username
sudo -u postgres createuser --superuser $USER
sudo -u postgres psql

In the psql prompt set the password for the new user:

\password your-username

create a db with the name of the current user:

sudo -u postgres createdb $USER

Now you can connect to the database using just "psql" instead of having to type "psql postgres"


Related External Links:


Posted in Linux and Tagged with ubuntu postgresql database 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts