Best Way to Migrate Roundcube to a New Server (Emails + Settings)

When it comes to web-based email clients, Roundcube stands out as one of the most popular open-source solutions. It offers a modern, user-friendly interface and supports IMAP, SMTP, and various customization options. However, there comes a time when administrators need to migrate Roundcube from one server to another—whether due to a hosting change, server upgrade, or performance improvement.

Migrating Roundcube isn’t just about copying files—it involves transferring emails, databases, settings, and sometimes even custom plugins. If done incorrectly, you risk losing emails or user preferences. But don’t worry—in this guide, we’ll walk you through the best way to migrate Roundcube to a new server, step by step, ensuring a seamless and error-free transition.

Why Migrate Roundcube to a New Server?

There are several reasons why organizations or individuals move Roundcube to a new hosting environment:

  • Server Upgrade: Moving to a faster or more secure server.
  • Hosting Provider Change: Shifting from shared hosting to VPS or cloud hosting.
  • Performance Issues: Old server may not handle growing email traffic.
  • Security & Reliability: Better data protection and uptime guarantees.

Regardless of the reason, the migration process must be planned carefully to avoid downtime and data loss.

What Needs to Be Migrated?

To successfully migrate Roundcube, you must transfer three key components:

  1. Emails – Stored on the IMAP/POP server or local mail storage.
  2. Roundcube Database – Holds user accounts, address books, and preferences.
  3. Configuration Files – Located inside config/ and plugins/ directories, which define server settings and customization.

Failing to migrate any of these can cause missing data or login issues after migration.

Preparing for Roundcube Migration

Before starting the migration, follow these essential steps:

  • Take a Complete Backup
    Backup both your Roundcube database and installation files. This acts as a safety net if anything goes wrong.
  • Check Compatibility
    Ensure that the new server meets Roundcube requirements (PHP, MySQL/MariaDB, IMAP, SMTP). Ideally, use the same Roundcube version on both servers.
  • Record Email Server Settings
    Note down IMAP/SMTP hostnames, usernames, and passwords. These will be required after migration.

Once preparations are complete, you’re ready to begin.

Step-by-Step Process to Migrate Roundcube to a New Server

Step 1: Backup the Roundcube Database

The database is the heart of Roundcube—it stores user preferences, contacts, and session data. On the old server, run:

mysqldump -u roundcube_user -p roundcube_db > roundcube_backup.sql
  • roundcube_user → Your database username
  • roundcube_db → Your Roundcube database name
READ  Best Methods to Export Emails from Roundcube to Office 365 Quickly

If you prefer a graphical interface, you can also export the database using phpMyAdmin.

Step 2: Backup Roundcube Files

Next, copy the Roundcube installation directory. On most servers, it’s located at /var/www/html/roundcube or /usr/share/roundcube.

Use rsync or scp to copy files:

rsync -avz /var/www/html/roundcube/ user@newserver:/var/www/html/roundcube/

Make sure to include:

  • config/ → Stores database connections and settings
  • plugins/ → Custom or third-party plugins

Step 3: Migrate Email Data

Emails are stored on the mail server, not inside Roundcube itself. To ensure emails are migrated properly:

Option A: If using IMAP – Use IMAPSync

IMAPSync is the most reliable way to copy emails between servers.

imapsync --host1 oldserver.com --user1 [email protected] --password1 oldpass \
         --host2 newserver.com --user2 [email protected] --password2 newpass

This securely transfers all emails, folders, and flags.

Option B: If using Local Mail Storage – Use Rsync

If emails are stored locally, copy the /var/mail/ directory:

rsync -avz /var/mail/ user@newserver:/var/mail/

Step 4: Restore Database on the New Server

Once the database dump (roundcube_backup.sql) is copied to the new server, restore it:

mysql -u root -p roundcube_db < roundcube_backup.sql

If the database doesn’t exist yet, create it first:

mysql -u root -p
CREATE DATABASE roundcube_db;
CREATE USER 'roundcube_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON roundcube_db.* TO 'roundcube_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Restore Roundcube Files on the New Server

Place the Roundcube files in the correct web directory:

scp -r roundcube/ user@newserver:/var/www/html/

Then, set correct file permissions:

chown -R www-data:www-data /var/www/html/roundcube

Finally, edit config/config.inc.php and update database credentials if needed.

Step 6: Update DNS and Test

If you are also moving the mail server, update your DNS MX records to point to the new server.
Then test:

  • Can you log in to Roundcube?
  • Do emails send and receive correctly?
  • Are contacts and preferences intact?

Only switch DNS permanently once everything is tested.

Alternative Method: Migrate with IMAPSync Only

If your primary goal is just to move emails (and not Roundcube settings or address books), you can simply install Roundcube fresh on the new server and use IMAPSync to transfer mailboxes.

  • Pros: Faster and simpler.
  • Cons: User settings, address books, and plugins won’t be migrated.

This method is ideal for small setups or when a fresh start is acceptable.

Common Issues After Migration (and Fixes)

  • Login Errors → Check database credentials inside config.inc.php.
  • Database Charset Issues → Make sure your database uses utf8mb4 collation.
  • Plugin Failures → Some plugins may not be compatible with newer Roundcube versions. Disable and re-enable them.
  • Blank Screen → Usually caused by missing PHP extensions or permission issues.

Best Practices for a Smooth Migration

  • Always perform migration in a staging environment first.
  • Keep the old server active until you verify the new one works.
  • Regularly back up Roundcube files and databases—even after migration.
  • Document every change for future reference.

Conclusion

Migrating Roundcube to a new server may feel complex, but with the right approach, it can be smooth and error-free. By carefully backing up the database and files, transferring email data with IMAPSync or rsync, restoring configurations, and testing thoroughly before going live, you can ensure zero data loss and minimal downtime.

READ  How to Migrate Roundcube to Gmail: A Complete Step-by-Step Guide

If you only need emails, IMAPSync provides a faster shortcut. But for a complete migration—including emails, address books, and settings—the full method we covered is the best way forward.

With preparation and patience, you’ll be able to move Roundcube to your new server confidently and securely.

Frequently Asked Questions (FAQs)

1. Does Roundcube store emails on the server?

No, Roundcube itself does not store emails. It is only a webmail client that connects to your IMAP/POP mail server. The emails are stored on the mail server (e.g., Dovecot, Postfix, or your hosting provider’s mail service). Roundcube stores user settings, address books, and preferences in its database.

2. What exactly do I need to migrate when moving Roundcube?

You need to migrate:
The database (user accounts, address books, settings).
The Roundcube installation files (with config and plugins).
The email data (if moving to a new mail server).

3. How do I migrate Roundcube emails to a new server?

If your emails are on an IMAP server, use IMAPSync to copy mailboxes.
If stored locally, use rsync to transfer /var/mail/ or /home/user/mail/ directories.
If the mail server remains unchanged, you don’t need to move the emails—only Roundcube files and database.

4. Can I migrate Roundcube to another Roundcube server directly?

Yes, you can migrate Roundcube from one server to another. Copy the database, Roundcube files, and sync mail data with IMAPSync (if needed). After restoring everything on the new server, update your DNS records to point to the new host.

5. What is the difference between using IMAPSync and a full Roundcube migration?

IMAPSync migration: Moves only the emails between mail servers. Roundcube settings, contacts, and plugins will not be transferred.
Full migration: Moves emails + Roundcube database + settings + plugins for a complete experience.

6. How long does it take to migrate Roundcube?

It depends on:
Size of your email data
Number of users
Server speed and network bandwidth
For small setups, it can take a few minutes. For larger organizations, it might take several hours.

7. Will users lose their contacts and settings after migration?

No, as long as you migrate the Roundcube database (roundcube_db) properly, users will retain their address books, signatures, folder subscriptions, and preferences.

8. What should I do if Roundcube shows a blank page after migration?

This usually indicates:
Incorrect database credentials in config.inc.php.
Missing PHP extensions on the new server.
Wrong file permissions.
Check your error logs (/var/log/apache2/error.log or /var/log/nginx/error.log) for clues.

9. Do I need to change DNS records when migrating Roundcube?

If you are only moving the Roundcube webmail interface (and keeping the same mail server), DNS changes are not required.
If you are moving the mail server as well, you must update the MX records to point to the new server.

10. Is it possible to migrate Roundcube without downtime?

Yes. By:
Keeping the old server live during migration.
Performing the migration in a staging environment.
Updating DNS records only after testing the new server.
This ensures users can continue accessing email without disruption.

Leave a Comment