Arch wiki mail server
Here's a basic guide to setting up a mail server using Arch Linux:
Prerequisites
- A fresh install of Arch Linux
- A static IP address for your server
- A domain name (optional, but recommended)
Step 1: Install required packages
Install the following packages:
sudo pacman -S postfix dovecot procmail
Step 2: Configure Postfix
Edit the Postfix configuration file:
sudo nano /etc/postfix/main.cf
Add the following lines to the end of the file:
mydestination = example.com
myhostname = mail.example.com
myorigin = $myhostname
Replace example.com
with your domain name.
Step 3: Configure Dovecot
Edit the Dovecot configuration file:
sudo nano /etc/dovecot/dovecot.conf
Add the following lines to the end of the file:
mail_location = maildir:~/Maildir
first_valid_uid = 500
first_valid_gid = 500
Step 4: Configure Procmail
Edit the Procmail configuration file:
sudo nano /etc/procmailrc
Add the following lines to the end of the file:
:0
* ^X-No-Archive:.*
This will prevent emails from being archived.
Step 5: Start and enable services
Start the Postfix and Dovecot services:
sudo systemctl start postfix
sudo systemctl start dovecot
Enable them to start automatically on boot:
sudo systemctl enable postfix
sudo systemctl enable dovecot
Step 6: Configure DNS
If you have a domain name, you'll need to configure your DNS settings to point to your mail server. You can do this by creating a TXT record with your DNS provider.
Step 7: Test your mail server
Use a tool like telnet
to test your mail server:
telnet mail.example.com 25
Replace mail.example.com
with your mail server's hostname.
Step 8: Set up email clients
You can now set up email clients like Thunderbird or Outlook to connect to your mail server.
Additional tips
- Make sure to secure your mail server by setting up SSL/TLS certificates and configuring firewall rules to only allow incoming connections on port 25.
- Consider using a webmail interface like Roundcube or SquirrelMail to manage your email accounts.
- You may need to configure additional settings depending on your specific use case (e.g., spam filtering, virus scanning, etc.).
That's it! With these steps, you should have a basic mail server up and running on Arch Linux.