How to Install WildDuck on NixOS Latest
This tutorial will guide you through how to install WildDuck on NixOS Latest.
Prerequisites
- Root access to a NixOS Latest system.
- A domain name and access to your DNS records.
Step 1. Update your system
Before installing WildDuck, we need to ensure that the system is up-to-date:
sudo nix-channel --update
sudo nixos-rebuild switch
Step 2. Install WildDuck
Install WildDuck by adding the following to your configuration.nix file:
services.wildduck = {
enable = true;
mx = ["mail.example.com"];
sessionStorageDir = "/var/lib/wildduck/sessions";
MAIL_DOMAIN = "mail.example.com";
WEB_DOMAIN = "webmail.example.com";
ADMIN_ADDRESS = "[email protected]";
dkim = {
enable = true;
selector = "default";
privateKeyPath = "/etc/ssl/private/dkim.key";
publicKeyPath = "/etc/ssl/private/dkim.pub";
};
};
Save and exit the file. Then, rebuild the system configuration using the command below:
sudo nixos-rebuild switch
Step 3. Configure DNS records
Before WildDuck can send and receive emails, we need to configure DNS records.
Create an A record for your mail server, pointing to the IP address of your NixOS system:
mail.example.com IN A 192.0.2.1
Create a MX record for your domain pointing to the A record we created:
example.com IN MX 1 mail.example.com
Create TXT records for SPF, DKIM, and DMARC:
example.com IN TXT "v=spf1 mx ip4:192.0.2.1 -all"
default._domainkey.example.com IN TXT "v=DKIM1; k=rsa; p=<public key>"
_dmarc.example.com IN TXT "v=DMARC1; p=none;"
Step 4. Restart services
Once you have added the DNS records, restart the services to apply the changes:
sudo service wildduck restart
WildDuck email server should now be installed and ready to use. You can access the webmail server by visiting https://webmail.example.com in your preferred web browser.