RHEL BasedRocky Linux

How To Install DavMail on Rocky Linux 10

Install DavMail on Rocky Linux 10

DavMail is a powerful gateway solution that bridges the gap between Microsoft Exchange servers and standard email protocols. If you’re running Rocky Linux 10 and need to access Microsoft Exchange or Office 365 without relying on proprietary clients like Outlook, DavMail provides the perfect solution. This comprehensive guide walks you through the complete installation and configuration process, from system preparation to email client setup, ensuring you can leverage open-source email clients while maintaining full Exchange connectivity.

Whether you’re a system administrator managing enterprise email infrastructure or an individual user seeking alternatives to Microsoft’s native clients, this tutorial provides detailed, step-by-step instructions for deploying DavMail on Rocky Linux 10. By the end, you’ll have a fully functional gateway translating standard protocols like POP, IMAP, SMTP, CalDAV, CardDAV, and LDAP into Exchange-compatible communications.

Understanding DavMail

DavMail functions as a protocol translation gateway, converting standard email and calendar protocols into Microsoft Exchange Web Services (EWS) or Outlook Web Access (OWA) calls. This architecture allows any email client supporting standard protocols to communicate with Exchange servers seamlessly. The gateway runs as a local or network service, acting as an intermediary between your preferred email client and Microsoft’s proprietary Exchange infrastructure.

The software supports multiple Exchange connection modes including EWS (Exchange Web Services), Office 365 Modern Authentication, and traditional OWA. Built on Java, DavMail offers true cross-platform compatibility, running efficiently on Windows, Linux, macOS, and other Unix-like systems. This platform independence makes it an ideal solution for heterogeneous environments where users work across different operating systems but need consistent Exchange access.

Key features include complete protocol support for POP3, IMAP, SMTP for email operations, CalDAV for calendar synchronization, CardDAV for contact management, and LDAP for Global Address List queries. Organizations benefit from reduced licensing costs by eliminating the need for Microsoft Outlook subscriptions while maintaining full functionality. Users gain the freedom to choose their preferred email clients—Thunderbird, Evolution, Apple Mail, or any standards-compliant application—without sacrificing Exchange integration capabilities.

Prerequisites and System Requirements

System Requirements

Before beginning the installation, ensure your Rocky Linux 10 system meets the minimum requirements. You’ll need a server or workstation with at least 2GB of RAM, though 4GB is recommended for optimal performance. The CPU requirements are modest; any modern processor from the last decade will suffice. Allocate at least 500MB of disk space for the DavMail installation and associated dependencies, though you should provision additional space for log files and potential updates.

Your system must have root or sudo privileges to install packages, configure services, and modify system settings. A properly configured network connection with DNS resolution is essential, as DavMail needs to communicate with Exchange servers over the internet or your corporate network. Ensure your hostname is set correctly using the hostnamectl command, as some network services depend on proper hostname configuration.

Software Dependencies

DavMail requires Java Runtime Environment (JRE) version 8 or higher to function. Rocky Linux 10 repositories provide OpenJDK packages that satisfy this requirement perfectly. The gateway is Java-based, which contributes to its platform independence but necessitates having a working Java installation. If you plan to run DavMail in GUI mode for initial configuration, you’ll also need the Standard Widget Toolkit (SWT) libraries, though server deployments typically run in headless mode using configuration files.

Additional dependencies include standard system utilities like wget or curl for downloading packages, unzip for extracting archives, and text editors like nano or vim for configuration file editing. The firewalld service should be installed and running to manage network access securely, and SELinux should remain in enforcing mode for production deployments to maintain security compliance.

Network Requirements

DavMail requires network connectivity to your Exchange server or Office 365 tenant. You must have the correct OWA URL for your Exchange environment—typically something like https://outlook.office365.com/owa/ for Office 365 or https://mail.yourdomain.com/owa/ for on-premises Exchange servers. Test this URL in a web browser before proceeding to verify accessibility and authentication.

The gateway binds to specific ports for each protocol it serves. By default, DavMail uses port 1110 for POP3, 1143 for IMAP, 1025 for SMTP, 1080 for CalDAV, and 1389 for LDAP. These non-standard ports avoid conflicts with system mail servers that might occupy the standard ports. If you’re deploying DavMail as a network service for multiple users, ensure these ports are accessible through your firewall and not blocked by network security policies.

Preparing Rocky Linux 10 for Installation

System Update

Start by updating your Rocky Linux 10 system to ensure all packages are current and security patches are applied. Open a terminal and execute the following command with sudo privileges:

sudo dnf update -y

This command contacts the Rocky Linux repositories, downloads the latest package metadata, and upgrades all installed packages to their newest versions. The -y flag automatically confirms the update without requiring manual approval. This process may take several minutes depending on your internet connection and the number of packages requiring updates. After completion, verify your Rocky Linux version:

cat /etc/rocky-release

You should see output confirming Rocky Linux 10.x. While a reboot isn’t always necessary after updates, it’s recommended if kernel updates were applied to ensure you’re running the latest kernel version.

Installing Java Runtime Environment

DavMail requires Java to run, so install OpenJDK from the Rocky Linux repositories:

sudo dnf install java-11-openjdk -y

This installs Java Development Kit version 11, which includes the Java Runtime Environment needed for running Java applications. Rocky Linux 10 provides multiple Java versions; version 11 offers a good balance of stability, performance, and compatibility with DavMail. After installation completes, verify Java is correctly installed:

java -version

The output should display information about OpenJDK version 11.x.x, confirming successful installation. If you need to set the JAVA_HOME environment variable for system-wide availability, add the following to /etc/profile:

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
export PATH=$PATH:$JAVA_HOME/bin

However, for most DavMail installations, the default Java installation is sufficient without additional environment configuration.

Creating DavMail User Account

Running services under dedicated user accounts follows security best practices by limiting potential damage from security vulnerabilities. Create a system user specifically for DavMail:

sudo useradd -r -s /bin/false -M davmail

The -r flag creates a system account with a UID below 1000, -s /bin/false prevents interactive login for security, and -M skips home directory creation since this account only runs services. This dedicated user will own DavMail processes and files, isolating them from other system services.

Configuring Firewall Rules

Rocky Linux 10 uses firewalld for firewall management. Verify firewalld is running:

sudo systemctl status firewalld

If firewalld isn’t active, enable and start it:

sudo systemctl enable --now firewalld

You’ll configure specific port rules after installing DavMail, but ensure firewalld is operational now to avoid connectivity issues later.

Installation Method 1: Binary Package Installation

Downloading DavMail

Navigate to a temporary directory and download the latest DavMail release from SourceForge:

cd /tmp
wget https://sourceforge.net/projects/davmail/files/davmail/6.4.0/davmail-6.4.0-3755.zip

This downloads the platform-independent ZIP archive containing DavMail binaries and dependencies. The version number (6.4.0 in this example) may differ; always download the latest stable release from the official SourceForge repository. Verify the download completed successfully:

ls -lh davmail-*.zip

You should see the file with its size displayed, confirming the download.

Extracting and Installing

Install the unzip utility if not already present:

sudo dnf install unzip -y

Extract the DavMail archive:

unzip davmail-6.4.0-3755.zip

This creates a directory containing all DavMail files. Create the installation directory and move files:

sudo mkdir -p /opt/davmail
sudo cp -r davmail-6.4.0-3755/* /opt/davmail/

The /opt directory is conventionally used for optional software packages not managed by the package manager. Set proper ownership for the davmail user:

sudo chown -R davmail:davmail /opt/davmail

Make the startup script executable:

sudo chmod +x /opt/davmail/davmail.sh

Creating Symbolic Links

Create a symbolic link to make DavMail accessible system-wide:

sudo ln -s /opt/davmail/davmail.sh /usr/local/bin/davmail

This allows you to launch DavMail by simply typing davmail from any directory. Verify the installation:

davmail --version

This should display the DavMail version information, confirming successful installation.

Installation Method 2: RPM Installation via DNF

For a more integrated installation that benefits from package management features, you can download the RPM package directly:

cd /tmp
wget https://sourceforge.net/projects/davmail/files/davmail/6.4.0/davmail-6.4.0-3755-1.noarch.rpm

Install the RPM package:

sudo dnf install ./davmail-6.4.0-3755-1.noarch.rpm -y

This method automatically resolves dependencies, installs DavMail in standard system locations, and creates appropriate configuration directories. The DNF package manager handles file placement according to Filesystem Hierarchy Standard conventions, making future updates and removal cleaner.

Configuring DavMail

Creating Configuration Directory

Create directories for configuration and logging:

sudo mkdir -p /etc/davmail
sudo mkdir -p /var/log/davmail

Set appropriate ownership:

sudo chown davmail:davmail /var/log/davmail

Basic Configuration Settings

Create the main configuration file:

sudo nano /etc/davmail/davmail.properties

Add the following essential configuration:

# DavMail Gateway Configuration
davmail.mode=O365Modern
davmail.url=https://outlook.office365.com/EWS/Exchange.asmx
davmail.server=true
davmail.allowRemote=false

# Port Configuration
davmail.popPort=1110
davmail.imapPort=1143
davmail.smtpPort=1025
davmail.caldavPort=1080
davmail.ldapPort=1389

# Logging Configuration
davmail.logFilePath=/var/log/davmail/davmail.log
davmail.logFileSize=1MB
davmail.rootLoggingLevel=INFO

# Disable GUI
davmail.disableGuiNotifications=true
davmail.showStartupBanner=true

The davmail.mode setting determines authentication method. Use O365Modern for Office 365 with modern authentication, O365Interactive for interactive browser-based OAuth, or EWS for traditional on-premises Exchange. The davmail.url must point to your Exchange server’s EWS endpoint—adjust this URL for your environment.

Setting davmail.server=true runs DavMail in server mode without GUI, ideal for headless servers. The davmail.allowRemote=false setting restricts connections to localhost only; change to true if providing network service to other computers.

Port Configuration

The default ports avoid conflicts with standard mail server ports. If you need to use standard ports (110 for POP, 143 for IMAP, 25 for SMTP), modify the port values accordingly, but note this requires running DavMail with elevated privileges and may conflict with existing services.

Logging Configuration

Proper logging facilitates troubleshooting. The configuration above logs to /var/log/davmail/davmail.log with automatic rotation when files reach 1MB. Adjust davmail.rootLoggingLevel to DEBUG for verbose logging during troubleshooting, but use INFO or WARN for production to avoid excessive log growth.

Setting Up DavMail as System Service

Creating Systemd Service File

Create a systemd service unit for automatic startup and management:

sudo nano /etc/systemd/system/davmail.service

Add the following configuration:

[Unit]
Description=DavMail Exchange Gateway
Documentation=https://davmail.sourceforge.net/
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=davmail
Group=davmail
ExecStart=/opt/davmail/davmail.sh /etc/davmail/davmail.properties
Restart=on-failure
RestartSec=30
StandardOutput=journal
StandardError=journal

# Security hardening
PrivateTmp=yes
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log/davmail

[Install]
WantedBy=multi-user.target

This service file includes security hardening directives. PrivateTmp=yes provides an isolated temporary directory, NoNewPrivileges=true prevents privilege escalation, and ProtectSystem=strict makes most of the filesystem read-only except explicitly allowed paths.

Enabling and Starting Service

Reload systemd to recognize the new service:

sudo systemctl daemon-reload

Enable DavMail to start automatically at boot:

sudo systemctl enable davmail.service

Start the service immediately:

sudo systemctl start davmail.service

Check service status:

sudo systemctl status davmail.service

You should see “active (running)” status with recent log entries. If the service fails to start, examine logs using:

sudo journalctl -u davmail.service -n 50

This displays the last 50 log entries for the davmail service, helping identify configuration errors or missing dependencies.

Configuring Firewall (firewalld)

Opening DavMail Ports

Open each protocol port in the firewall:

sudo firewall-cmd --permanent --add-port=1110/tcp
sudo firewall-cmd --permanent --add-port=1143/tcp
sudo firewall-cmd --permanent --add-port=1025/tcp
sudo firewall-cmd --permanent --add-port=1080/tcp
sudo firewall-cmd --permanent --add-port=1389/tcp

The --permanent flag saves rules across reboots. Reload firewalld to apply changes:

sudo firewall-cmd --reload

Verify open ports:

sudo firewall-cmd --list-ports

You should see all five ports listed. For enhanced security, restrict access to specific IP addresses or subnets using rich rules:

sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="1143" protocol="tcp" accept'

This example restricts IMAP access to the 192.168.1.0/24 subnet only.

Configuring SELinux

Rocky Linux 10 runs SELinux in enforcing mode by default. Check SELinux status:

getenforce

If it returns “Enforcing,” SELinux is active. While you could disable SELinux, keeping it enabled significantly improves security. Configure SELinux policies for DavMail:

sudo setsebool -P nis_enabled 1
sudo semanage port -a -t http_port_t -p tcp 1110
sudo semanage port -a -t http_port_t -p tcp 1143
sudo semanage port -a -t http_port_t -p tcp 1025
sudo semanage port -a -t http_port_t -p tcp 1080
sudo semanage port -a -t http_port_t -p tcp 1389

If semanage isn’t available, install it:

sudo dnf install policycoreutils-python-utils -y

These commands label DavMail ports appropriately, allowing Java processes to bind to them without SELinux denials. Monitor SELinux logs for denials:

sudo ausearch -m avc -ts recent

If denials appear, use audit2allow to generate custom policies.

Testing DavMail Installation

Verifying DavMail is Running

Check that DavMail processes are active:

ps aux | grep davmail

You should see Java processes running with the davmail user. Verify listening ports:

sudo ss -tlnp | grep java

This displays all listening TCP ports opened by Java, showing DavMail’s protocol ports with process IDs.

Testing Local Connectivity

Test each port using telnet or nc (netcat):

telnet localhost 1143

A successful connection displays the DavMail IMAP greeting. Type logout to disconnect. Repeat for other ports to confirm all protocols are accessible.

Testing Authentication

Review DavMail logs during initial connection attempts:

sudo tail -f /var/log/davmail/davmail.log

The logs show connection attempts, authentication requests, and Exchange communication, helping verify the gateway is correctly interfacing with your Exchange server.

Configuring Email Clients

Thunderbird Configuration Example

Mozilla Thunderbird provides excellent DavMail compatibility. Open Thunderbird and add a new mail account. Use manual configuration with these settings:

Incoming Server (IMAP):

  • Server hostname: localhost (or DavMail server IP if remote)
  • Port: 1143
  • Connection security: None (if local) or STARTTLS (if remote with SSL configured)
  • Authentication method: Normal password
  • Username: Your Exchange email address (user@domain.com)

Outgoing Server (SMTP):

  • Server hostname: localhost (or DavMail server IP)
  • Port: 1025
  • Connection security: None (if local) or STARTTLS (if remote with SSL configured)
  • Authentication method: Normal password
  • Username: Your Exchange email address

Test the configuration by sending and receiving test messages. Thunderbird should successfully connect through DavMail to your Exchange mailbox.

CalDAV and CardDAV Setup

Install Thunderbird’s built-in calendar (Lightning) or the TbSync extension for CalDAV support. Add a new CalDAV calendar with URL:

http://localhost:1080/users/user@domain.com/calendar/

Replace user@domain.com with your Exchange email address. Enter your Exchange credentials when prompted. Calendar events should synchronize bidirectionally between Thunderbird and Exchange.

For CardDAV contacts, use:

http://localhost:1080/users/user@domain.com/contacts/

Thunderbird’s address book will display your Exchange contacts, with changes syncing automatically.

LDAP Directory Configuration

Access Exchange’s Global Address List through LDAP. In Thunderbird, add a new LDAP directory with these settings:

  • Name: Exchange GAL
  • Hostname: localhost
  • Base DN: leave blank
  • Port number: 1389
  • Bind DN: Your email address

This enables searching your organization’s directory directly from Thunderbird’s address book.

Troubleshooting Common Issues

Connection Issues

If clients cannot connect to DavMail, verify the service is running:

sudo systemctl status davmail.service

Check firewall rules allow the required ports and verify SELinux isn’t blocking connections by temporarily setting it to permissive mode:

sudo setenforce 0

If connections work in permissive mode, SELinux is blocking traffic. Re-enable enforcing mode and configure appropriate policies rather than leaving SELinux disabled.

Authentication Failures

Authentication problems typically stem from incorrect Exchange URLs or authentication modes. Verify your OWA URL in a web browser—you should be able to log in successfully. If your organization uses multi-factor authentication, DavMail may require the O365Interactive mode, which opens a browser window for authentication.

Check DavMail logs for specific error messages:

sudo grep -i "auth" /var/log/davmail/davmail.log

Common authentication errors include incorrect credentials, expired passwords, or OAuth requirements. For Office 365, ensure you’re using a full email address (user@domain.com) rather than just a username.

Service Startup Problems

If DavMail fails to start, examine systemd logs:

sudo journalctl -u davmail.service -xe

Common issues include missing Java installation, incorrect file permissions, or configuration file syntax errors. Verify Java is accessible:

which java

Check configuration file ownership matches the service user:

ls -la /etc/davmail/davmail.properties

The file should be readable by the davmail user.

Performance Issues

High memory usage typically relates to Java heap settings. Monitor Java process memory:

ps aux | grep java

Adjust Java memory parameters by modifying the ExecStart line in the systemd service file:

ExecStart=/usr/bin/java -Xmx512m -jar /opt/davmail/davmail.jar /etc/davmail/davmail.properties

This limits maximum heap size to 512MB. Adjust based on your system resources and usage patterns.

Security Best Practices

Securing DavMail Installation

Run DavMail under the dedicated davmail user account rather than root, limiting potential security breach impact. Implement SSL/TLS encryption for all protocols if exposing DavMail to networks beyond localhost. Generate a self-signed certificate or use Let’s Encrypt for trusted certificates.

Use strong, unique passwords for all Exchange accounts accessing DavMail. Implement fail2ban rules to block repeated authentication failures, protecting against brute-force attacks. Regularly review log files for suspicious activity patterns.

Regular Maintenance

Keep DavMail updated by monitoring the SourceForge repository for new releases. Security vulnerabilities in older versions may expose your system to attacks. Also maintain current Java runtime versions through Rocky Linux’s package management:

sudo dnf update java-11-openjdk

Implement log rotation to prevent log files from consuming excessive disk space. Create a logrotate configuration:

sudo nano /etc/logrotate.d/davmail

Add:

/var/log/davmail/*.log {
    weekly
    rotate 4
    compress
    delaycompress
    missingok
    notifempty
}

Back up your configuration files regularly, particularly /etc/davmail/davmail.properties and the systemd service file, enabling quick recovery after system failures.

Network Security

If running DavMail as a network service, implement defense-in-depth strategies. Use VPN connections for remote access rather than exposing DavMail directly to the internet. Implement network segmentation, placing DavMail servers on isolated network segments with restricted firewall rules.

Monitor network traffic to DavMail ports for unusual patterns indicating potential attacks. Consider implementing a reverse proxy like Nginx or Apache in front of DavMail, adding another security layer and enabling advanced features like rate limiting and geographic blocking.

Congratulations! You have successfully installed DavMail. Thanks for using this tutorial for installing DavMail on Rocky Linux 10 system. For additional help or useful information, we recommend you check the official DavMail website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button