Please be aware that in PostgreSQL, your cluster data directory is a self-contained unit that cannot reliably be restored in parts, as per the documentation here.
Your best hope is to use the full data directory of the old server and to start a server on it, then restore from a dump of the database you get from there:
- Get a postgresql.conf that fit the configuration on the new host going (orient yourself by the files in the old - which you change here - and new data directories)
- Find out the user name of the old installation's PostgreSQL superuser - most likely postgres.
- Create this user name (UNIX user) on the new host, unless it's already there.
- Give (chown) the old data directory to that user, unless the uid matches the one on the old server.
- Configure pg_hba.conf in the old data directory to allow connections from local users to the same postgres user name (this is normally the default, but check).
- Run the old database cluster as the UNIX user with the same name as the old data directory's superuser, e.g. for user postgres:
sudo -u postgres postgres -D old_data_directory
or with su:
postgres -D old_data_directory
- dump the old database, again with the usual user name, postgres:
sudo -u postgres pg_dump -p /path/to/socket/for/old/directory database_name > dump_file.sql
becoming postgres with su analogous to above
- adapt the dump_file.sql to the new server's user names etc; create the empty database with appropriate ownership there
- scan the database into the new server:
sudo -u postgres psql -p /path/to/socket/for/new/directory new_database_name
once again, getting postgres privileges using su analogous to above
That should get you set, or at least show a good path to get there.