As long as you know Docker, this is pretty much what you are asking: https://github.com/tomav/docker-mailserver.
I use it in combination with the rainloop webmail client: https://github.com/jprjr/docker-rainloop.
Everything is configured with a single docker-compose, read about it here: https://news.ycombinator.com/item?id=11748036