If you’re anything like me, you prefer to do things via command line (CLI) rather than relying on a GUI to do most things in Linux. You also realize that while some of us don’t like to use control panels (plesk, cpanel, webmin, etc..), they are necessary when providing a shared hosting environment for your clients.
While cPanel has an excellent migration utility (and they’ll even migrate it for you for free in most cases), it will sometimes fail for one reason or another. If you do it via command line, you’ll be able to cut out some of those failures.
Here are the steps to migrate a customer from a plesk 8.x (yeah, pretty dated) box to a cpanel 11.3x box.
Info about our transfer:
- Source server: plesk.company.com
- Source account owner: siteuser
- Destination server: cpanel.company.com
Source server (plesk)
1. SSH into the source server and become root
2. To find out the account owner, just see who owns the files in their /home/sites/domain.com directory.
3. cd into the home directory and run the pkgacct command calling the username that owns the account you want to xfer.
1 2 |
# cd /home # /scripts/pkgacct siteuser |
4. When that completes without error, move the file to the destination server using scp
1 2 |
# scp /home/cpmove-siteuser.tar.gz [email]root@cpanel.company.com[/email]:/home/ (enter root's password if you're not using keys) |
Destination server (cpanel)
1. SSH into the destination server and become root
2. cd into /home and run the restorepkg command calling that same username to create the user and complete the migration
1 2 |
# cd /home # /scripts/restorepkg siteuser |
After this runs, you’ll see that everything for that user has now transferred over!
Things that are handy to know:
1. If the user’s account is huge, and perhaps there’s not enough room on the server, you can run the pkgacct command with –skiphomedir flag:
1 |
# /scripts/pkgacct --skiphomedir siteuser |
Things to check:
- Database names may now have different names on the cpanel server depending on your configuration. Instead of ‘databasename’ it may now be ‘siteuser_databasename’ or something similar.
- Run through the site – make sure all of the client’s pages come up how they’re supposed to – there may have been some special settings in the plesk php.ini or other configuration file that you’ll have to now do on the destination/cpanel server.
You’ll also feel better about yourself because you did it via command line, saved some time.. and can get on with something else now.