This is the basic jist of how to get it working but there’s a far easier way to do this on many hosts. I for one automated the process by creating a payload package, a deployment script and setup ssh keys.