How to Set Up Citadel Mail Server: A Complete Step-by-Step Guide

Introduction

Citadel is a powerful, open-source mail server that includes email, calendaring, contacts, and collaboration features. It is simple to install and requires minimal configuration. This guide will walk you through the Citadel mail server setup on a Linux-based VPS or dedicated server.

Prerequisites

Before starting, ensure you have the following:

  • A VPS or dedicated server (Recommended: 2GB RAM, 1 vCPU, and 20GB SSD)
  • A fresh installation of Ubuntu 20.04 or later
  • A fully qualified domain name (FQDN) (e.g., mail.yourdomain.com)
  • Root access to the server
  • Valid DNS records (MX, A, SPF, and DKIM records).

Configure DNS Records

TypeHostValue
A@Your IP address
AmailYour IP address
MX@mail.yourdomain.com 10
TXT@v=spf1 a mx ip4:138.68.14.182 ~all
TXT_dmarc“v=DMARC1;p=none;sp=none;pct=100;adkim=r;aspf=r;rua=mailto:[email protected];ruf=mailto:[email protected];ri=86400;fo=1”

Step 1: System Update

First, update and upgrade your system packages:

sudo apt update && sudo apt upgrade -y

Step 2: Set Hostname

Set your system’s hostname to match your domain:

sudo hostnamectl set-hostname mail.yourdomain.com

Verify it:

hostname -f

Step 3: Install Citadel

Citadel provides an easy installation script. Run the following command:

wget -q -O - https://easyinstall.citadel.org/install | bash

This script will install Citadel and its dependencies automatically.

Step 4: Manage Citadel Service

After installation, start and enable the Citadel service:

sudo systemctl start citadel
sudo systemctl enable citadel

You can also stop or restart Citadel if needed:

sudo systemctl stop citadel
sudo systemctl restart citadel

Step 5: Configure Firewall

Allow necessary ports through the firewall:

sudo ufw allow 25,143,993,110,465,587,80,443/tcp 
sudo ufw enable

Step 6: Install Certbot for SSL/TLS

To secure your Citadel server with Let’s Encrypt, install Certbot:

sudo apt install certbot -y

Step 7: Obtain Let’s Encrypt Certificate

Obtain a certificate for your domain. Replace ${HOSTNAME} with your actual domain (e.g., mail.yourdomain.com):

certbot certonly --agree-tos --non-interactive --text --rsa-key-size 4096 \
    --email admin@${HOSTNAME} \
    --webroot --webroot-path /usr/local/webcit \
    --domains ${HOSTNAME}

This command uses the webroot method, pointing to WebCit’s document root /usr/local/webcit so Certbot can complete the HTTP-01 challenge.

Let’s Encrypt saves certificates in /etc/letsencrypt/live/${HOSTNAME}/. Create symbolic links so Citadel can use them:

ln -sfv /etc/letsencrypt/live/${HOSTNAME}/privkey.pem  /usr/local/citadel/keys/citadel.key
ln -sfv /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem /usr/local/citadel/keys/citadel.cer

Step 9: Restart Citadel

Restart Citadel to load the new SSL/TLS certificates:

sudo systemctl restart citadel

Step 10: Access Citadel Web Administration Panel

Once Citadel is installed, you can access the WebCit interface for configuration and user management.

  1. Open your browser and visit: http://your-server-ip
  2. Log in with the default admin credentials (created during installation).
  3. Configure domain settings, user mailboxes, and email routing.

Step 11: Configure Email Clients

You can now configure email clients like Thunderbird, Outlook, or mobile mail apps using the following settings:

  • IMAP Server: mail.yourdomain.com (Port: 993, SSL/TLS)
  • SMTP Server: mail.yourdomain.com (Port: 587, STARTTLS)
  • POP3 Server: mail.yourdomain.com (Port: 995, SSL/TLS)

Step 12: Testing & Verification

1. Web Access:

Visit https://yourdomain (or the configured port) to confirm SSL/TLS is working.

2. Email Testing:

  • Use Telnet to test SMTP: telnet mail.yourdomain.com 25
  • Send a test email from Citadel’s web interface to an external email and check delivery.

Conclusion

You have successfully installed and configured the Citadel Mail Server on your Linux server. This setup ensures a secure, fully functional, and scalable email system for personal or business use.

For further customization, explore Citadel’s features like groupware, mailing lists, and spam protection.

Need help? Leave a comment below or check the official Citadel documentation!

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply