Magento2Installation

Please see our September 2017 blog ‘How to Install Magento 2 For Your eCommerce website‘ for the most up-to-date information on this installation.

In this blog, I will teach you how to install Magento 2 on a Mac for local development. In this instance, we will not being using Vagrant, or any virtual layer. It’s a direct installation.


 

System Requirements

1. For the web server, we will use MAMP. If you’re not familiar, MAMP is an excellent tool for setting up a local server environment. We use the free version.

2. PHP will need to be version 5.6.x and up (MAMP will include those versions).

3. MySQL 5.6. The default MAMP MySQL (version 5.5) will not work for Magento 2, which requires MySQL version 5.6. We will need to install an additional MySQL database server to make this work properly. You can get it from hereAlso make sure you use a different port from MAMP MySQL. I am aware that you can probably replace or update MAMP MySQL to use version 5.6 but i did it this way because it faster. If you want to find out more about integrating mysql into MAMP, you can check out this MAMP blog. But to me it too much additional work to do.


 

Installing MySQL 5.6.28 on Mac

1. Download the DMG file from this link: http://dev.mysql.com/downloads/mysql/5.6.html#downloads

2. Mount your DMG (I was able to do this by double-clicking the download) and a window should pop up.

3. Run the .pkg file and the installation window will pop up.Screen Shot 2016-01-10 at 11.19.03 PM4. Click Continue > Continue >Agree > Install > Close

5. Now you should have the correct version of the MySQL database running on port 3306. You may need to restart it. You can connect to it with many database clients or using the command line.

Other Software

You will also need

After you install composer and you get PHP error when running composer that you need a 5.6 at least, it might be because the php you have on your Laptop is what is running from command line(mac has build-in php), and not the php in mamp.

composer_error

How to fix it:

type:  

         which php

  to verify.

if you see  /usr/bin/php  you know it is using the Mac version.

Find the path to your MAMP php by going to:

         cd /Applications/MAMP/bin/php

now look at the versions and choose the path to one 5.6 or greater.

         vi ~/.bash_profile

and add this lines:

PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH


 

Magento 2 Installation

1.  First you will need to configure Apache to handle the Magento 2 path. In my case, I used http://local.magento2:8888/ This can be set up in your /Applications/MAMP/htdocs

how to set it? I’m preaty sure there is many articles on that. Here is piece of virtual host configuration

# Magento_2
<VirtualHost *:8888>
         ServerAdmin ********@*****.***
        DocumentRoot “/Applications/MAMP/htdocs/magento2”
        ServerName local.magento2
        ServerAlias local.magento2
        ErrorLog “logs/local.magento2-error”
        CustomLog “logs/local.magento2-access” common
</VirtualHost>

2.  Get Repository. Run the following command to download the Magento 2 dev files:

         git clone [email protected]:magento/magento2.git

3. Create the database. Let’s call it magento2

mysql> CREATE DATABASE magento2;

4.  Start terminal and cd to magento 2 root folder. From there run:

         composer install

Again, you can download composer here.

3. After composer is done, cd to [magento2_instalation]/bin folder and from there, run the following:

         ./magento setup:install --db-host="127.0.0.1:3306" \
                                 --db-name="magento2" \
                                 --db-user="root" \
                                 --db-password="******" \
                                 --base-url="http://local.magento2:8888/" \
                                 --admin-user="admin" \
                                 --admin-password="**********" \
                                 --admin-email="?????@???????.???" \
                                 --admin-firstname="Name" \
                                 --admin-lastname="Lastname"

You will have to fill some parameters with your related data.

Here is full list of parameters available for install:

setup:install [–backend-frontname=”…”][–key=”…”][–session-save=”…”][–definition-format=”…”][–db-host=”…”][–db-name=”…”]

[–db-user=”…”][–db-engine=”…”][–db-password=”…”][–db-prefix=”…”][–db-model=”…”]
[–db-init-statements=”…”][-s|–skip-db-validation][–http-cache-hosts=”…”][–base-url=”…”][–language=”…”]
[–timezone=”…”][–currency=”…”] [–use-rewrites=”…”] [–use-secure=”…”] [–base-url-secure=”…”]
[–use-secure-admin=”…”] [–admin-use-security-key=”…”] [–admin-user=”…”] [–admin-password=”…”]
[–admin-email=”…”] [–admin-firstname=”…”] [–admin-lastname=”…”] [–cleanup-database]
[–sales-order-increment-prefix=”…”] [–use-sample-data] [–magento-init-params=”…”]

Note that base-url is not a required option.

And after you done. Go to http://local.magento2:8888/ and you should see site like below.

Screen Shot 2016-01-11 at 1.58.15 AM


 

Configuration

Now that you’ve finished installing the Magento application, you need to configure it. Post-install configuration settings will include:

  • Setting up cron
  • Configuring the security settings
  • Enabling the Apache server rewrites
  • Configuring the Server settings
  • Settings for Magento Enterprise Edition (EE) only

For more information on Magento 2 installation and configuraion, visit the Magento 2 Documentation.