Installing PostGreSQL database on Microsoft Azure Virtual Machine


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] 

    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!


One thought on “Installing PostGreSQL database on Microsoft Azure Virtual Machine

  1. Im a student at Hack Reactor and this was awesome! Although, ssh “azureuser”@”DNS-Name” wasn’t enough for me, since I used a SSH certificate. The code for that would be

    ssh -i ./”someKey”.key “azureuser”@”DNS-Name” -p22

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s