Magento 2 installation on MEMP (Mac OS X + Nginx + MySQL + PHP-FPM) stack

September 7, 2015  |  6 Comments  |  by Raj (MagePsycho)  |  Mac OS-X, Magento, Magento 2

Magento is a highly customizable e-commerce platform and content management system that you can use to build online storefronts or web sites for selling merchandise. Magento provides common e-commerce features, such as shopping carts and inventory management, and encourages extensive customization to meet your organization’s specific goals.

Magento 2 Merchant Beta codebase was released on July 15, 2015. This is a significant milestone before the general availability of Magento 2 in Q4 2015.

Before you begin installation

1. MEMP(Mac OS X + Nginx + MySQL + PHP-FPM) stack should already be installed & configured in your system. And system should meet the requirements discussed in Magento system requirements.

If MEMP stack is not installed, I would recommend homebrew package manager for installation.
2. Some Assumptions
Magento Dir: ~/Sites/opensource/magento/magento2beta
Virtual Host: magento2beta.dev

Once your MEMP system is ready meeting all the requirements, you are ready to move ahead for the installation.

Installation Steps

1. Create the project folder & clone the magento2 codebase

mkdir ~/Sites/opensource/magento/magento2beta && cd ~/Sites/opensource/magento/magento2beta
git clone git@github.com:magento/magento2.git .
Git Clone Magento2

Git Clone Magento2

2. Checkout to master branch

git checkout master

OR you can directly use the following command while cloning:

git clone -b master https://github.com/magento/magento2.git
Git Checkout Master Branch

Git Checkout Master Branch

Note:
You can clone either the master or develop branch:
– master is more stable
– develop is more recent

Initially we had an issue installating the sample data with develop branch, which resulted in the following error:

Fatal error: Call to undefined method Magento\Catalog\Model\Resource\Product\Interceptor::getWriteConnection() in app/code/Magento/SampleData/Module/Catalog/Setup/Product/Gallery.php on line 144

Sample data installation error in Magento 2

Sample data installation error

Due to recent changes, you can now use sample data with either the develop branch (more current) or the master branch.

3. File permission

chmod -R 755 ./

4. Update Magento dependencies using Composer
Install Composer if it’s not already installed:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Now run Composer to update dependencies:

composer install

This command updates package dependencies and can take a few minutes to complete.

Update Magento dependencies using Composer

Update Magento dependencies using Composer

5. Install sample data before Magento installation

– Edit composer.son:
In the first section, add “minimum-stability”: “beta”, before license.

then run the following commands:

composer config repositories.magento composer http://packages.magento.com
composer require magento/sample-data:1.0.0-beta

Sample Data Installation

Sample Data Installation Result


Note: You can also install sample data after Magento installaiton

[EDIT]
Magento 2 dev team has an updated version on how to install sample data:
http://devdocs.magento.com/guides/v2.0/install-gde/install/web/install-web-sample-data.html

6: Finally install Magento System
Run following command in order to install the Magento system:

php bin/magento setup:install --base-url=http://magento2beta.dev/ \
--db-host=localhost \
--db-name=magento2beta \
--db-user=root \
--db-password=root \
--admin-firstname=Raj \
--admin-lastname=KB \
--admin-email=myemail@gmail.com \
--admin-user=admin \
--admin-password=pass123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--sales-order-increment-prefix="ORD$" \
--session-save=db \
--use-rewrites=1 \
--use-sample-data \
--cleanup-database

To find more information on command options, please check the following url:
http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-install.html#instgde-install-cli-magento

Magento 2 - CLI Installation

Magento 2 – CLI Installation

Magento 2 - Installation Complete!

Magento 2 – Installation Complete!

7: Installation Complete!
Now you can explore the frontend and backend.
Some Screenshots:

Magento 2 - Homepage

Magento 2 – Homepage

Magento 2 - Category Page

Magento 2 – Category Page

Magento 2 - Product Page

Magento 2 – Product Page

Magento 2 - Cart Page

Magento 2 – Cart Page

Magento 2 - Checkout Page

Magento 2 – Checkout Page

Magento 2 - Admin Dashboard

Magento 2 – Admin Dashboard

Have fun with Magento 2!