Schogini is Magento2 ready. Are you?

Get started with Magento 2 | Need expert Magento2 support?

Magento2 Installation for MAC


Category: Magento2

Magento released its latest Magento2 Merchant Beta release (1.0.0-beta). It looks like there won't be much structural changes to the final version which is expected to be released soon. So it is time to start experimenting with Magento2.

The first step towards this is the tedious process of installing it. The process of Magento2 beta installation is not straight forward as you might think nor exactly the same as that of previous alpha versions. So in this article, I will guide you through the step by step process of installing Magento2 in your machine.

So lets get started.

Step 1: Installation Prerequisites

Before starting your Magento2 installation, you have to ensure that the following prerequisites are met by your machine.

  • Apache 2.2 or 2.4
  • PHP 5.5.x or 5.6.x
  • MySQL 5.6.x

Once you are sure that you have the prerequisites, you can continue with the installation. If you don't then please ensure that the prerequisite conditions are met before proceeding.

Step 2: Prepare to Install

Installation of Magento2 requires the use of Composer and Git. So after verifying your prerequisites, perform the following tasks in order to prepare for installation.

  1. Install Git
  2. Install Composer

Step 3: Clone Magento2 Repository

Once you have Git and Composer installed, its time to start with Magento2 installation. For this lets create a folder in your localhost (XAMPP or WebServer based on what you are using). This folder will act as the installation folder where we will setup all the necessary things required for the installation. I will be using the name magento2new. You can use your own name.

Once the folder is created, cd into the folder : cd magento2new

Now clone the Magento2 Merchant Beta repository from this link. This may take some time based on your internet connection.

git clone https://github.com/magento/magento2.git

The default branch cloned will be the development branch. So next thing we have to do is to ensure that we switch to the master branch.

git checkout master

Now we have the magento2 repository ready.

Step 4: Preparing the Magento2 Sample Data

The next step is to clone the Magento2 sample data from this link. For our convenience, we will clone this sample data to our installation folder.

 https://github.com/magento/magento2-sample-data.git

Then enter the cloned folder. cd magento2-sample-data

After this, we will have to link the sample data repository with our Magento CE repository as follows:

php -f dev/tools/build-sample-data.php -- --ce-source=“/full/path/to/magento/ce/edition/we/cloned/magento2new/magento2”

So now our sample data also is ready.

Step 5: Configure the Php.ini file

Inorder to install Magento2 successfully, there are some tweaks to be done on the php.ini file as well. Make sure that you are editing the correct php.ini file corresponding to the localhost where you are installing Magento2.

Inside the php.ini file, make sure that the always_populate_raw_post_data is equal to -1 and uncommented and memory_limit value is greater than or equal to 512M.

Step 6: Using Composer to Deploy Sample Data

The sample data is deployed with the help of composer. So the next step is to configure composer.

First cd into the magento2 cloned folder. You will see that there already is a composer.json file. Take a backup of the same :

cp composer.json composer.json.bak

Now edit the original composer.json file and add the following :

  1. Inside "require" array, add one more item “magento/sample-data”: “1.0.0-beta”
  2. Then create a new array "packages" like below “packages”: { “require”: { “magento/sample-data”: “1.0.0-beta” } }
  3. Change the "minimum-stability" value from "alpha" to "beta".

Note: Make sure that are no syntax error while adding these lines. Also ensure that there are no special characters present, if you are copying and pasting the contents.

Now our composer.json file is ready. You can check that file by executing the following command :

composer config

If there is any error in the composer.json file, this command will fail and show you the error.

Next is to configure the composer with the Magento package repository as follows :

composer config repositories.magento composer http://packages.magento.com

Once this is done, add sample data require to the composer using command line. composer require magento/sample-data:1.0.0-beta

Now the composer will be updated, the repositories loaded and dependencies updated. This may take some time. The process will complete by writing the lock file and generating autoload files.

Update the composer to ensure that the necessary dependency files are downloaded.

composer update

Now the sample data is deployed to the Magento2 setup.

Step 7: Changing the Folder and File Permissions

We are getting closer to the actual installation process of Magento2. The next step is to change the file and folder permissions for installation.

chmod 777 var
chmod -R 777 var/*
chmod -R 777 app/etc/*
chmod 777 app/etc
chmod -R 777 pub/media/*
chmod 777 pub/media
chmod -R 777 pub/static/*
chmod 777 pub/static

Note : If these commands are showing any error, try using sudo. Also, ignore any warning displayed related file or directory not found.

Now everything is ready for us to start the actual Magento2 installation process.

Step 8: Magento2 Shop Setup

From this step onwards, we are entering into the actual shop installation of Magento2.

  1. First create an empty database for the Magento2 installation to use.
  2. Now browse the setup url of your magento shop. If you are following this article from the beginning, it will be something like this : http://localhost/magento2new/magento2/setup
  3. On the resultant screen, press "Agree & Setup" button and follow the instructions to setup your magento shop. It includes :

  • Readiness Check
  • Adding/Linking Database
  • Web Configuration
  • Customize Your Store

    Note: Make sure you select "Use Sample Data" option in this page.
  • Create Admin Account
  • Install

Here, when you click the install button, it will start the installation of your magento shop. This will take some time and you will be able to see the progress of the installation along with the Console Log. In the Console Log, you will be able to see what is happening at the moment.

Once the installation is complete, the progress will show 100% and in the console log, you will see the message :

[SUCCESS] Magento installation complete.

Normally, the page will redirect to one success page. But if is not happening for you, then no need to worry. Sometimes it won't come. And you can reset the permissions for the folders to improve shop security.

Now there are couple of more things that are to be done before you start using your shop.

Step 9: Readying the Shop

Even though the installation is technically over, there are a couple of more things that are to be done to prevent any failure.

  1. Empty the cache folder. rm -fR var/cache/*

  2. Change the permission of media folder. chmod -R 777 pub/media Note: Use sudo if required.

  3. Login to the admin area using the admin account created during the installation. If you are following this article from the beginning, it will be something like this : http://localhost/magento2new/magento2/admin Note: Here "admin" may vary depending on what you set during installation.

Step 10: Reindexing the Shop

Once logged into the admin area, go to System > Index Management. Select all and choose "Update on Schedule" option and press Submit.

After the index mode is changed, go to the Magento cloned folder and execute the following command for reindexing. php bin/magento cron:run

Now wait for it to complete. Once it is complete, reload the index management page to ensure that the status is changed from "REINDEX REQUIRED" to "READY". If not, execute the reindexing command multiple times until it becomes ready.

After this, change the indexing mode back to "Update on Save"

Step 11: Clearing the Cache

Once reindexing is complete, we have to clear the cache generated during the installation. Follow the below steps in order:

First empty the cache folder: rm -fR var/cache/*

Then go to cache management in the admin area using System > Cache Management menu and execute the following in order:

  1. Flush Catalog Images Cache
  2. Flush Javascript/CSS Cache
  3. Flush Magento Cache
  4. Flush Cache Storage
  5. Select all cache types and choose the Refresh option before submitting.

This will clear the cache files.

Step 12: Browse the Shop

This is it! Your Magento2 shop is ready to use. You can browse your shop using the frontend url. If you are following this article from the beginning, it will be something like this : http://localhost/magento2new/magento2

You will see your first Magento2 shop in action!


 

Schogini's customer service extends beyond the natural boundaries. ~ Timothy Johnson

Schogini assures 24x7 - 6 hour turn around ticket response time and 24 hour Email response time (support@schogini.com)