I'm running apache2 on Ubuntu Server 12.04 and I have my website up and running fine with 2 virtual hosts, and I was wondering how I can set up my server to also be a mail server, preferable for both domains (virtual hosts.) I have tried following postfix/dovecot guides but none of them seem to work, but that may be because I don't know which DNS records to modify, right now they're the default GoDaddy parked records, aside from @ and a few other CNAME records I changed for subdomains. If anyone could tell me what programs to install (or direct me to a tutorial) as well as what DNS records (MX,CNAME) to modify that would be awesome
Apache is specifically a web server. And since it runs on port 80, you can use any other ports you like for other services. For example, you can install a DNS server like BIND which will occupy port 53. In your case of a mail server, you can install PostFix among others [link]. Setting up a mail server can be simple or complicated, depending on what kind of flexibility you desire. [This] is a tutorial for DoveCot, another mail delivery system. I would advise you to read how mail servers work, and specifically focus on making it as secure and lightweight as possible. For example, if incorrectly configured, one could hijack your server to send spam.