Wednesday, July 18, 2007

Backup in cpanel and moving it from server 1 to server 2

How to take backup in cpanel and moving big accounts :

Following are the steps:

1) Moving sites between Cpanel servers are easy with the WHM Transfer feature. But some BIG accounts fails/time out when moving with WHM Transfer feature.
To move such accounts, you have to take backup and move it to new server and restore. Cpanel provides some tools which allows site backup and restore easy.

Here are the stpes how to move a site from server 1 to server 2 :

On server 1 (source) do the following:

1. Create Backup

Take backup of the web site with pkgacct

#grep /etc/userdomains

This command will give you the username of that particular
domain.

/scripts/pkgacct

Where username is the (cpanel account username) of the site which you want to move. This will create backup file in /home folder.

/home/cpmove-username.tar.gz


root@server [~]# /scripts/pkgacct raman
pkgacct started.
pkgacct version 2.9 - running with uid 0
Copying Reseller Config...Done
Copying SSL Certificates, CSRS, and Keys...Done
Copying Mail files....Done
Copying frontpage files....Done
Copying proftpd file....Done
Copying www logs.............
.........
.........
.........
.........
Copying shell.......Done
pkgacctfile is: /home/cpmove-raman.tar.gz
Creating Archive .............
.........
Done
md5sum is: 4e77ff26c08094c5df1af9a1e4b88f37

2. Move the Backup to New Server

This can be done several ways, FTP, SCP, RSYNC, etc...

We use another way here, that is we just move the backup to public_html folder of a web site, then download it from server2 with wget command.

# mv /home/cpmove-username.tar.gz /home/username_of_any_site/public_html/

Now make the file accessible by public

#chmod 777 /home/username_of_any_site/public_html/

One more way is to put this cpmove file in server htdocs folder as follows:

# mv /home/cpmove-username.tar.gz /usr/local/apache/htdocs

chmod 644 cpmove-username.tar.gz


on server 2 (destination server) :

1. Downloading the Backup

# cd /home
# wget http://websiteonserver1/cpmove-username.tar.gz

and if the backup is under the htdocs folder then

http://hostnameofserver1/cpmove-username.tar.gz or http://ipofserver1/cpmove-username.tar.gz

Download it on your local machine.

2. Restore the Account

# scripts/restorepkg username

Now you can edit DNS on server 1 and point it to server 2.