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

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:

[php]
$ mkdir magento2
[/php]

Create new Magento 2 Community Edition project using composer:
[php]
$ composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition magento2
[/php]

Log in to a MySQL console as root:
[php]
$ mysql -u root
[/php]

Create a new database:
[php]
$ create database magento2tutorial;
[/php]

Create the new database user with permissions for magento2tutorial database:
[php]
$ GRANT ALL PRIVILEGES ON magento2tutorial.* To ‘magento2’@’localhost’ IDENTIFIED BY ‘123123q’;
[/php]

Exit from database console:
[php]
$ exit
[/php]

Change permissions for magento script:
[php]
$ chmod a+x bin/magento
[/php]

Install Magento 2 via command line:
[php]
$ 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
[/php]

Open an Apache2 httpd-vhosts.conf file:
[php]
$ sudo vi /etc/apache2/extra/httpd-vhosts.conf
[/php]

Add new virtual host:
[php]

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

[/php]

Open hosts file:
[php]
$ sudo vi /etc/hosts
[/php]

Add a new record with the custom domain name:
[php]
127.0.0.1 tutorial.magento2.dev
[/php]

Restart Apache2 server:
[php]
$ sudo /usr/sbin/httpd -k restart
[/php]

Install Magento 2 Sample Data using the sampledata:deploy command:
[php]
$ bin/magento sampledata:deploy
[/php]

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:
[php]
$ bin/magento setup:upgrade
[/php]

Subscribe to my Channel

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


Posted

in

,

by

Comments

Leave a Reply