Also, Element is just some JavaScript in your browser or electron shell, there's no need to self-host it really, although you can (just put some HTML+CSS+JS up on a webserver) — you want to self-host Synapse, and that's trivial to do (there's a Debian package, a Docker image and so on).