Magento Tutorials

How to Install Data Migration Tool in Magento 2

Requirements to install Data Migration Tool

Before the installation of Data Migration Tool make sure you are using same versions of Magento and the Data Migration Tool. It is crucial to have Data Migration Tool version matching to your Magento 2 version.

Check your Magento 2 version

Therefore, you must know what version your Magento 2 is. Follow the following steps to check your Magento 2 version.

Composer metapackage

If you downloaded the Magento software using a Composer metapackage, enter the following command:

php <your Magento install dir>/bin/magento --version

If you cloned the Magento 2 GitHub repository, enter the following commands:

cd <your Magento 2 clone directory>
git branch

If you’re currently in the develop branch, you must change to a released branch before you continue.

Also, notice that if you haven’t installed the Magento software yet, install it now. If you’re cloning the GitHub repository, make sure you check out a release tag as discussed in (Contributor) Clone the Magento repository.

Installing Data Migration Tool

There are two ways to install Data Migration Tool. You can install it using repo.magento.com or use Github repository.

Install from repo.magento.com

  1. Log in to your Magento server as, or switch to, the Magento file system owner.
  2. Change to Magento 2 root directory.
  3. Enter the following commands:
 composer config repositories.magento composer https://repo.magento.com
 composer require magento/data-migration-tool:<version>

where <version> must match the version of the Magento 2 codebase.
For example, for version 2.4.1, enter:

composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:2.4.1
  1. When prompted, enter your authentication keys. Your public key is your username; your private key is your password.

Install from GitHub

If you’ve cloned Magento 2 from the GitHub repository, follow the steps below to install the Data Migration Tool.

  1. Log in to your Magento server as, or switch to, the Magento file system owner.
  2. Change to Magento 2 root directory.
  3. Enter the following commands:
composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool
composer require magento/data-migration-tool:<version>

where <version> must match the version of the Magento 2 codebase.

For example, for version 2.4.1, enter:

composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool
composer require magento/data-migration-tool:2.4.1

This article includes the most basic steps to install Data Migration Tool. Hope it is helpful for you.


See also: