preinstall.sh and Amazon Linux AMI

The preinstall.sh doesn't work with Amazon Linux AMI, so I added that functionality.