Roundcube provides a polished, browser-based email interface for your self-hosted mail server — letting users check email without configuring a desktop/mobile mail client.
Prerequisites
- A working mail server (see How to Set Up a Complete Mail Server (Postfix + Dovecot + SPF/DKIM/DMARC))
- Nginx or Apache, PHP, MySQL/MariaDB
Step 1 — Install Dependencies
sudo apt install php php-fpm php-mysql php-imap php-mbstring php-xml php-intl mariadb-server -y
Step 2 — Create the Roundcube Database
sudo mysql
CREATE DATABASE roundcube;
CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'CHANGE_ME_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON roundcube.* TO 'roundcube'@'localhost';
FLUSH PRIVILEGES;
Step 3 — Download Roundcube
cd /var/www
sudo wget https://github.com/roundcube/roundcubemail/releases/latest/download/roundcubemail-VERSION-complete.tar.gz
sudo tar xzf roundcubemail-*-complete.tar.gz
sudo mv roundcubemail-* roundcube
Step 4 — Set Permissions
sudo chown -R www-data:www-data /var/www/roundcube
Step 5 — Run the Installer
http://YOUR_SERVER_IP/roundcube/installer
Walk through the web-based installer: configure database connection, IMAP server (typically localhost if Dovecot runs on the same server), and SMTP server settings.
Step 6 — Delete the Installer (Important Security Step)
sudo rm -rf /var/www/roundcube/installer
Leaving the installer accessible after setup is a real security risk — always remove it once configuration is complete.
Step 7 — Configure Nginx
server {
listen 443 ssl;
server_name webmail.yourdomain.com;
root /var/www/roundcube/public_html;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
}
Step 8 — Add HTTPS
sudo certbot --nginx -d webmail.yourdomain.com
Step 9 — Log In
Users log in with their existing mail server credentials (the same account/password used for IMAP) — no separate Roundcube-specific account needed.
Setting Up Automatic Database Updates
cd /var/www/roundcube
sudo -u www-data bin/updatedb.sh --dir=SQL --package=roundcube
Run after upgrading Roundcube versions to apply any necessary database schema changes.
Enabling Useful Plugins
sudo nano /var/www/roundcube/config/config.inc.php
$config['plugins'] = ['archive', 'zipdownload', 'managesieve'];
managesieve is particularly useful, letting users configure their own email filtering rules directly through the web interface.
Common Errors
"IMAP Error: Login failed" — verify Roundcube's configured IMAP host/port matches your Dovecot setup, and that the mail server itself is reachable from where Roundcube runs.
Continue Reading
- How to Set Up a Complete Mail Server (Postfix + Dovecot + SPF/DKIM/DMARC)
- How to Install and Configure Dovecot for IMAP/POP3
- SMTP vs IMAP vs POP3: Understanding Email Protocols
Browse more articles in Email Hosting & Deliverability.