Magento 2 Installation Guide: Install Magento 2.3 with Sample Data and Composer

Composer is very powerful tool to manage your magento 2 source code. It allows install and update magento 2 very fast, easily install third-party modules/extensions or libraries.

Magento 2.3 installation

Step 1: Install composer

First of all, Check if Composer is already installed:

Run any of these commands in CLI (Command Line Interface / SSH Terminal):

  • composer about
  • composer -v

If command returns composer information, then Composer is already installed and you can follow next step.

To install Composer on your server follow these commands:

  • curl -sS https://getcomposer.org/installer | php
  • mv composer.phar /use/local/bin

Now you need run same command composer about for validate composer installation.

Sometimes, you can’t move composer to general bin path, in this case, you still can use compose with following construction php -f composer.phar about

Step 2: Install Magento 2.3

Magento installation via composer is easy and fast. To install magento via composer follow these commands:

  • create folder for new magento installation: mkdir magento2; cd magento2
  • composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition:2.3 . --prefer-dist --no-interaction --dev, if you have warnings related with php version, you can temporary use flag --ignore-platform-reqs for ignore php version validation.

During composer installation, you can set any required magento version: 2.0, 2.1, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.3

After complete these commands, all magento sources was copied to your magento2 directory and you can run installation using Web Wizard or built-in CLI bin/magento: php bin/magento setup:install --base-url="http://localhost.com" --db-host="127.0.0.1" --db-name=<db_name> --db-user=<db_user> --db-password=<db_password> --admin-firstname="Admin" --admin-lastname="Admin" --admin-email="<your_email>" --admin-user="admin" --admin-password="<your_password>" --use-rewrites="1" --backend-frontname="admin" --db-prefix=mage_

Step 3: Install Sample Data

After magento 2 installation via composer, sample data installation is super easy:

  • php bin/magento sampledata:deploy
  • php bin/magento module:enable --all
  • php bin/magento setup:upgrade

Composer based installation with native sample data is very useful for testing new module on clear magento installation or for check modules compatibility between different magento versions.

Step 4: Check the result

After complete these steps, you should be able open frontend part and backend.

Loading...