How to Install Maddy Mail Server on Debian Latest
Maddy is a mail server written in Go that aims to be simple, fast, and easy to use while providing advanced features such as SpamAssassin integration, SMTP authentication, and more.
This tutorial will guide you through the process of setting up Maddy on Debian Latest.
Prerequisites
Before we get started, you should have:
- A Debian Latest server with sudo privileges.
- A domain name set up and pointing to your server's IP address.
- Basic knowledge of the Linux command line.
Step 1: Install Go
Maddy is written in Go, so we need to install the Go programming language first.
Update your system's package list:
$ sudo apt updateInstall the
golangpackage:$ sudo apt install golang
Step 2: Download and Install Maddy
Clone the Maddy repository from GitHub:
$ git clone https://github.com/foxcpp/maddy.gitChange into the
maddydirectory:$ cd maddyBuild the Maddy binary:
$ go buildMove the
maddybinary to/usr/local/bin:$ sudo mv maddy /usr/local/bin/
Step 3: Configure Maddy
Create a new configuration file for Maddy:
$ sudo nano /etc/maddy/maddy.confCopy and paste the following configuration into the file:
log_file = "/var/log/maddy.log" [submission] bind = ":587" auth = "on" starttls_only = "yes" [mx] bind = ":25" relaying = "permit_any"This configuration configures Maddy to listen on port 587 for submission (SMTP with authentication) and port 25 for incoming messages (MX).
Save and close the file.
Create a log directory for Maddy:
$ sudo mkdir /var/log/maddySet permissions on the log directory:
$ sudo chmod 755 /var/log/maddyCreate a user and group for Maddy:
$ sudo useradd -r maddy -s /bin/falseSet permissions on the Maddy binary:
$ sudo chown root:maddy /usr/local/bin/maddy $ sudo chmod 750 /usr/local/bin/maddy
Step 4: Configure DNS records
Add an A record for your domain name that points to your server's IP address.
Add an MX record for your domain name that points to your server's A record.
Step 5: Start and Enable Maddy
Start the Maddy service:
$ sudo systemctl start maddyEnable the Maddy service to start on boot:
$ sudo systemctl enable maddy
Step 6: Test the Mail Server
Send a test email to your server:
$ echo "This is a test message." | mail -s "Test Message" [email protected]Check the Maddy logs for any errors:
$ sudo tail -f /var/log/maddy.logIf everything is working correctly, you should see a message similar to:
2021/12/01 12:22:11 [smtp,maddy.domain.com:587] 220 maddy.domain.com maddy ESMTP (Maddy)
Congratulations! You have successfully installed Maddy and configured it to send and receive emails on your domain.