How to Install and Configure Magento 2 Data Migration Tool?

Today, we’re going to teach you guys how to install & configure Magento 2 data migration tool.

The Magento 2 data migration tool is necessary if you want to migrate your Magento 1 store to Magento 2 platform.

It is a command-line interface that is used for transferring data from Magento 1 platform to Magento 2 platform.

The tool basically verifies the consistency between database structures of Magento 1 & Magento 2, monitors the data transfer progress, generates logs, and performs data verification tests.

So, if you’re planning to migrate your Magento 1 store to Magento 2 (which you should), then you need to learn how to install & configure Magento 2 data migration tool.

In this post, we will show you the complete, step-by-step process of both, how to install Magento 2 data migration tool & how to configure it.

With that being said, let’s dive right in!

Recommended: 2 Ways to Install Data Migration Tool in Magento 2

Steps to Install Magento 2 Data Migration Tool

Before we begin the process to install Magento 2 data migration tool, the first thing you need to make sure is that the version of your Magento 2 store & the version of the Magento 2 data migration tool is same.

For instance, if you’re Magento 2 version is 2.2.0, then you must download & install the Magento 2 Data Migration Tool version 2.2.0.

Follow below steps to install Magento 2 Data Migration Tool.

Step 1. Check Your Magento 2 Version.

Step 2. Update the Data Migration Tool Package in the Composer.json File.

Step 3. Obtain Developer Authentication Keys.

Step 4. Submit Your Developer Authentication Keys.

Let's deep dive into the each step.

Step - 1

If you don’t know the version of your Magento 2 store, simply navigate to the root directory of your Magento 2 using SSH and execute the following command:

php bin/magento --version

Step - 2

After that, we need to update the data migration tool package in the composer.json file by executing the below commands:

composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:<version>

In the above command, the <version> refers to the version of the tool, which is the same as your Magento 2 version.

For instance, if your Magento 2 version is 2.2.0, then you should write the above two commands like this:

composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:<version>

Step - 3

Next, you’ll need to submit your developer authentication keys.

To obtain them, go to Magento Marketplace, log in to your marketplace account, open your profile, and click on the Access Keys under the My Products section.

Step - 4

Now, you need to enter your public key in the username field & private key in the password field.

You can also create new keys by clicking on the Create a New Access Key button.

And that’s about it!  You’ve now successfully installed the Magento 2 Data Migration Tool in your Magento 2 store.

Step to Configure Magento 2 Data Migration Tool

Once you’ve installed the Magento 2 data migration tool, it’s time to learn how to configure it properly in your Magento 2 store.

Follow below steps to configure Magento 2 Data Migration Tool.

Step 1. Open Directories That Contain Your Mapping and Configuration Files for Magento 2 Data Migration Tool.

Step 2. Open Commerce Migration Directory for migrating from Magento 1 Open-Source to Magento 2 Commerce.

Step 3. Open Commerce-to-Commerce Directory for migrating from Magento 1 Commerce to Magento 2 Commerce.

Step 4. Create a Config.xml file.

Step 5. Open the Config.xml file in a code editor tool and paste the given code. Save the config.xml file to finish the process.

Let's deep dive into the each step for correct configuration.

Step - 1

First of all, execute the following command to open directories that contain your mapping and configuration files for Magento 2 data migration tool.

<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource

the above directory contains configuration and scripts for migrating from Magento 1 Open Source to Magento 2 Open Source.

Step - 2

After that, execute the following command:

<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource

the above directory contains configuration and scripts for migrating from Magento 1 Open-Source to Magento 2 Commerce.

Step - 3

Next, execute the following command:

<Magento 2 root dir>/vendor/magento/data-migration-tool/etc/commerce-to-commerce

the above directory contains configuration and scripts for migrating from Magento 1 Commerce to Magento 2 Commerce.

Step - 4

Now, before you migrate any data and settings, you need to create a config.xml file.

For instance, if you’re performing migration from Magento 1 Open Source to Magento 2 Open Source, then you need to navigate to <Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version> directory and rename the file config.xml.dist into config.xml.

Step - 5

After that, you need to open the Config.xml file in a code editor tool and paste the following code:

<source>
    <database host="localhost" name="Magento1-DB-name" user="DB-username" password="DB-password"/>
</source>
<destination>
    <database host="localhost" name="Magento2-DB-name" user="DB-username" password="DB-password"/>
</destination>
<options>
    <crypt_key>Magento1-Encrypted-Key</crypt_key>
</options>

Once you’ve added the code, save the config.xml file to finish the process.

Also read: What are the Pros and Cons of Migration to Magento 2?

Final Note

And that’s it! This is the easiest way to install & configure Magento 2 Data Migration Tool.

And if you need our professional assistance for Magento 1 to Magento 2 Migration, feel free to contact us anytime.

Magento 2 Migration Services