Published on: August 6, 2011 by Vipin R.N
Skill Level : Beginner
In this post, I will explain how to transfer a website from one cPanel server to other.
Server Platform : Linux
User requires : cPanel and SSH access (root) to at-least the Destination server (where the account is restoring)
The first step in cPanel migration is, from the Target server, Generate a Full cPanel backup of the account using either cPanel or through root shell access.
(i) By cPanel
Login to cPanel. Go to Files -> Backups
Click “Download or Generate a Full Website Backup”. Choose Backup Destination as “Home Directory” (Make sure you’ve enough Disk Space before you proceed) and a valid E-mail address to notify you once the Backup is generated.
Once the Backup is completed, a mail will arrive on the E-mail you’ve mentioned above (if specified) and the ‘Backups Available for Download’ will be populated with the name of the backup file generated like :
Do you know why the backup generated is the form tar.gz ? Its because, in the tar format all files are preserved with their appropriate permissions and then its compressed to gz (gzip) for obtaining the least possible file size.
The process in the Target server is finished. Now login as Root in the server which requires the account to be restored. We’ve to download the backup file generated there to this server. There are number of ways to do this. Some are weird 🙂
If you have the cPanel details of that server, you can use it for FTP access. And since the Backup is generated on the Home directory there, its all about downloading the backup.
# root@server [/home]# ftp oldserver.com or IP
Connected to oldserver.com.
220———- Welcome to Pure-FTPd [privsep] [TLS] ———-
220-You are user number 3 of 50 allowed.
220-Local time is now 17:28. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (oldserver.com:root): user
331 User user OK. Password required
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> get backup-6.2.2011_06-23-57_account.tar.gz
This will download the backup. You need root access to restore it. Before you restore you need to check whether there is an account or domain which already exists by the name which you intend to restore.
cPanel script to check whether the domain/account name exists
# grep account /etc/userdomains
Generating a cPanel backup through Remote FTP (Passive Mode transfer)
It is possible to generate a Remote backup of the account in a server, where the backup has to be restored. Go to cPanel -> Backups -> Download or Generate a Full website backup. Select the Backup Destination as Remote FTP Server (passive mode transfer). Follow the screenshot :
cPanel script to restore the account
# nice -n 19 /scripts/restorepkg –skipres <username>
For the script to run, the backup should be in any of the following locations in the server : /, /home, /home2, /home3, /misc, /net, /root, /usr, /usr/home, /var/lib/nfs/rpc_pipefs, /var/tmp, /web
This feature will restore full backups, cPanel backups and cPanel move files in one of the following formats:
Category : cPanel, General, Howtos, Linux, Training, Troubleshooting