preloder

Video – How to Install Magento 2 with Sample Data via Command Line

Prev Next

I made it. I’ve started my Magento video series where I am planning to share my knowledge about Magento 2. Please welcome my new Magento DevChannel Youtube channel.

It took me a year after I promised to start Video Blog back in January 2016 and actually made it in February 2017. In the first video, I show How to Install Magento 2 with Sample Data via Command Line. We go through a set of commands required to download, install and configure Magento 2 on a local environment.

As this is my first Magento tutorial video I am expecting feedback from you guys to adjust myself and the way I record the video for the future. Leave the comments below or email me. Enjoy watching.

Prerequisites

You should have the following tools installed on your environment:

  1. PHP 5.6+, better to have PHP 7.0.x
  2. Apache2
  3. MySQL 5.6 or 5.7
  4. Composer

Commands for installing Magento 2

Create new directory:

$ mkdir magento2

Create new Magento 2 Community Edition project using composer:

$ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2

Log in to a MySQL console as root:

$ mysql -u root

Create a new database:

$ create database magento2tutorial;

Create the new database user with permissions for magento2tutorial database:

$ GRANT ALL PRIVILEGES ON magento2tutorial.* To 'magento2'@'localhost' IDENTIFIED BY '123123q';

Exit from database console:

$ exit

Change permissions for magento script:

$ chmod a+x bin/magento

Install Magento 2 via command line:

$ bin/magento setup:install --base-url=http://tutorial.magento2.dev --db-host=localhost --db-name=magento2tutorial --db-user=magento2 --db-password=123123q --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com --admin-user=admin --admin-password=123123q --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1

Open an Apache2 httpd-vhosts.conf file:

$ sudo vi /etc/apache2/extra/httpd-vhosts.conf

Add new virtual host:


ServerName tutorial.magento2.dev
DocumentRoot "/Users/pronko/Sites/tutorials/magento2/pub"
ErrorLog "/private/var/log/apache2/magento2-error_log"
CustomLog "/private/var/log/apache2/magento2-access_log" common
ServerAdmin user@example.com

Open hosts file:

$ sudo vi /etc/hosts

Add a new record with the custom domain name:

127.0.0.1 tutorial.magento2.dev

Restart Apache2 server:

$ sudo /usr/sbin/httpd -k restart

Install Magento 2 Sample Data using the sampledata:deploy command:

$ bin/magento sampledata:deploy

Create new Public/Private Key from www.magento.com website and enter it when CLI will request Username and Password.

Run upgrade command to install Sample Data:

$ bin/magento setup:upgrade

Subscribe to my Channel

If you like my first video go ahead and subscribe to my Magento DevChannel Youtube channel.

Posted on Feb 27, 2017

Magento 2

Developer Training

27-28 February, 2019, London

Learn More

The Devletter

Subscribe to my Magento 2 tips and tutorials content.
Every week I send an interesting email directly to your inbox

Related Posts