How can I migrate or convert a cPanel addon domain to it's own account?

Copying a cPanel addon domain to it's own cPanel account can be quite tricky. It's extremely beneficial, as my own personal preference is for each website to have it's own cPanel account. This makes for much better/easier control and often times can prevent developmental issues down the road. This article will break down the steps recommended for migrating an addon domain to a new cPanel account. There are different methods in which to perform this task, however, this is based on the recommended method from cPanel.

 

Copying a cPanel addon domain to it's own account is not covered by Support's Migration Services, this is considered developmental and proceed with caution at your own risk.

Copying an Addon Domain to a New cPanel Account

You'll need to login to your WHM Panel as the root user. ( https://yourserversip:2087 or http://yourserversip:2086 )

Create a backup of the account containing the addon domain

  1. Navigate to WHM's List Accounts Panel ( Home » Account Information » List Accounts )
  2. Open the cPanel interface for the account containing the addon domain by click the cPanel Logo Icon () located in the "cPanel" column.
  3. In the user's cPanel account, navigate to ( Home » Files » Backup )
  4. Via the Backup Page, click the "Download" button under the "Full Backup" section.
  5. You will then be prompted to pick a backup destination and opt to be notified once the backup is complete. For the destination, ensure that you select "Home Directory".

Create a new cPanel account

  1. Close out of the cPanel user's interface and navigate back to WHM.
  2. Navigate to the Create a New Account Panel ( Home » Account Functions » Create a New Account ).
  3. When creating the new account, which will be used as the migrated destination for your current addon domain, you must not use the addon domain's domain name for this new account. I'd recommend something like 'domainname-newcopy.com'
    • The remain configuration settings and options are strictly up to you.

Extracting the created backup

  1. SSH into your server as the root user.
    • ssh root@serversipaddress -p 2200
  2. Make a new backup directory for the old addon domain account.
    • mkdir /home/backup-oldaccountusername
  3. Move the newly created backup file ( /home/oldaccountusername/backup-10.24.2014_15-59-39_oldaccountusername.tar.gz) into that newly created backup directory.
    • mv /home/oldaccountusername/backup-10.24.2014_15-59-39_oldaccountusername.tar.gz /home/backup-oldaccountusername/
  4. Extract the backup file inside of that directory.
    • cd /home/backup-oldaccountusername
    • tar -xzf backup-10.24.2014_15-59-39_oldaccountusername.tar.gz
  5. Copy the addon domain contents to the newly create cPanel account's html directory.
    • cd /home/backup-oldaccountusername/backup-<date>_<digits>_<oldaccountusername>/homedir/public_html/
    • Determine the folder/directory that the addon domain resides in, for this example, we'll say 'addon directory'.
    • cp -R addondirectory/* /home/newcpanelaccount/public_html

Import the old databases to the new account

  1. Recreate the addon domain's databases and create the database users in cPanel's MySQL Databases interface ( Home » Databases » MySQL Databases ).
    • Prepend new cPanel account to the databases when you create them. ( ex. newcpanelaccount_databasename ).
  2. After you create the databases and database users, import each domain's database backups. To do this, run the following command for each backup:
    1. mysql newcpanelaccount_databasename < /home/backup-oldaccountusername/backup-<date>_<digits>_<oldaccountusername>/mysqloldaccountusername_dbname.sql

Fix the ownership and permissions ( based on suPHP )

  1. Correct all file and directory permissions.
    • find /home/newcpanelaccount/public_html/ -type d -print0 | xargs -0 chmod 0755
    • find /home/newcpanelaccount/public_html/ -type f -not -name "*.pl" -not -name "*.cgi" -not -name "*.sh" -print0 | xargs -0 chmod 0644
    • find /home/newcpanelaccount/public_html/ -type f -name "*.cgi" -print0 -o -name "*.pl" -print0 -o -name "*.sh" -print0 | xargs -0 chmod 0755
  2. Correct all file and directory ownership.
    • find /home/newcpanelaccount/public_html/ -type f | xargs chown newcpanelaccount:newcpanelaccount
    • find /home/newcpanelaccount/public_html/ -type d | xargs chown newcpanelaccount:newcpanelaccount

Confirm that the newly created account works properly

  1. You can test this with instructions from the How can I test my migrated website before changing the DNS? article in or Knowledgebase.

Remove the addon domain (it's ok, you have a backup if anything goes wrong)

  1. Once you've confirmed that the new account works properly remove the old account's addon domain from the cPanel user's interface.
  2. Once logged in to the old account's cPanel interface ( reference ) navigate to the Addon Domains Panel. ( Home » Domains » Addon Domains ).
  3. Scroll down to Modify Addon Domain and select the Delete Action.

Change the new account's domain name

  1. Navigate to WHM's Modify an Account Panel ( Home » Accounts » Modify an Account ) and change the 'temporary' new account domain ( ex. domainname-newcopy.com ) to the addon domain's domain name that is now removed.

Other Useful Resources

  • cPanel's Official Copy Addon Domain Documentation
  • ARN HOST's Migrate Email Account Knowledgebase Article
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

I'm unsure what to put as IP for the resolver configuration in WHM

Please leave default IPs in resolver configuration to give your VPS the best DNS performance...

Is there a way to limit bandwidth for a sub domain or cPanel account for one of our domains?

CPanel allows you to set the bandwidth limit for each account, once you reach the bandwidth...

Powered by WHMCompleteSolution