Recover ancient versions of postgresql
Take a backup of the entire data directory for each.
Reinstall the version of postgresql you need
Point its data directory at your existing one


If you are running a packaged version of postgresql then there might be nothing to do for 3