Installing PostGreSQL database on Microsoft Azure Virtual Machine

azure_logo

Login to Microsoft Azure.

Create a new virtual machine

  1. Click on the ‘+ New’ in the lower left corner
  2. Select Compute -> Virtual Machine -> From Gallery
  3. Tab 1: Use an Ubuntu 12.04 LTS image
  4. Tab 2: Keep default settings, type in ‘Virtual Machine Name’ and a password (I didn’t use the SSH certificate)
  5. Tab 3: Keep default settings, change region, choose a DNS name and create a TCP endpoint called ‘postgres’ (port #’s don’t matter)
  6. Tab 4: Nothing to change here, click the checkmark and wait a few minutes for azure to do its magic (grab some tea from Punjab Kebab!)

SSH into the virtual machine

  1. Open up terminal
  2. type in:
     ssh azureuser@[DNS-Name].cloudapp.net 

    and enter your password

You are now inside your virtual machine!

Now we need to install PostGreSQL on your virtual machine

Type in a few commands:

sudo apt-get install postgresql
sudo apt-get install postgresql-9.1-postgis
sudo apt-get install postgresql-contrib

To get  into your database type

 sudo -u postgres psql postgres 

And that’s it, now you can write psql commands to create tables for your database!