This article describes one of the ways to setup Magento 2 on Windows or Linux. This installation can be used for demo and development purposes.

To proceed you will need:

Assuming you’ve installed docker, docker-compose and php, let’s start:

  1. Download Eleanorsoft Utility and put it inside folder where you want to install Magento2.
  2. Run the following command in that folder:
    php esutil.phar magento2/setupAll --docker-skeleton-path="./" --docker-skeleton-name="magento2" --docker-skeleton-port-prefix="800" --docker-docroot-owner="www-data:www-data" --magento2-domain="127.0.0.1"

    See argument description below.

  3. Copy passwords, url, etc. from console
  4. Open http://127.0.0.1:8001/ in your browser.

That’s all. Magento 2 is setup. Its code is located inside www/html folder.

Now let’s describe command arguments:

  • docker-skeleton-path – a path to the folder where your project is going to be set up;
  • docker-skeleton-name – a name of the docker instance;
  • docker-skeleton-port-prefix – the setup requires 3 open ports to work: web server ({prefix}1), phpMyAdmin ({prefix}3) and sftp server ({prefix}4). In our example, we use prefix “800”. It means that web server is going to run on port 8001, phpMyAdmin – 8003, sftp server – 8004.
  • docker-docroot-owner – owner of the project files. In most cases, it has to be www-data. This setting is ignored on Windows.
  • magento2-domain – the domain name on which your store is going to run. Note that Magento 2 does not like localhost as its domain. That’s why we use 127.0.0.1.

During installation, you might get an error about missing PHP extensions. Most of these extensions can be enabled in your php.ini. If you’re installing Magento 2 on Windows, php.ini is located inside your Windows folder or PHP folder. On Linux you can find out its location from the command:

php -i | grep php.ini

To run Magento 2 console commands do the following in your console:

  1. Run (you might need to use sudo):
    docker ps
  2. Find a container with the name of your project and appended _php to it. Copy its ID.
  3. Run
    docker exec -it --user 33 {copied ID} /bin/bash

    inside folder where docker-compose.yml is placed.

  4. You’re inside docker container and able to run different Magento 2 commands.

 

To stop or start Magento 2 instance the following commands may be used (with sudo if needed):

docker-compose stop
docker-compose up -d

Related Post

Docker and Magento: Test and...

In this article, we will describe one of the ways to run Magento 2 on Docker. Docker is a...

Search for ALL words in...

By default Magento 2 QuickSearch feature searches for at least one word from the entered...