Migrate Postgres to another server
Backup Original
su - postgres
pg_dumpall | gzip --best >/var/lib/postgresql/backup.sql.gz
Restore
Replace 9.4 with the version of PostgresSQL you have installed.
scp root@ORIGINAL_IP:/var/lib/postgresql/backup.sql.gz /var/lib/postgresql
su - postgres
pg_dropcluster --stop 9.4 main
pg_createcluster --locale en_US.UTF-8 --start 9.4 main
zcat /var/lib/postgresq/backup.sql.gz | psql