I will show you how to install Magento 2.1.1 on a stock MacBook Air OS X 10.11.6 El Capitan. Detailed explanation of what to do you could find below.
It will not require programming. The only toll you will use that you might not know is Terminal Software that is preinstalled on any MacBook.
Installation will require around 2G of free disk space.
Video tutorial is available below.
I will be using Terminal program. Its preinstalled on MacBook Air and you can find it with Spotlight Search.
Terminal lets you run command line programs and it is very useful.
Download Magento 2.1.1
Go to https://www.magentocommerce.com/download and choose a file format that suits you best. I will pick Magento 2.1.1 zip archive with sample data.
Once downloaded extract its content into /Library/WebServer/Documents folder. OS X El Capitan has Apache web server preinstalled and this is its root folder.
Issue these commands in Terminal:
cd /Library/WebServer/Documents unzip /Users/konstantin/Downloads/Magento-CE-2.1.1_sample_data-2016-08-29-06-38-09.zip
Then you will need to find a username Apache is running under and make sure the user can write to /Library/WebServer/Documents.
ps aux|grep httpd
The first columns is our user - _www.
Switch to root user:
and change permissions
chown -R _www:wheel /Library/WebServer/Documents chmod -R 775 /Library/WebServer/Documents
Now Magento 2 code files are ready.
Install and setup MySQL 5 Database Server
Go to http://dev.mysql.com/downloads/mysql/ and download MySQL Community Server for Mac OS X. Choose DMG Archive.
Once downloaded double click on the file and follow instructions. It should be a simple next-next installation.
Important: It will generate root mysql password for you - copy it for later use.
Once installed you need to start MySQL Server - go to System Preferences and click on MySQL icon at the bottom.
Then click on start the server
That is it. MySQL Server should be up and running.
Now we need to create a database for our Magento 2.
Run in terminal:
mysql -uroot -p
then enter mysql root password you copied earlier.
Once in mysql command mode issue:
create database magento2; grant all on magento2.* to 'magento2'@'localhost' identified by 'demo123';
Now we have created MySQL Database:
- username - magento2
- database - magento2
- host - localhost
- password - demo123
Prepare Apache Web Server and upgrade PHP
You will need to edit Apache settings. Enable rewrite_module - edit file /etc/apache2/httpd.conf and uncomment:
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
In the same file search for <Directory "/Library/WebServer/Documents"> and a couple of lines below it change AllowOverride to All:
Now Magento 2 can overwrite apache settings with .htaccess file.
Magento 2 requires PHP 5.5+. By default MacBook Air OS X El Capitan has PHP 5.4 so we need to upgrade it.
Please follow these instructions to upgrade PHP 5 on El Capitan https://coolestguidesontheplanet.com/upgrade-php-on-osx/
I will put a command here if the above link goes dead: run this in terminal as root:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
you PHP should now be upgraded.
Create a simple phpinfo.php file inside /Library/WebServer/Documents with the content:
<?php echo phpinfo() ?>
Then follow this link http://localhost/phpinfo.php - you should see PHP 5.6
Install Magento 2 with Setup Wizard
Now go to http://localhost - it should redirect you to Magento 2 Installation Page.
Follow instructions and let Magento 2 install itself automatically.
If you find this post interesting do not hesitate to sign up for our newsletter and join the 692 people who receive Magento news, tips and tricks regularly.