How to Set up a PostgreSQL Database on Azure

Log in to you azure account
Select new -> compute -> virtual machine -> from galley

Select Ubuntu -> Ubuntu Server 14.04LTS
Select a name, user and password and select create

Once created follow these instructions to open up your endpoints and connect via putty

Now that you are connected connected to your VM type the following on Putty’s console:

sudo apt-get update
sudo apt-get install postgresql
sudo apt-get install postgresql-contrib

Now let’s create an user and assign a password:

sudo -u postgres createuser --superuser <someuser> -P

Not lets set up you’re your server to allow for outside IP connections as long as it matches the login and password. To open the file type:

sudo nano /etc/postgresql/9.3/main/pg_hba.conf

Now add the following line to the bottom of the file Make sure that there is no # symbol in front of the word host:

host    all all md5

Now let’s allow for remote connections. In order to open the file type:

sudo nano /etc/postgresql/9.3/main/postgresql.conf 

uncomment(remove the # symbol) and change the listen_addresses line to the following:

listen_addresses = '*'

restart your postgres server and you are now connected

sudo service postgresql restart