I set up ejabberd maybe 15 or so years ago without any issues. Not sure about ... more recent software. But since we're in the containerization era I assume it has become easier.
Matrix was an experience, though. But it happily runs in my environment using the Synapse server and Cinny for desktop and Element X on mobile.