Run dist-upgrade before installation

Make sure all packages are upgraded to the newest version. Also, remove
unused packages.