Migrating from InterWorx to cPanel

Posted on by Andrej Walilko | Updated:
Home > Blog > Migrations > Migrating from InterWorx to cPanel

With unlimited site hosting per license and solid core features, SMB customers who do not use any cPanel-specific features could save big money by switching to InterWorx. There may be cases, though, where migrating from InterWorx to cPanel is necessary to consolidate services, add a cPanel-specific feature, or integrate two businesses using different panels.

While InterWorx has an import feature that will take backups from cPanel servers and restore them as valid InterWorx accounts, making migrations to the platform simpler, the reverse is not true. Migrations from InterWorx to cPanel will need to be performed manually.

With the right general knowledge and specific information about your server usage, this type of migration can be executed in a few hours for a small number of sites.

how to migrate between cpanel to interworx or interworx to cpanel

Considerations Before Starting

While there are a few blockers in moving from cPanel to InterWorx, these particular blockers are only in one direction. For instance, InterWorx requires database prefixing in all cases to map databases to their owners, but cPanel does not. So, there should not be a case where a database name will cause an import to fail.

One important thing to remember about cPanel is its licensing costs. InterWorx allows for an unlimited number of SiteWorx accounts per server, but cPanel costs will change depending on how many cPanel accounts you need to create. 

Things you will need to consider before moving from InterWorx to cPanel:

  • What will your final price will be for the content you need to host?
  • What is the forecasted growth for your business, and how much space and power will your server require?
  • Do you have the right licenses and software to support your goals?

Another consideration is server clustering. Out of the box, InterWorx can support multiple web nodes working in unison to balance traffic. cPanel does not support this by default, and additional products will be needed if you use this feature. 

Note:
Chat with our Solutions Team if you need to have load-balanced traffic to multiple cPanel servers.

As far as general server migration considerations go, you should have a good understanding of where the DNS for your domains is hosted (your nameservers). At the conclusion of your migration, you will need to make changes to the DNS to make the new server live, and ensuring access to your nameservers early in the process makes the final turnaround faster.

If possible, lower the TTL values on your records now so that when we take the new server live, propagation will happen quickly.

Additionally, be aware of the features that you use on your server. If you host mail, make sure your mail accounts, along with their passwords and mailbox contents, are copied during the migration and that any in-use mail ports are opened and set up on the new server. If you use Redis, Memcache, or any other 3rd party applications, make sure those are set up on the cPanel machine ahead of time as well.

There is not much to be done in InterWorx, specifically to get ready for your migration. In general, you will want to be sure that updates to your sites (new posts, product releases, etc.) are temporarily suspended to lower the chances of lost data and that your sites are on up-to-date core software, such as PHP 7 or greater.

1. Creating cPanel Accounts

Now, we can finally get to work on migrating! First, assemble a list of all of the SiteWorx accounts on your server that you wish to migrate. As root on the InterWorx server, you can use this command to do so:

nodeworx -u -c Users --action listUsers -n

You can relate these to hosted domains using this command, also run on the InterWorx machine:

nodeworx -u -c Siteworx -a listDomainAccounts -n |tr "\t" "|" |awk -F"|" '{print $10,$2,$11,$19,$22}' |column -t

This should print out the domain name, username, whether it is a primary or secondary domain, its PHP version, and the location of the document root for the site.

Make Users

cPanel accounts can be created through the WHM interface or as root from the command line on the cPanel server:

/scripts/createacct yourdomain.com youruser EB-al2pK)*o=

If you happen to know the passwords for all of your SiteWorx users, you could enter them above. Random passwords will work here if they are suitably secure, and users can reset them after the migration is complete. You can also copy the password hashes directly from /etc/shadow into the new server if you are comfortable doing so.

Note:
Regardless of how you migrate your passwords, it is highly recommended that users change their password after the migration is complete. Passwords that are typed plaintext into the command line would be saved in bash history and could be exposed by root level users. Even if you import hashes directly, it is a good security practice to change your passwords every few months.

Make Mailboxes

With the accounts, you should also create mailboxes that belong to each account. This can, again, be done through the cPanel web GUI or from the command line.

Run this command on the cPanel server to add a mailbox:

/scripts/addpop user@yourdomain.com /tQ7biFJ]24%
Note:
There are some special characters like \, |, or !, that will cause odd behavior in the command line when used in a password. If you get odd output from the createacct or addpop commands, try using a different random password.

The passwords for mailboxes can be entered, if known, or updated later in /home/youruser/etc/yourdomain.com/shadow files on the cPanel server. The original mailbox password hashes can be pulled using this command on InterWorx:

mysql -Ns -u iworx_vpopmail -p$(grep mysqli\:\/\/iworx_vpopmail\: /home/interworx/iworx.ini | cut -d: -f3 | cut -d@ -f1) -S /usr/local/interworx/mysql/iworx-db.sock iworx_vpopmail -e "select pw_passwd from vpopmail where pw_name='user' and pw_domain='yourdomain.com'"

Above, you would replace the user and yourdomain.com near the end of the command with the real mailbox and domain name to get the hash for that user. Again, you should only do this if you are comfortable with editing the shadow files for your mailboxes; otherwise, it is easier to simply let the users reset their mail passwords once the migration is complete.

Make Databases

Going off of a list of databases from the source server, which you can get from listing the /var/lib/mysql directory and looking for user-prefixed folders, generate databases individually using this command on the cPanel server:

mysqladmin create youruser_dbname

After creating the databases, you will need to add users as well. This command, run on the InterWorx server, gets the database users that have access to the database you specify and makes a grant command that you can paste into your cPanel machine’s terminal. Be sure to change youruser_dbname at the beginning of the command to the database you are working on when you run this on the InterWorx server:

mydb=youruser_dbname; mysql -BNe "select user from mysql.db where db='"$mydb"' and host='localhost'" | while read i; do pwhash=$(mysql -BNe "select Password from mysql.user where Host='localhost' and User='"$i"';"); echo "mysql -e 'grant all privileges on $mydb.* to $i@localhost identified by password \"$pwhash\"'"; done

Paste the output into your cPanel server to grant access. 

Finally, we need to map the database and new user so that it can be controlled from the right account. Use this command on cPanel, replacing all of the yourxxxx portions as needed:

/usr/local/cpanel/bin/dbmaptool youruser --type mysql --dbs 'youruser_dbname' --dbusers 'youruser_dbuser'

2. Copying Files

Now that we have a spot on the cPanel server for all of our site files, emails, and databases to land, we can begin copying them over. All of the sample commands below are run on the cPanel server and will need to be updated with the appropriate IP address of the InterWorx machine. This step is greatly simplified if you add an SSH key from the cPanel server into the InterWorx server for passwordless root-level SSH access.

Note:
If your InterWorx server is not using port 22 for SSH, you will need to add the following bit (with the correct SSH port) to your rsync commands along with the rest of the flags: -e ‘ssh -p9898’

Document Roots

The individual domain information we discovered at the beginning of the migration process will be very handy here. Match up logically all of the accounts you created to the accounts in InterWorx. For our examples, we will assume that the cPanel username is the same as the InterWorx username and that every account only controls one domain.

This command to copy a primary domain document root from InterWorx to cPanel is run on the cPanel server:

rsync -avHP 123.45.67.89:/home/youruser/public_html /home/youruser/

Be sure to watch the trailing slashes! This command copies public_html and its contents from the remote InterWorx machine into the /home/youruser/ folder on the local cPanel machine.

If there are additional document roots to copy into additional separate folders, you can use similar commands with the proper target folder.

Emails

Emails are copied using an rsync command as well since they are stored in a similar folder-based format on both systems. Here is the command for the sample email address we created earlier, which will be run from the cPanel server:

rsync -avHP 123.45.67.89:/home/youruser/var/yourdomain.com/mail/user/Maildir/ /home/youruser/mail/yourdomain.com/user/

There are a number of unique items that need to be altered throughout this command based on the account, mail user, and domain you are syncing data for, including youruser (the cPanel/InterWorx account name), yourdomain.com, and user (the mailbox name).

Databases

Databases can be streamed from the InterWorx server over to the cPanel server directly using a simple pipeline. This avoids having to generate a file-based dump and then copying and reading that file. Our same sample database is copied here, and this command is run on the cPanel machine:

ssh 123.45.67.89 "mysqldump youruser_dbname" | mysql youruser_dbname

Additional Items

There are a few miscellaneous files that can also be copied to create a more complete clone of the InterWorx accounts. Specifically, the crontab can be read from /var/spool/cron/youruser and its contents inserted into the same file on the cPanel server. Just be sure that you are not going to prematurely run any crons that could double-bill your eCommerce sites or duplicate other functions that are still being performed by your old machine.

This is also a great time to double-check and set up any programs from the source machine that you would like to continue using like ElasticSearch, NGINX, ImageMagick, and so on, if you did not do so before starting the transfer. You should also set any configuration limits that you changed to allow your sites and server to work together better such as those in PHP/Apache or CSF; however, a new server is also cause for a new tuning session.

3. Testing Migrated Sites

When you finish all of the above steps, you’ll be able to test the sites on the new server. Start by changing the hosts file. Hosts file editing is a much more accurate method than any other available option. Start by making a line of text like this one with the IP of the new server then a list of domains and subdomains you want to test, separated by spaces:

11.22.33.44 yourdomain.com www.yourdomain.com

Add that line to the end of the hosts file on your workstation (not either server). You can then test the site by visiting it in your browser normally, without having to change public DNS or use a less accurate proxy service. 

While testing the new server, you generally want to be sure that sites aren’t missing any images or CSS files or giving any other glaring errors. Troubleshoot as needed to correct these before going live.

4. Going Live

To shift traffic from the old server to your new one, the only remaining step is a DNS update of all of the records that are referencing the old IP. There is usually a single A record that points to the IP address of the source server (123.45.67.89 in our example), which will need to be changed to the new IP.

You will need to discover where your DNS is hosted, which you may have done in the first stages of the migration. 

There are many options for where your DNS is controlled. You might currently use Liquid Web’s shared nameservers, in which case, you can change your DNS at My LiquidWeb or by sending us a support ticket. 

You might also have DNS at your registrar or at CloudFlare. In that case, you would do the same IP address change but at the appropriate control panel for that nameserver.

The other possibility is that you control DNS on InterWorx itself with custom nameservers. The menu you need can be accessed from NodeWorx  >   System Services  >   DNS Server  >   Zones.

Note:
If you fall into this category, the Nameserver Glue records at your nameserver’s main domain’s registrar will also need to be changed. Otherwise, DNS will continue to be served by InterWorx, and terminating that server would take your sites offline. Any registrar should be able to guide you on glue record changes so that DNS can also be shifted to cPanel when the migration is done.

Changing the IP addresses will make your new server live, and your migration is now complete. 

Traffic should start flowing to the new server as the TTL value on your DNS slowly expires. This is why lowering the TTL value is important to do at the beginning of your migration.

Liquid Web Knows Migrations

If this guide sounds a bit too intense, don’t worry. We have a dedicated Migrations Team available to help all of our Fully Managed customers, with decades of experience successfully migrating websites into cPanel environments. Reach out to the Support Team 24/7 through My LiquidWeb to get more information today.

Avatar for Andrej Walilko
About the Author

Andrej Walilko

Andrej Walilko (RHCE6) is a seasoned Linux Administrator, and he is a Migration Project Manager at Liquid Web, developing specialized processes for complex migration types. He enjoys doing woodworking, home improvement, and playing piano in his free time.

View All Posts By Andrej Walilko