This is the best/simple method.
sudo apt-get install postfix
That's it a mail server is installed.
Now administrating that mail server is a whole different story.
By default postfix will deliver and relay for all local user accounts. That should get you started. If you want something more complex then you REALLY REALLY need to read, study, learn, apprentice, etc. Mail servers are very very complex to setup correctly. Even when setup correctly they take constant supervision and monitoring. If your doing anything more then local delivery then I 100% recommend that you do not setup your own mail server.
Do not forget to setup DNS and SPF records if your going to be sending emails to non-local addresses. This is a bare minimum and will not result in deliverable mail to most ISPs.
Again, I strongly urge you to read, and fully understand what you are doing before you even attempt to run a public mail server. Keep in mind, that (at least in the US) you can be fined per email, for emails sent from your server incorrectly. This is rare but has happened. A more common effect is that you get blacklisted, shunned, and marked as a generally evil person and are banned from ever running an email server again (this happens quite frequently).
If your going to run a public server make sure you speak with your ISP/Hosting first. You will need, at a minimum a static IP and their permission. Most ISPs will block you 100% from every getting back on the internet for running an incorrectly configured mail server for an extended period of time.
I add all these warnings so that you know, local delivery, intranet delivery, your fine. Remote delivery, know what you are doing before you even attempt it. Incorrectly configured mail servers can bring on a whole world of disaster if not handled correctly.