Add retries to install scripts

This'll retry install script three times before actually failing. Useful if there are network timeouts or similar issues (see travis-ci/travis-ci#1089 and travis-ci/travis-ci#1077).