I followed installation instructions from the following source :
https://docs.moodle.org/26/en/Step-by-step_Installation_Guide_for_Ubuntu#Step_2:_Install_Apache.2FMySQL.2FPHP
Everything was working fine but install script was not able to create config.php in '/var/www/moodle/' folder. I had set the permissions for the folder as 0777