I can give you a high-level summary - this is how I do it between dev (local) and test environments. Basically you need to transfer the database and the Flarum files. I assume you have ssh access to both hosts.
I. transfer the database:
- export database from the old host (use
mysqldump for example)
- (optional) replace all links pointing to the old host with links to the new host in the sql dump. this is only needed if the new host has a different hostname / domain name. (use
sed)
- (optional) update the email settings in the sql dump - needed only if you have a different email setup in the new host. Also, if this is a one-time migration, it's easier to do it from the Flarum admin UI.
- transfer the db dump to the new host (
rsync or scp)
- import the db on the new host ( for example
mysql -u root -p flarum_db_name < dbdump.sql)
II. copy over the files to the new host:
I recommend rsync for this task if both hosting environments provide it. The file permissions are important here. In my case the files are owned by my user and the www-data group, so this rsync command works for me:
rsync -rtzhp --chmod=ug+rwX,Dg+s -e "ssh -p${DEPLOY_PORT}" --exclude-from="${DEPLOY_SOURCE_DIR}/.deployignore" "${DEPLOY_SOURCE_DIR}" "${DEPLOY_ACCOUNT}@${DEPLOY_SERVER}:${DEPLOY_DEST_DIR}"
You can adjust the variables and run it from the old host to transfer the files.
Note that this is probably too insecure, as this sets everything writable by the web server. It should be enough to set the public and storage folders writable.
Finally everything should be set up on your target host to run Flarum - web server configs, ssl certificates etc. - see the Flarum installation guide
Hope this helps!