Tutorial konfigurasi Mail server pada Debian 10

3 min read 6 months ago
Published on Oct 27, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through the configuration of a Mail Server on Debian 10. Before starting, ensure you have a solid understanding of DNS Server concepts, as they are crucial for setting up your Mail Server. This step-by-step guide will cover all necessary components and provide practical tips to avoid common pitfalls.

Step 1: Install Required Packages

To set up a Mail Server, you need to install essential packages. Follow these instructions:

  1. Update Your System

    • Open your terminal and run:
      sudo apt update
      sudo apt upgrade
      
  2. Install Postfix and Dovecot

    • Execute the following command to install Postfix (for sending emails) and Dovecot (for receiving emails):
      sudo apt install postfix dovecot-core dovecot-imapd
      
  3. Select Configuration Type for Postfix

    • During installation, you will be prompted to select a configuration type. Choose "Internet Site" and set your Mail Server's domain name when prompted.

Step 2: Configure Postfix

Next, configure Postfix to handle email delivery correctly.

  1. Edit the Postfix Configuration File

    • Open the Postfix configuration file:
      sudo nano /etc/postfix/main.cf
      
    • Ensure the following lines are present and correctly set:
      myhostname = your_domain.com
      mydestination = $myhostname, localhost.$mydomain, localhost
      
  2. Set Up Email Aliases

    • Add email aliases by editing the aliases file:
      sudo nano /etc/aliases
      
    • Add an alias for root:
      root: your_email@your_domain.com
      
    • Save and exit, then run:
      sudo newaliases
      

Step 3: Configure Dovecot

Dovecot needs to be configured to allow email retrieval.

  1. Edit the Dovecot Configuration File

    • Open the Dovecot configuration file:
      sudo nano /etc/dovecot/dovecot.conf
      
    • Ensure the following lines are included:
      protocols = imap
      
  2. Set Up Mail Location

    • Specify the mail location by editing:
      sudo nano /etc/dovecot/conf.d/10-mail.conf
      
    • Modify the mail location parameter:
      mail_location = maildir:~/Maildir
      

Step 4: Adjust Firewall Settings

Ensure that your firewall allows traffic on the necessary ports.

  1. Allow SMTP and IMAP Ports

    • Run the following commands:
      sudo ufw allow 25/tcp   # SMTP
      sudo ufw allow 143/tcp  # IMAP
      
  2. Enable the Firewall

    • If not already enabled, activate the firewall:
      sudo ufw enable
      

Step 5: Restart Services

After making all configurations, restart the services to apply changes.

  1. Restart Postfix and Dovecot
    • Execute the commands:
      sudo systemctl restart postfix
      sudo systemctl restart dovecot
      

Conclusion

Congratulations! You've successfully configured a Mail Server on Debian 10. Remember to test your setup by sending and receiving emails. Make sure your DNS records (MX records) are correctly configured to point to your Mail Server. For further enhancements, consider setting up SSL/TLS for secure email transmission.