Just to clarify: will you use the same domain? If yes, oleorun’s answer is good enough. If not, it would be much more harder (you would also have to update your instance’s URL and users’ inboxes URLs in the database for federation to work, probably have to unsubscribe aand resubscribe to every community on your instance and even then I’m not sure that would not lead to federation issues)