Adding gaurds around "sudo apt-get" so it is not executed if packages are already installed.