Add some cleanup, combine some steps

add several cleanup steps, and combine several steps so that caching doesn't cause bad incrementality (e.g. if apt-get update is cached, then apt-get install could fail)