14.Linux Postfix Mail Server
Source: Dev.to
Lab Information
xFusionCorp Industries plans to set up a common email server in Stork DC. After several meetings and recommendations they have decided to use Postfix as their mail transfer agent and Dovecot as an IMAP/POP3 server. The tasks are:
- Install and configure Postfix on the Stork DC mail server.
- Create an email account
anita@stratos.xfusioncorp.comwith the passwordLQfKeWWxWD. - Set its mail directory to
/home/anita/Maildir. - Install and configure Dovecot on the same server.
Lab Solutions
Part 1: Lab Step‑by‑Step Guidelines
Objective
On the mail server (stmail01):
- Install Postfix
- Create email user anita
- Configure mailbox location
- Install and configure Dovecot
Server Access
# 1️⃣ Login to Jump Host
ssh thor@jump_host.stratos.xfusioncorp.com
# Password: mjolnir123
# 2️⃣ Connect to Mail Server
ssh groot@stmail01
# Password: Gr00T123
# 3️⃣ Switch to root
sudo -iInstall Postfix
yum install -y postfix
systemctl start postfix
systemctl enable postfixCreate User anita
useradd anita
passwd anita
# Enter password: LQfKeWWxWDCreate Mail Directory
mkdir -p /home/anita/Maildir
chown -R anita:anita /home/anita/MaildirConfigure Postfix Mailbox Location
Edit /etc/postfix/main.cf and add the line:
home_mailbox = Maildir/Save and exit, then restart Postfix:
systemctl restart postfixInstall Dovecot
yum install -y dovecotConfigure Dovecot Mail Location
Edit /etc/dovecot/conf.d/10-mail.conf and set:
mail_location = maildir:~/MaildirSave and exit.
Start and Enable Dovecot
systemctl start dovecot
systemctl enable dovecotVerify Services
systemctl status postfix
systemctl status dovecotBoth should show active (running).
Part 2: Simple Explanation (Beginner Friendly)
What this lab builds
You are setting up a basic Linux mail server with two main components:
| Component | Purpose |
|---|---|
| Postfix | Mail Transfer Agent (receives and delivers mail) |
| Dovecot | IMAP/POP3 server (allows users to read mail) |
Mail Flow Example
User sends mail → Postfix delivers to mailbox → Dovecot provides access via IMAP/POP3.
Mail Storage Format
| Format | Description |
|---|---|
| Maildir | Preferred because it is faster, safer, and better for concurrent access |
The mailbox for user anita is located at:
/home/anita/MaildirPostfix stores incoming mail in the Maildir/ folder (e.g., /home/anita/Maildir/new). Dovecot reads from this location to serve the user’s email.