Fix #1517, #1521 by adding sudo to examples and installation.

Also some minor formatting, wrapping long lines, etc. But mostly adding ``sudo`` where appropriate.