Replaces the shell-based subprocess call with list-based arguments and separate invocations for 'apt-get update' and 'apt-get install'. This eliminates the risk of command injection by avoiding shell interpretation and properly handles the DEBIAN_FRONTEND environment variable via sudo.