Directadmin Server Migration
SeeksAdmin provides DirectAdmin Server Migration services. Contact us today for a quote for professional help with your directadmin migration.
Directadmin Server Migration Guide
There are millions of articles out there about cPanel server migrations, even about Plesk migrations, however (as far as I know) there is not actually that much about Directadmin server migrations. While migrating a single account from a directadmin server is a relatively simple process, transferring a whole server on the other hand is not so easy and requires you to do some tricky things. This article plans to lay out the basics of the migration process which will help you transfer your websites using directadmin.
The first steps in any migration is setting up the server. I will assume that you have already setup the server security as well as making sure the configurations of php, mysql etc are the same with the same modules and version numbers. I have also assumed you have changed the TTL on all the domains on the old server to a lower time.
To continue the server setup process we take a system backup of the old system. To do this we log in to the directadmin control panel and select the System Backup option under Admin tools as shown in the image on the left. Make sure you unselect httpd data, and the home directories, but you must select all of the folders and files listed in the bottom section. Once you ensure that everything is selected (or unselected) as appropriate press the Run system backup now option.
The reason we have skipped the home directories and httpd data is that these are often large and an be synced manually using an rsync process from server to server. It is also a good idea to remove the mysql databases and then run them at a later date as well to ensure there is no data loss. I advise you not to use the ftp option as in our experience Directadmin has some issues with ftping them over and they never seem to work if you do this.
Once the backup has been completed we need to rsync over the data and restore it. I will give an example command so that you can synchronise the folders of the two servers using rsync. This is submitted on the local machine the backups were just run off
rsync -rave ssh –delete /local/backup root@REMOTEIP:/backup/
So now we log in to the new folder and restore all those files that were backed up. Restoring them is a simple, but tedious process. The backup will be split into folders so there will be an etc folder and in there will be named.conf.tar.gz etc. The restore of these files is as simple as extracing them in the correct location and more details on this can be found here. Now its time to synchronise the home direcotiries which will synch the http files as well as mail files for all domains. I advise that you stop ftp service running on the old server so that there is no data loss during the process caused by people uploading files. To sychrnoise the home directories, login to the old server and submit the following command
rsync -rave ssh –delete /home root@REMOTEIP:/home/
This command may take a while so it is a good idea to run it using screen in case you lose connection. This will also allow you to leave it running in the background. The great thing about rsync is that it does not use huge amounts of resources, and it will keep the ownership and permission of files. Once that is completed it is a good idea to stop mysql on the old server so that no databases can be updated causing data loss and then we can restore the databases. To backup all databases the command is (NOTE: You will require either root or da_admin user for this)
mysqldump -u username -p –all-databases > databases.sql
Sometimes errors can occur which stop the mysqldump, so if errors appear add the –force tag which will keep going even when an error occurs within a table. Then transfer this file over onto the new server using rsync of scp and then restore it using the comand: (with username root or da_admin)
mysql -u username -p < databases.sql
Now we need to change the IPs on the new server as when we transfered the backups all of the files included the old server’s IPs. Luckily Directadmin have a very nice little script for us to do just that.
./ipswap.sh 220.127.116.11 18.104.22.168
Where 22.214.171.124 is the OLD server IP and the new server IP is 126.96.36.199. This needs to be completed for all IPs on the server, a list of which can be found in Directadmin under the IP management tab. Then all the services must be rebooted so that the IPs update under all the services. You can now change your server IPs at the nameservers.
A quick way to ensure that the servers are pointing at the correct domain is using the multi-server setup tool. On the new server login and go to the multi-server setup tab and input the old server details, press add and make sure the multi-server setup is turned on.
Test your connection and ensure that the connection is working. If it is we are ready to sync the changes using the following command:
echo “action=rewrite&value=named” >> /usr/local/directadmin/data/task.queue
This will queue a synchronization of all of the DNS records from the new server to the old server ensuring that the domains will be pointed at the new server ensuring all data will work.