fox There are a few install scripts out there, including one by me and a forked one by @webeindustry with improvements to it.
They are simple scripts that quickly setup the install of a new server.
Perhaps examine them and see the process? May give a idea of how to quickly setup flarum and adjustments you can make to it.
Mine is based on Digital Ocean as a host, but it's definitely not limited to that.