These are some basic notes for reference just in case I need to do the migration thing again!!!
Steps taken on the old server
-
Created a new reseller account.
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.
Copied the files to the new domain.
# cp -pR /home/olduser/domains/domain.c om/* /home/newuser/domains/domain.c om2/
# chown -R newuser:newuser /home/newuser/domains/domain.c om2
# 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
# cd /etc/virtual
# mv domain.com domain.com.tmp
# mv domain.com2 domain.com
# mv domain.com.tmp domain.com2
Changed user for the imap files.
# find /home/newuser/imap -user olduser | xargs chown newuser:newuser
Renamed the new domains to domain.com from domain.com2.
Logged in as reseller and created a backup.
Created a script and dumped out single databases.
#!/bin/bash
# dbExport.sh
OLD_DB=(
db1
db2
db3
...
)
for ((i=0; i<${#OLD_DB[@]}; i++))
do
mysqldump --opt -u root --password={psswd} ${OLD_DB[$i]} > ./db/${OLD_DB[$i]}.db
done
# find /home/newuser/domains -perm 0777 -type d > 777.txt
Steps taken on the new server
-
Created the reseller to receive the restore.
Copied over the archive to the /home/newuser/user_backups folder.
Logged in as Reseller and deleted the default domain that was created for the reseller.
Renamed the existing domains created earlier with a .del suffix.
Restored the sites from the backup.
Created the required databases via the user interface to receive the dumps.
Imported the databases from the dumps via script.
#!/bin/bash
# dbImport.sh
OLD_DB=(
db1
db2
db3
...
)
NEW_DB=(
prefix_db1
prefix_db2
prefix_db3
...
)
for ((i=0; i<${#OLD_DB[@]}; i++))
do
mysql -u root --password={passwd} ${NEW_DB[$i]} < ./db/${OLD_DB[$i]}.db
done
# for x in `find /home/newuser/domains/*/public _html -type f -print0 | xargs --null grep -l oldDbPasswd`; do vi $x ; done
# for x in `cat 777.txt` ; do chown -R apache $x ; done
Admin Level -> Custom Httpd configurations -> domain.com
In the top text area, added this *one* line:
ServerAlias www1.|DOMAIN|
References:
- sandip's blog
- Login or register to post comments
Comments
cd /usr/local/directadmin/data/te mplates =named" >> /usr/local/directadmin/data/ta sk.queue
perl -pi.bak -e 's/14400/300/' named.db
echo "action=rewrite&value
Check "/var/named/*.db" to verify once the queued task is complete.
Reference: http://help.directadmin.com/it em.php?id=87