You should know your way around Linux (if you already know Ubuntu, you can use it on the server as well).
You need some software: - For receiving and routing mails: I use postfix - For authenticating: Dovecot - For serving mails via IMAP: Dovecot is a popular choice
There are some good guides on the net how to set up these on Ubuntu or Debian (which is pretty similar), just google for e.g. "postfix ubuntu".
It's critical that the mail you route arrives at the other end, so you must prevent spammers from abusing your systems. Otherwise you get blacklisted. As a start you need to implement state-of-the-art things like: SPF, DKIM, DMARC. MTA-STS, TLS-RPT are also useful. None of these are hard and there are also good tutorials out there, it's just a bit of work.