Install dependencies first

Unfortunately, even updating the cache requires the libraries to be in place so we'll have to install them first, meaning we assume there is a sane and working apt cache/configuration in place to start with.