Linux Mail Servers - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Linux Mail Servers Guide

Complete beginner-friendly guide to mail servers on Linux, covering Arch Linux, CachyOS, and other distributions including Postfix, Dovecot, and mail server configuration.


Table of Contents

  1. Postfix Setup
  2. Dovecot Setup
  3. Mail Server Configuration
  4. Troubleshooting

Postfix Setup

Install Postfix

Install Postfix:

# Arch/CachyOS
sudo pacman -S postfix

# Enable service
sudo systemctl enable --now postfix.service

Debian/Ubuntu:

sudo apt install postfix

Fedora:

sudo dnf install postfix

Configure Postfix

Edit config:

# Edit main config
sudo vim /etc/postfix/main.cf

Settings:

myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain

Dovecot Setup

Install Dovecot

Install Dovecot:

# Arch/CachyOS
sudo pacman -S dovecot

# Enable service
sudo systemctl enable --now dovecot.service

Debian/Ubuntu:

sudo apt install dovecot-core dovecot-imapd

Fedora:

sudo dnf install dovecot

Configure Dovecot

Edit config:

# Edit config
sudo vim /etc/dovecot/dovecot.conf

Mail Server Configuration

Test Mail Server

Test sending:

# Send test email
echo "Test" | mail -s "Test Subject" [email protected]

Troubleshooting

Mail Not Sending

Check logs:

# Postfix logs
journalctl -u postfix

# Dovecot logs
journalctl -u dovecot

Summary

This guide covered mail servers for Arch Linux, CachyOS, and other distributions, including Postfix and Dovecot.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.