Add a try to install_prerequisites ping checks

Sometimes the ping -c1 `hostname -s` fails, but when ssh to the machine
and running the same command it works. Add another try after 5 seconds
if the ping check fails.
Backticks are deprecated. Use `$(...)` instead.