* You can do the key fetch, populate both apt sources.list.d files, then do a single `apt-get update && apt-get install --yes` rather than 3 updates and 4 installs.
* You're using both `apt` and `apt-get` and only using `--yes` once (obviously fixed by taking the previous point, but while I'm mentioning things...)
* If all but the last two steps use sudo, maybe consider just making the first step `sudo su` and then `exit` when you're done (very context dependent, but does let you skip needing `sh -c` to populate files)
None of this is anything against you, just some possible improvements to have fewer steps and general stuff I'd mention in a normal code review. And full marks for, y'know, actually documenting it at all and sharing:)