This guide covers mail server Ubuntu step by step, with every setting in the order you will use it. Postfix is the standard mail server on Linux: fast, secure by default, and the reason most of the internet’s mail runs on it. In a lab it teaches the fundamentals of SMTP, and in production it can both send and receive real mail. This guide installs it on Ubuntu Server.

dns LAB TOPOLOGY & PREREQUISITES
# example values used while writing and testing this guide
LAB VM
UBUNTU BUILD
VALIDATION
01constructionMail server Ubuntu: Step 1: Install Postfix
Update packages and install; the installer asks for the mail configuration type:
sudo apt update && sudo apt install postfix -y
Choose Internet Site (sends and receives directly) for a lab, and set the system mail name — your domain, for example lab.local. Skip the wizard options and you can always rerun it later with sudo dpkg-reconfigure postfix.
02downloadStep 2: Understand the Main Settings
Postfix’s configuration lives in /etc/postfix. The key values in main.cf:
myhostname— this server’s name, likemail.lab.localmydomainandmyorigin— the domain used on outgoing mailmydestination— domains this server accepts mail for locallymynetworks— hosts allowed to relay through this server; keep it to your lab subnetinet_interfaces— which network interfaces it listens on
After any edit, validate and reload: sudo postfix check && sudo systemctl reload postfix. In short, mail server Ubuntu works best when you follow the order above and verify each step.
03usbStep 3: Test Sending Mail
Install a mail utility and send a test:
sudo apt install mailutils -y
echo "Test body" | mail -s "Lab test" user@lab.local
Read the local delivery with the mail command, and watch the log at /var/log/mail.log — every SMTP conversation is logged there, which makes it the best debugging tool you have.
04terminalStep 4: Real-World Notes
Receiving mail from the internet needs port 25 open, a static IP, correct MX records in DNS (see the Ubuntu DNS guide) and matching reverse DNS. Most ISPs block residential port 25, so labs usually pair Postfix with a smart host for outbound delivery. For full mailbox service add Dovecot (IMAP/POP3). Compare with the Windows Server SMTP setup. In short, mail server Ubuntu works best when you follow the order above and verify each step.
Related Content
How to Install and Configure a Database Server in Ubuntu (MySQL/MariaDB)
Finish this lab, then continue down the track. Each guide builds on the one before it.