It would be faster to compile software with the -j4 parameter on make using multicore systems (Pi 2, 3). Checking if commands are successfully executed before continuing with the installation process will reduce unsuccessful installations due to errors.
PS: No need for forever, the server can be wrapped in a while true statement.