Thursday, 16 June 2016

Magento 2x configuration on locahost

Hey Mage freaks!!
Hope you guys are aware of the latest release of Magento 2x.
If you are finding trouble in configuring and installing, have a gaze ! :P

I have also included the procedure for migrating my mage from 1x to 2x.
Any queries please feel free to comment below and you guys are always welcome to share your ideas too.

Magento 1x to 2x DB migration

     1)  Install Magento 2.1.0 CE on windows with XAMPP
Prerequisites for Magento 2:
>  PHP 5.5x>
>  Apache  2.2 or later
>  Required PHP extensions: Uncomment/ enable :
(Changes to be done in php.ini to avoid errors during installation)

memory_limit = 1024M
always_populate_raw_post_data = -1
extension_dir="C:\xampp\php\ext"   (has to be php’s location)
               >  MYSQL 5.6x

NOTE: For enabling the above extensions in Linux Ubuntu , with PHP 7.0 you must use next commands:
                     sudo apt-get update
          sudo apt-get install php7.0-gd php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-openssl php7.0-zip
          sudo service apache2 restart 

      2)      Download and install Composer (

      3)      Clone Magento 2x / Download zip from GitHub (

            4)      Change permissions of Magento 2 directories: (770 permissions)
      /var , /pub/media , /pub/static , /app/etc 
5)      Install composer under root folder of Magento 2
(Under root folder magento 2, Shift right click-> Select ‘Open command window from here’) and in the command window:
             Run ‘composer install



            6)      Create a DB in phpmyadmin
            7)      Head over to browser now and go to the url : http://localhost:1338/magento2/
             You should be able to see this screen
           8)         Click on Agree and Setup Magento and click next. It will start Readiness Check, like php version, php settings check, Php extensions check, File permission check.

          9)      You should receive following screen if everything goes fine. Click Next.


  10)      Next screen is to configure the database details and follow the on screen procedure and create an admin account. 

11)      Once installed, go to frontend and backend to check the brand new Magento 2.0.

Issues which might arise post installation:
i)  JS/ CSS images not loaded properly in Magento front end
Under root folder of magento 2, run the below command: (using any linux supported tool: Cygwin or Sublime 3)
php bin/magento setup:static-content:deploy

            The above command will copy all the static resources from each module to the pub/static folder

ii)                  To reindex: php bin/magento indexer:info    (To get indexer name)
         php bin/magento indexer:reindexall  (Reindex all)
         php bin/magento indexer:reindex indexer_name   (reindex specific)

iii)                To clear all cache:
                 Navigate to /var/cache: 
                  rm –rf *
Enable the cache use this:
php bin/magento cache:enable

Disable the cache use this:
php bin/magento cache:disable

Flush the cache use this:
                        php bin/magento cache:flush

Clean the cache in the site:
                       php bin/magento cache:clean

DB Migration contd…
      12)       Now we are ready for DB Migration!!

         Step 1: Make a folder named “migrate_data_tool” in your web root.
                         For example:   PATH_TO_YOUR_WEB_ROOT_FOLDER\migrate-data-tool.

     Step 2:  Download the latest version of this tool at Magento 2 Data Migration 

     Step 3: Extract all source code from downloaded file to the folder you have just created.   

     Step 4:  Make Writeable permissions for the below folders and file.

·                                                             /root folder/migrate-data-tool/assets

·                                                           /root folder/migrate-data-tool/protected/runtime

·                                                          /root folder/migrate-data-tool/protected/config/config.php

      Step 5: Open your browser and type in the URL to run this tool. (For example: go to                                        http://localhost:1338/migrate-data-tool/) and press Enter key.

                                Enter the below details and click on the save button.
  • Version: To select version of Magento.
  • Database Server Host: identify the database server host name.
  • Database Server Username: identify the username of database server.
  • Database Server Password: identify the password of database server.
  • Table Prefix: identify the table prefix.

Step 6:  Follow step by step to migrate needed data from Magento1x website to Magento2x                 website by clicking next step button.


      Step 7: Follow the on screen procedure for the remaining steps (Step 3-7) and reindex all data                          in your magento2 instance.

                         To reindex: In your terminal window run bellow command:
                                 php -f bin/magento indexer:reindex

To Copy media files

      Step 8: Copy the folder PATH_YOUR_MAGENTO_1/media/catalog from Magento1 and                             paste replace to PATH_YOUR_MAGENTO_2/pub/media/ folder of Magento2.

      Step 9: Copy the folder PATH_YOUR_MAGENTO_1/media/downloadable from Magento1                        and paste replace to PATH_YOUR_MAGENTO_2/pub/media folder of Magento2.
                      Make recursive write permission to “catalog” and “downloadable” folders which you                           have just copied.

                    Clean Magento 2: In your terminal window run below command: 
                                              php -f bin/magento cache:flush

                    Upgrade Password Hash (This is optional task for more security):

                    In your terminal window run bellow command
                                             php -f bin/magento customer:hash:upgrade

                                 Magento 1x to 2x Code migration

Above mentioned Prerequisites for Magento 2 follows.

      1)      Clone or download the zip of  ‘Magento 2 code migration develop’ toolkit from GitHub

        Scope of the above toolkit covers magento2 code migration of the following:
·         Module directory structure
·         Layout XML files
·         Config XML files
·         PHP files

2)  Create the following directories anywhere in the file system, not in the directory where you have         your Magento installed and paste the downloaded toolkit folder the same path as shown: 


src -  Directory that contains custom Magento 1.x code that is intended to be migrated. The    code must follow the Magento 1.x directory structure. Magento 1.x core files must not be included.

dst- Empty directory for the toolkit to put the generated Magento 2 code.

m1- Directory that contains:
·         Magento 1.x codebase, and
·         Custom Magento 1.x code same as in src directory, and
Dependencies of the custom Magento 1.x code, if any, that are not part of src directory as not intended to be migrated at the moment

m2- Directory that contains the Magento 2.x codebase. 

                                                    How the toolkit works?

The scripts read the Magento 1.x code from the src directory, convert it, and write the transformed code to the dst directory. All converted code is saved to files with a *.converted extension. The directories m1 and m2 are used to lookup the context of the code being migrated.