Skip to content

Migrating from cPanel to DirectAdmin — account migration runbook with mail, DB, files, DNS

The cPanel-to-DirectAdmin migration runbook we use in production — DirectAdmin's native cPanel importer, plus the manual steps it doesn't cover (mail state, custom PHP modules, DNS clustering).

You’re moving off cPanel. Maybe the license cost finally tipped over, maybe a customer asked, maybe you want CloudLinux behavior on a different panel. DirectAdmin is a reasonable destination — it’s a similar single-server model, the customer experience is comparable, and DirectAdmin ships a built-in cPanel importer that handles the bulk of the structural translation. The importer is real. It is not magic. Below is the runbook we use, including everything the importer doesn’t handle.

What’s happening

DirectAdmin’s da-cpanel-import script reads a cPanel pkgacct backup (the .tar.gz file whmapi1 createacctbackup produces) and creates the equivalent DirectAdmin account: user, home directory, mail, MySQL databases, DNS zones, FTP users, SSH keys, and addon domains. It works well on standard cPanel accounts. Where it gets uncomfortable: cPanel accounts with custom PHP module sets installed via EasyApache, accounts using CloudLinux/CageFS-specific features, accounts with non-trivial mail filtering rules in .cpanel/exim/filter, accounts where the WordPress installs have hardcoded paths in the database, and accounts where mail IMAP state matters (read/unread, flags, custom folder hierarchy) because pkgacct exports mail as maildir but doesn’t preserve every Dovecot-specific marker the customer’s IMAP client may rely on.

The runbook treats DirectAdmin’s importer as the engine for the bulk of the work and adds the steps that production migrations need on top:

  1. Pre-flight on the cPanel side: inventory accounts, audit unusual PHP modules and mail filter rules, lower DNS TTLs to 300.
  2. Per-account pkgacct + transfer: create the cPanel backup, scp to the DirectAdmin server, run the importer.
  3. Post-import verification: file checksums, DB row counts, mail folder counts, DNS records, TLS issuance.
  4. Cutover: final delta sync of files and mail (because pkgacct is a point-in-time snapshot), DNS flip, monitor.
  5. Sunset: 7-14 days of overlap with the cPanel account read-only, then delete.

The hard parts are the same as any panel migration: mail state preservation (use imapsync for the final delta to catch state that pkgacct doesn’t carry), DNS TTL planning (drop to 300 at least a day ahead), and WordPress search-replace (the importer copies files and DB but doesn’t rewrite hardcoded URLs).

How to verify

Before cutover, run the verification check on each migrated account:

# 1. File checksum tree
# On cPanel
cd /home/customer1/public_html && find . -type f -print0 | sort -z | xargs -0 sha256sum > /tmp/cpanel-files.sha256

# On DirectAdmin
cd /home/customer1/domains/example.com/public_html && find . -type f -print0 | sort -z | xargs -0 sha256sum > /tmp/da-files.sha256

# 2. Database schema + row counts
# Same query on both sides
mysql -e "SELECT table_schema, table_name, table_rows FROM information_schema.tables WHERE table_schema LIKE 'customer1_%' ORDER BY table_schema, table_name;"

# 3. Mail message counts per folder
doveadm mailbox status -u user@example.com 'messages' '*'
# Run on both source and destination

# 4. DNS records
dig @ns1.da.example.com example.com ANY +noall +answer
diff <(dig @ns1.cpanel.example.com example.com ANY +noall +answer) <(dig @ns1.da.example.com example.com ANY +noall +answer)

# 5. TLS issuance for the customer domains
curl -sI https://example.com/ | head -5

If anything diverges, re-sync that specific dimension before flipping DNS for that customer.

The fix

Phase 0 — pre-flight

Inventory the cPanel accounts and identify the migration risk per account:

# On the cPanel server
for u in $(ls /var/cpanel/users/); do
  DISK=$(du -sh /home/$u 2>/dev/null | cut -f1)
  PHPVER=$(grep -E '^phpversion=' /var/cpanel/userdata/$u/main 2>/dev/null | cut -d= -f2)
  MAIL_SIZE=$(du -sh /home/$u/mail 2>/dev/null | cut -f1)
  DBS=$(ls /var/lib/mysql/${u}_* 2>/dev/null | wc -l)
  echo -e "$u\t$DISK\t$PHPVER\t$MAIL_SIZE\t$DBS"
done > /tmp/cpanel-migration-inventory.tsv

Sort by size. Identify accounts with:

  • CageFS-specific behavior: cagefsctl --list-enabled-users lists who’s actually using it
  • Custom PHP modules: php -v per version, php -m for the module list — compare to what DirectAdmin’s CustomBuild offers
  • Mail filter rules: any .cpanel/exim/filter/* files contain logic the importer doesn’t translate; you’ll need to recreate them as DirectAdmin mail filters
  • Large mail (>20 GB per account): the pkgacct will be slow; consider doing mail separately via imapsync and using pkgacct --skiphomedir --skipmail for everything else

Lower DNS TTLs to 300 at least 24 hours before the first cutover. The cPanel UI does this per domain; for many domains, drive it via API:

for DOMAIN in $(whmapi1 listaccts | awk '$1=="domain:" {print $2}'); do
  whmapi1 dumpzone domain=$DOMAIN | grep -E 'TTL' || true
  # Use whmapi1 mass_edit_dns_zone or write a script that calls dnssec_edit_zone per record
done

Phase 1 — DirectAdmin destination prep

Stand up the DirectAdmin server (directadmin-almalinux-9-deploy covers the install). Build the equivalent packages in DirectAdmin that match your cPanel feature lists:

  • Same disk quota
  • Same mailbox count
  • Same database count
  • Same FTP user count
  • PHP versions matching what your cPanel accounts use (8.3, 8.2, 8.1 typically)
  • ModSecurity enabled with the same ruleset

For DNS clustering, make sure the DirectAdmin server is set up as the new nameserver pair (ns1.da.example.com, ns2.da.example.com) before cutover. Customers will eventually update their domain’s NS records at the registrar — or you’ll do it via API if Enhance is your registrar of choice.

Phase 2 — generate cPanel backups

Per account, generate the pkgacct:

# On cPanel
whmapi1 createacctbackup user=customer1
# Output goes to /home/cpmove-customer1.tar.gz

# Faster for many accounts: pkgacct with --split if disk is tight
/scripts/pkgacct customer1 /backup

For very large accounts where mail dominates, run pkgacct --skipmail and handle mail separately via imapsync later in the cutover phase.

Phase 3 — import on DirectAdmin

Copy the pkgacct tarball to the DirectAdmin server and run the importer:

# On DirectAdmin (root)
scp root@cpanel.example.com:/home/cpmove-customer1.tar.gz /home/admin/

# Use DirectAdmin's cpanel importer
/usr/local/directadmin/scripts/cpanel_to_da.sh /home/admin/cpmove-customer1.tar.gz

# Or via the modern unified importer if available
da-cpanel-import \
  --file /home/admin/cpmove-customer1.tar.gz \
  --reseller admin \
  --ip $(hostname -I | awk '{print $1}') \
  --no-overwrite \
  --skip-tls

The importer creates the user, sets up the home directory, restores the mail maildirs, imports MySQL dumps, recreates DNS zones, restores FTP users, and reconstructs the addon-domain layout. Watch the output — it logs every step and any warnings.

For accounts with custom PHP modules, after import, install the equivalent modules:

# On DirectAdmin
cd /usr/local/directadmin/custombuild
./build set php_extensions "imap intl gd mbstring soap"
./build php_extensions

Modules like ioncube_loader or sourceguardian need separate steps via CustomBuild. Match against your cPanel inventory from Phase 0.

Phase 4 — pre-cutover delta sync

The pkgacct is a point-in-time snapshot. Between when you generated it and when you flip DNS, the cPanel side keeps receiving changes — new files, new emails, new DB rows. Run delta syncs immediately before cutover:

# Files
rsync -aHAX --numeric-ids --delete \
  --exclude '/.cpanel/' --exclude '/.cphorde/' --exclude '/.htpasswds/' \
  --exclude '/mail/' --exclude '/etc/' --exclude '/.trash/' \
  -e ssh \
  root@cpanel.example.com:/home/customer1/public_html/ \
  /home/customer1/domains/example.com/public_html/

# Databases — fresh dump and import
ssh root@cpanel.example.com 'mysqldump --single-transaction --quick --routines --triggers customer1_wp' \
  | mysql customer1_wp

# Mail — imapsync delta (much faster than the first run; only new messages)
imapsync \
  --host1 mail.cpanel.example.com --user1 user@example.com --password1 OLDPASS \
  --host2 mail.da.example.com --user2 user@example.com --password2 NEWPASS \
  --ssl1 --ssl2 --useheader 'Message-Id' --no-modulesversion

imapsync is the right tool for mail state preservation. pkgacct exports maildir files but the importer reconstructs them in DirectAdmin’s Dovecot layout, which may not preserve every flag from cPanel’s setup. imapsync reads and writes via IMAP, so flags and folder structure carry over.

Phase 5 — cutover

Take a maintenance window (or hot-cutover with overlap):

# 1. Final delta sync for files, mail, DB (Phase 4 commands)

# 2. Flip DNS A records to the DirectAdmin IP
# If your DNS is in cPanel's zones, update on the cPanel side too so resolvers
# that haven't moved to the new NS yet still get the right IP
whmapi1 mass_edit_dns_zone domain=example.com edits='[{"line":"A","value":"<da-ip>"}]'

# On the DirectAdmin side, confirm the DNS zone is authoritative
dig @ns1.da.example.com example.com SOA +short

# 3. Update NS records at the registrar (eventually) so the world points at DirectAdmin's NS
# Until that propagates, the A-record update in cPanel's zone covers the resolvers
# that still hit cPanel's NS.

# 4. Force TLS issuance on DirectAdmin (Let's Encrypt)
/usr/local/directadmin/scripts/letsencrypt.sh request_single example.com 4096

Watch the customer’s site post-cutover. Hit it from a fresh DNS resolver:

curl --resolve example.com:443:<da-ip> https://example.com/ -sI | head
# Should return 200 and the new server identifying headers

curl -sI https://example.com/ | head
# After DNS propagation, this should hit DirectAdmin too

Phase 6 — sunset

For 7-14 days after cutover, keep the cPanel account suspended but in place:

# On cPanel
whmapi1 suspendacct user=customer1 reason="migrated-to-directadmin"

# Set up MX forwarding for any mail that still arrives at the old box
whmapi1 set_mail_route domain=example.com route=mail.da.example.com

Monitor the DirectAdmin server for the customer:

  • Site uptime
  • Mail receive + send
  • DB connection counts
  • DNS queries against the new NS

After the sunset window, decommission on cPanel:

whmapi1 removeacct user=customer1 keepdns=0

Retain the pkgacct tarball off-box for 90 days minimum.

Edge cases

  • WordPress hardcoded URLs: wp_options.siteurl and wp_options.home, plus plugin tables. Run wp search-replace 'old.example.com' 'new.example.com' on the new server.
  • Symlinks across user boundaries: cPanel sometimes has symlinks pointing outside the user’s home (e.g., to /usr/local/cpanel/...). The importer fails on these or copies the target. Audit find /home/customer1 -type l -exec ls -la {} \; before pkgacct.
  • CloudLinux limits: per-user CPU/RAM/IO limits in CloudLinux/CageFS. DirectAdmin doesn’t have an exact equivalent natively — if you need per-user resource caps, run DirectAdmin’s nice/cgroups integration or buy CloudLinux for DirectAdmin (it’s supported).
  • Mail filtering rules: cPanel’s .cpanel/exim/filter/ files don’t survive pkgacct cleanly. Audit which accounts have non-trivial filters and recreate them in DirectAdmin’s mail filter UI per mailbox.
  • Sender reputation: the new IP needs to authenticate. Set up SPF/DKIM/DMARC on the DirectAdmin side and validate the records resolve correctly before customers send their first batch of mail.

Running a cPanel → DirectAdmin migration wave production-grade — pkgacct generation, delta-sync orchestration, cutover scripts, sunset cleanup — falls under migration and continues under Managed Cloud Ops after cutover. Scope your move and we’ll plan the waves with you.