site migration

Mirroring sites with lftp

The "mirror" command is all you need to copy/mirror a site with lftp:

$ lftp
lftp :~> connect ftp.domain.tld
lftp ftp.domain.tld:~> login <username>
lftp ftp.domain.tld:~> mirror

Here's a one liner:

$ lftp -e mirror -u <username>,<password> <host>

Migrating sites between DirectAdmin servers

These are some basic notes for reference just in case I need to do the migration thing again!!!

Steps taken on the old server

  1. Created a new reseller account.

  2. Created sites in the new reseller account as domain.com2 for the domains that needed to be migrated. DA won't let you add the same name twice, which is why I used a different one for the time being. Doing this will setup all the required files/paths needed to use the website.

  3. Copied the files to the new domain.
    # cp -pR /home/olduser/domains/* /home/newuser/domains/domain.com2/
    # chown -R newuser:newuser /home/newuser/domains/domain.com2
  4. Did a search for the old file path and updated it to the new file path.
    # for x in `find /home/newuser/domains/*/public_html -type f -print0 | xargs --null grep -l /home/olduser`; do perl -pi.bak -e 's/\/home\/olduser/\/home\/newuser/g' $x ; done
  5. Swapped around the the email folders.
    # cd /etc/virtual
    # mv
    # mv domain.com2
    # mv domain.com2
  6. Copied over the imap files. Any data in /home/olduser/imap needed to be copied over. There will also be permission issues as well, but can be fixed afterwards with the script.

  7. Changed user for the imap files.
    # find /home/newuser/imap -user olduser | xargs chown newuser:newuser
  8. Renamed the existing domains with a suffix of ".old".

  9. Renamed the new domains to from domain.com2.

  10. Logged in as reseller and created a backup.

  11. Created a script and dumped out single databases.


    for ((i=0; i<${#OLD_DB[@]}; i++))
      mysqldump --opt -u root --password={psswd} ${OLD_DB[$i]} > ./db/${OLD_DB[$i]}.db
  12. Did a search and created a list of folders with 777 permission set.
    # find /home/newuser/domains -perm 0777 -type d > 777.txt
  13. Setup dns for each domain with a www1 A record to point to the new server IP. Better solution, would be to edit the local hosts file for testing purpose.

Migrating website from Ensim Basic 3.1.12-9 to Ensim Pro 4.0.2-7

The site migration was done from a server with Ensim Basic 3.1.12-9 (secure) to a server running Ensim Pro 4.0.2-7 (serv01).

  1. ----- Preparation prior to migration -----
  2. 48 hrs prior to migration, edit the SOA settings with the "Refresh Interval" and the "Minimum Time To Live" to 600 for the domains.
  3. Remove frontpage extensions from all sites.
  4. Backup sites on secure (ensim 3.1.12-9) with ensimbackup and move it to serv01.
    # ensimbackup -l </path/to/domain_list>
  5. ----- In serv01 -----
  6. Check to make sure that the default site template has enough databases to assign in pro.
  7. Remove all instances of the domains to be restored in /etc/bind/secure_dns.conf .
  8. Delete all corresponding /var/named/sec.domain.tld files.
    # for x in `cat <domain list file>`; do rm /var/named/sec.$x; done
  9. Restart named.
  10. Turn sim checking off for webbpliance (init.ocwhttpd off) in "/usr/local/sim/config/mods.control"
  11. `service webppliance stop`
  12. Unhide all hidden services.
  13. Restore with ensimprorestore on serv01 (ensim 4.0.2-7.rhel).
    # ensimprorestore -a </path/to/dir/>
  14. Assign Spam Filter and Mail Scanner and remove ssh and squirrelmail for the restored domains.
    # for x in `cat <domain list file>`; do \
    # EditVirtDomain -c mailscanner,on -c spam_filter,on \
                   -c ssh,off -c sqmail,off [-c frontpage,on] $x; done
  15. Hide services, `/etc/appliance/svcdb/ hide`
  16. `service webppliance start`
  17. Turn sim checking on for webbpliance (init.ocwhttpd on).
  18. Run `/var/www/html/secureDNS/dns_updater.php`.
  19. Disable /etc/bind/dnsupdate for 48 hrs.
  20. ----- In secure -----
  21. Delete all instances of the domains from the zone list, "/etc/bind/bind.conf.wp".
  22. Delete all corresponding /var/named/zone.domain.tld files.
    # for x in `cat <domain list file>`; do rm /etc/bind/zone.$x; done
    # for x in `cat <domain list file>`; do rm /var/named/db.$x; done
  23. Restart named.
  24. Run `/etc/bind/dnsupdate` in secure.
  25. Delete the accounts after 48 hrs.
  26. ----- Old Method, use only for reference -----
  27. Create the Reseller Account.
  28. Assign the site to the Reseller account with high security, no squirrelmail (available by default) and no SSH. Also, change the number of database back to the original number... which is normally 1.
  29. Delete corresponding zone records from "/etc/bind/secure_dns.conf".
  30. Add DNS records using "/etc/bind/ <>".
    cat <<EOF >zone.$1
    zone "$1" IN {
            type master;
            file "/var/named/db.$1";
            allow-update   { key "wp_default_key."; };
            allow-transfer { localhost;; };
    cat <<EOF >/var/named/db.$1
    \$ORIGIN .
    \$TTL 3600      ; 1 hour
    $1              IN SOA (
                                    2005021308 ; serial
                                    3600       ; refresh (1 hour)
                                    600        ; retry (10 minutes)
                                    86400      ; expire (1 day)
                                    3600       ; minimum (1 hour)
    \$TTL 86400     ; 1 day
                            MX      10 mail.$1.
    \$ORIGIN $1.
    ftp                     A
    mail                    A
    www                     A
    cat <<EOF >>bind.conf.wp
    include "/etc/bind/zone.$1";
    [ -f /var/named/db.$1 ] && chown named:named /var/named/db.$1 && chmod 600 /var/named/db.$1
    [ -f /var/named/sec.$1 ] && rm /var/named/sec.$1
    echo "Restart named manually if everything looks fine..."
  31. Run `/var/www/html/secureDNS/dns_updater.php`.
  32. Disable accounts in secure via the CLI.
  33. Remove Zones in bind via GUI on secure.
  34. Run `/etc/bin/dnsupdate` in secure.

Syndicate content