Install RedMail with Virtual Domains, Webmail, SpamAssassin & ClamAV in Linux

Email communication remains an integral part of our personal and professional lives. Setting up a reliable and secure mail server is crucial for efficient communication within organizations or for personal use. Mail-in-a-Box (commonly called RedMail) is a fully-featured mail server solution that offers a comprehensive suite of tools to create virtual domains, access webmail, and enhance email security with SpamAssassin and ClamAV. In this article, we will guide you through the process of installing Mail-in-a-Box on a Linux system.

Prerequisites

Before diving into the installation process, ensure you have the following

  • A clean Ubuntu 18.04 or 20.04 LTS server with root access

  • At least 1GB RAM and 5GB storage

  • A domain name pointing to your server's IP address

  • Basic understanding of Linux system administration

Update Your System

Log in to your Linux server as the root user and update the system packages

sudo apt update
sudo apt upgrade -y

Download and Run the Installation Script

Mail-in-a-Box provides a convenient installation script that automates the entire process. Download and execute it with the following commands

curl -s https://mailinabox.email/setup.sh | sudo bash

The script will automatically

  • Install required packages (Postfix, Dovecot, Nginx, etc.)

  • Configure DNS settings

  • Set up SSL certificates via Let's Encrypt

  • Install and configure SpamAssassin and ClamAV

Initial Configuration

During installation, the script will prompt you for configuration details

Enter the email address you want as your first user: admin@yourdomain.com
Enter the password for this user:
What timezone should your server be set to? [UTC]:

Provide your primary email address, a strong password, and optionally set your timezone. The installation process typically takes 10-15 minutes.

Accessing the Admin Panel

Once installation completes, access the admin panel by navigating to https://yourdomain.com/admin in your web browser. Log in with the credentials you created during installation.

Mail-in-a-Box Admin Dashboard System Email Users DNS ? Mail Server Status: Running ? SSL Certificate: Valid ? DNS Configuration: OK ? SpamAssassin & ClamAV: Active

Configure Virtual Domains

To add additional domains, navigate to the Email section in the admin panel. You can add virtual domains and create email accounts for each domain

Adding a New Domain

# DNS records must be configured first
# Add A record: mail.newdomain.com ? Your-Server-IP
# Add MX record: newdomain.com ? mail.newdomain.com

In the admin panel, go to Email ? Instructions and follow the DNS configuration guide for each new domain.

Accessing Webmail

Mail-in-a-Box includes Roundcube webmail. Users can access their email by navigating to https://yourdomain.com/mail and logging in with their email credentials.

Email Security Features

Mail-in-a-Box comes pre-configured with robust security features

Security Feature Purpose Status
SpamAssassin Spam filtering and scoring Auto-enabled
ClamAV Virus and malware scanning Auto-enabled
DKIM Signing Email authentication Auto-configured
SPF Records Sender verification Auto-configured
DMARC Email policy enforcement Auto-configured

Testing Your Mail Server

Verify your installation by performing these tests

Test Email Delivery

Send a test email using the command line

echo "Test email body" | mail -s "Test Subject" recipient@example.com

Check Mail Logs

Monitor mail server activity

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

Test Spam Filtering

Send an email with spam keywords like "GTUBE" test string to verify SpamAssassin is working.

SSL Certificate Management

Mail-in-a-Box automatically obtains and renews SSL certificates via Let's Encrypt. Check certificate status in the admin panel under System ? SSL Certificates.

Maintenance Commands

Useful commands for maintaining your mail server

# Update Mail-in-a-Box
sudo mailinabox

# Check system status
sudo mailinabox --check

# Restart mail services
sudo service postfix restart
sudo service dovecot restart

Conclusion

Mail-in-a-Box provides a complete, production-ready mail server solution with minimal configuration effort. The automated setup includes virtual domains, webmail access, spam filtering, and virus protection. Regular maintenance and monitoring ensure optimal performance and security for your email infrastructure.

Updated on: 2026-03-17T09:01:39+05:30

316 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements