Update install ubuntu script

Add more error checking
Functionize