Special Offers: Up to 75% OFF on Hostinger & High-RAM Contabo Cloud VPS available this month.Compare Plans

How to Install Roundcube Webmail on Ubuntu VPS with Postfix, Dovecot & Let's Encrypt

Alex Vance
Alex VanceCloud Infrastructure Architect
November 21, 2026
•
17 min read
•
4.8 / 5.0
Transparency Notice: This article contains affiliate links to hosting providers like Hostinger and Contabo. If you purchase through our links, we may earn a commission at zero extra cost to you. We only recommend products we personally benchmark and test. Read full disclosure.
How to Install Roundcube Webmail on Ubuntu VPS with Postfix, Dovecot & Let's Encrypt
Best Hardware Value for TechsNo Contract Surcharges + High RAM

Contabo High-Performance Cloud VPS

Massive 4 vCPU cores, 8GB RAM, and 32TB monthly traffic. Ideal for Linux developers.

German Engineering & Data Centers
8 Strategic Global Locations
Fast NVMe Storage Array
Full Root & SSH Console Access
Starts From
$5.50 / mo
Special Affiliate Pricing
Claim Discount Now
Official Partner Link • Verified Safe
Quick Answer & Key Takeaways
Updated November 21, 2026 • Lab Score 4.8/5.0

Tired of monthly per-user email fees? Learn how to build a complete, private webmail server on a Linux VPS using Roundcube, Postfix, Dovecot, and SSL.

  • Create unlimited corporate email accounts with zero recurring per-user SaaS license fees
  • Modern, responsive webmail interface with address book, spellcheck, and message tagging
  • Complete cryptographic security: TLS encryption on IMAP, POP3, SMTP, and webmail interface

The Independence of Owning Your Own Mail Server

Paying $6 to $14 per user/month for Google Workspace or Microsoft 365 can quickly drain an organization's budget as team sizes expand. For an organization with 25 employees, commercial email subscriptions cost $1,800 to $4,200 every single year.

By hosting your own mail server stack on a Contabo Cloud VPS ($4.95/mo), you can create unlimited email accounts, store terabytes of attachments, and retain 100% cryptographic sovereignty over your correspondence. In this guide, we deploy Postfix (SMTP), Dovecot (IMAP/POP3), and the modern Roundcube Webmail interface.

Step 1: Set Server Hostname & Reverse DNS (rDNS)

Receiving mail servers (Gmail, Outlook) automatically reject incoming emails from servers whose Reverse DNS (PTR record) does not match the outgoing mail hostname. In your Contabo Customer Portal, set your server's Reverse DNS to mail.yourdomain.com.

On your VPS, set the matching system hostname:

sudo hostnamectl set-hostname mail.yourdomain.com

Step 2: Installing Postfix (MTA) and Dovecot (MDA)

Install Postfix, Dovecot with MySQL and IMAP modules, and Nginx:

sudo apt update && sudo apt install -y postfix dovecot-imapd dovecot-pop3d nginx certbot python3-certbot-nginx mariadb-server php-fpm php-mysql php-xml php-mbstring php-intl

During Postfix installation prompts:

  • Select Internet Site.
  • System mail name: yourdomain.com

Step 3: Generating Let's Encrypt TLS Certificates

Secure mail traffic with trusted TLS certificates:

sudo certbot certonly --standalone -d mail.yourdomain.com --non-interactive --agree-tos -m admin@yourdomain.com

Configure Postfix to use the new certificates in /etc/postfix/main.cf:

smtpd_tls_cert_file = /etc/letsencrypt/live/mail.yourdomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.yourdomain.com/privkey.pem
smtpd_tls_security_level = may
smtpd_tls_auth_only = yes

Step 4: Installing Roundcube Webmail

Download and extract the latest stable release of Roundcube:

cd /var/www
sudo wget https://github.com/roundcube/roundcubemail/releases/download/1.6.9/roundcubemail-1.6.9-complete.tar.gz
sudo tar -xf roundcubemail-1.6.9-complete.tar.gz
sudo mv roundcubemail-1.6.9 webmail
sudo chown -R www-data:www-data /var/www/webmail
sudo chmod -R 755 /var/www/webmail

Step 5: Creating the Roundcube Database

Create a dedicated MariaDB database for Roundcube:

sudo mysql -u root -p

CREATE DATABASE roundcubemail DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'roundcubeuser'@'localhost' IDENTIFIED BY 'StrongWebmailDbPassword_8832!';
GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcubeuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

# Import the initial Roundcube schema
sudo mysql -u roundcubeuser -p roundcubemail < /var/www/webmail/SQL/mysql.initial.sql

Step 6: Nginx Virtual Host Configuration

Configure Nginx to serve Roundcube at https://mail.yourdomain.com:

cat << 'EOF' > /etc/nginx/sites-available/webmail.conf
server {
    server_name mail.yourdomain.com;
    root /var/www/webmail;
    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
    }

    location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
        deny all;
    }

    location ~ ^/(bin|SQL)/ {
        deny all;
    }
}
EOF

sudo ln -s /etc/nginx/sites-available/webmail.conf /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d mail.yourdomain.com --non-interactive --agree-tos -m admin@yourdomain.com

Step 7: DNS Records: SPF, DKIM, and DMARC

To ensure emails reach Gmail and Outlook inboxes with 100% deliverability, add the following DNS records at your domain registrar:

  • MX Record: @ points to mail.yourdomain.com (Priority 10).
  • SPF Record (TXT): v=spf1 mx ip4:YOUR_VPS_IP ~all
  • DMARC Record (TXT): v=DMARC1; p=quarantine; rua=mailto:admin@yourdomain.com

Frequently Asked Questions (FAQ)

Does Roundcube work with Postfix and Dovecot on Ubuntu?

Yes! Roundcube connects natively to any standard IMAP (port 993) and SMTP submission (port 587) server, including Postfix + Dovecot or Mailcow.

Summary

Visiting https://mail.yourdomain.com now presents a sleek, modern Roundcube webmail login, giving you total communication independence with zero recurring per-user fees.

Video Walkthrough & Official References

Linux Nginx Reverse Proxy & SSL: Full Tutorial for Beginners • Cloud Explainers

Watch on YouTube

Editorial Verdict: Pros & Cons

What We Love (Pros)

  • Create unlimited corporate email accounts with zero recurring per-user SaaS license fees
  • Modern, responsive webmail interface with address book, spellcheck, and message tagging
  • Complete cryptographic security: TLS encryption on IMAP, POP3, SMTP, and webmail interface

Drawbacks (Cons)

  • Running a private mail server requires strict DNS discipline (rDNS/PTR, SPF, DKIM, DMARC) for inbox delivery
Best Hardware Value for TechsNo Contract Surcharges + High RAM

Deploy Your Contabo Cloud Server

Includes 4 vCPU Cores, 8GB RAM, 50GB NVMe SSD, and 32TB Outbound Traffic.

German Engineering & Data Centers
8 Strategic Global Locations
Fast NVMe Storage Array
Full Root & SSH Console Access
Starts From
$5.50 / mo
Special Affiliate Pricing
Claim Discount Now
Official Partner Link • Verified Safe
Alex Vance

Written by Alex Vance

Cloud Infrastructure Architect

Alex and the ServerCraft engineering lab run routine benchmarks on over 25 web hosting providers, maintaining strict objectivity and reproducibility.

Recommended Next Reads