In case of Lemmy I used Lemmy-Easy-Deploy script. To host I used Oracle Cloud always free tier. Its risky because I’ve heard people say that since its free they can just pull the plug at any time, so you might consider to upgrade it to paid account, I heard its cheap. About requirements I have no idea. Im running my on a VM instance with Ubuntu minimal 22.04 aarch64. I pushed it to the maximum allowed for free account: 4 ARM cpu with 24Gb of Ram. I dont know anything about hosting mastodon.
Would be great if they did not get money from google. They could set.up a donations program or something and regularly ask for it like Wikipedia. Donation based browser, peoples Browser.