Magento 2 Installation Guide

- Magento 2

How to install Magento 2

In this post, we’ve gathered all the necessary information about Magento 2 installation. The new version of the platform has been finally released, so don’t hesitate to find out how to install the Magento 2 software. Below, we discuss different approaches to the Magento 2 installation from the use of the Setup Wizard to more complicated procedures based on Composer and the command line. To get more information about Magento 2 check our main Magento 2 Overview .

All  Magento 2 features, rumours, and roadmap on Firebear

4 Types of Magento 2 Installation

Before starting our Magento 2 installation guide, we’d like to introduce you to 4 major approaches to this procedure. Below, you will find their descriptions as well as links to official guides. Magento 2 offers the ability to perform an easy installation and at the same time do everything to contribute code to its codebase. Of course, each approach has unique requirements, so let’s begin with the easiest one.

Simple installation on your own server

Easy installation on your own server does not require any complicated tricks with the command line. You only need some technical expertise as well as command line access to your Magento server. This Magento 2 installation consists of the following steps:

  1. Download a compressed file with the Magento software.

  2. Then, you should extracts it on your Magento server.

  3. Now, install the software via the Setup Wizard. Alternatively, you can rely on the command line.

Simple installation on shared hosting

This approach to the Magento 2 installation is similar to the aforementioned one. The only difference here is in the usage of shared hosting. Get ready to find a hosting provider and perform a small technical expertise. You are alredy familiar with the installation steps:

  1. Take a compressed file with the Magento software.

  2. Extract it on the server.

  3. Install the software via the Setup Wizard.

The metapackage

If you need a full control over all installed components of Magento 2, then this type of installation is for you. It is highly technical, provides access to your Magento server, and offers the ability to repackage Magento CE with other components. To install Magento 2 in such a way, do the following:

  1. Creates a new Composer project with the list of components you want to use.

  2. Update your package dependencies via the same tool. Use the composer create-project command to get the metapackage.

  3. Now, you can install Magento 2 via the command line. The Setup Wizard can be utilized as well.

Cloning the Magento 2 repository

If you are a contributing developer who has a huge experience in using Composer and GitHub, then you might be interested in cloning the Magento 2 repo.

  1. Clone the Magento 2 repository on GitHub.

  2. Update package dependencies via Composer.

  3. Installs the software. Use either the Setup Wizard or the command line.

Now, when you know 4 major approaches to Magento 2 installation, we can go further.

Magento 2 Installation Guide

Magento 2 System Requirements

Magento 2 Installation Guide

This is the set of system requirements for Magento 2:

  • Operating systems: Linux distributions (RHEL, Ubuntu, CentOS, Debian, etc)
  • The latest stable version of Composer
  • Apache 2.2 or 2.4 (don’t forget to enable mod_rewrite module)
  • PHP: 5.4.x (x is 11 or above); 5.5.x
  • PHP extensions: PDO/MySQL, mcrypt, mbstring, mhash, curl, simplexml, gd2, ImageMagick 6.3.7, soap
  • MySQL 5.6.x
  • SMTP server of MTA

There are some optional but also very important recommendations: php_xdebug2.2.0 or above (development environments only); PHPUnit 4.1 or above as a tool for command-line.

Composer and Magento repository

Composer and Magento

How to install Magento 2

To install the Magento software, you now need a Composer. It provides you with the ability to manage the system, extensions, and dependencies. The key features of Composer are:

  • It enables you to reuse third-party libraries with no need to bundle them with source code;
  • With Composer, you get a component-based architecture with a robust dependency management;
  • The tool manages dependencies, as a result you get much less compatibility issues and conflicts between extensions;
  • You also get versioned dependencies with Composer;
  • And don’t forget about Semantic versioning;
  • Last but not least is that Composer supports PHP Framework Interoperability standard.

Composer Installation

  1. Create a new and empty directory on a Magento server.
  2. Enter the following:

There are also some additional installation options, you can find them in Composer installation documentation.

  1. Restart Apache: for Ubuntu use service apache2 restart ; for CentOS use: service httpd restart

Magento GitHub Repository Cloning

Magento 2 Installation Guide

  1. It is extremely important to use secure shell (SSH): generate SSH keys; add a public key to GitHub.
  2. Copy the HTTPS clone URL or Magento GitHub repository SSH to the clipboard .
  • Open Magento GitHub repository in a browser.
  • Click SSH or HTTPS (under the “Clone URL” field on the right side).
  • Use “Copy to clipboard” button.

This is the example of HTTPS clone URL:

  1. Change the docroot directory of web server: for Ubuntu, it’s /var/www; for CentOS – /var/www/html.
  2. Use one of the following commands:
  • For HTTPS: git clone
  • For SSH: git clone
  1. Now the repository will be cloned on a server.

File System Permissions & Ownership

The recommend settings for permissions are:

  • 700 permissions for all directories (drwx——). The owner gets the full control – the ability to read/write/execute; other users have no permissions.
  • 600 permissions for all files (-rw——-). The owner is able to read and write, but nobody else gets the permissions.

Now, when the user of a web server owns the Magento 2 file system, you should use the following:

  1. Use cd magento2 to change the Magento directory.
  2. Use  ps -ef | grep apache2 to find the web server user in Ubuntu; grep User /etc/httpd/conf/httpd.conf – in CentOS.
  3. Use chown -R [your web server user name]  to set ownership: in CentOS – chown -R apache ; in Ubuntu – chown -R www-data .
  4. And finally you can set the permissions:

Installation Dependencies Update

Magento installation dependencies – Introduction

Magento relies on Composer for the first time. It is an application developed to manage PHP dependencies. Before installing any Magento software, you must setup the Composer and perform the following:

  1. First of all you have to Install the Composer.
  2. Now you must Switch to the Apache user to let the Composer to write files to the docroot of web server as the correct user.
  3. From both of the below directories, run the composer install command

Keep in mind, that the main reason of failure is an incomplete or non-functional installation.

Switching to the Apache user

For both Ubuntu and CentOS avoid running Composer as the root user. And don’t forget, that the user of web server on CentOS is apache;on Ubuntu – www-data.


  1. Enter su www-data ;
  2. In case you don’t know the user’s password and a dedicated prompt appears, continue with the next step;
  3. Use the following commands to enable the www-data user’s shell and to set a password:

  1. Run su www-data again and enter the password;
  2. To end the procedure, continue with Running Composer to update dependencies;


  1. Run su – apache. If “This account is currently not available” error displays, continue with the next step;
  2. Use sudo chsh -s /bin/bash apache to give apache a valid shell account.
  3. Enter su – apache again – it should work now.

Running Composer to update dependencies

  1. Switch or log in as the web server user to the Magento server.
  2. Change to the installation directory of Magento 2 – cd /var/www/html/magento2
  3. Run composer install to update package dependencies.

Magento Software Installation With The Setup Wizard

Running the Setup Wizard

With the Setup Wizard, you can go back and forward through the pages of installation. You can’t skip pages, and you you have to enter all the required information before you can go to the next step. It is possible to run the installer again or return to a previous page to fix errors.

Getting started

  1. Open a web browser.
  2. Enter http://[Magento host or IP]/[path to Magento root]/setup in the location or address bar. For the Magento server’s IP address “” and  magento2 directory, you should enter:
  3. Click Agree and Set Up Magento.
  4. To complete the installation, continue with the following sections

Step 1: Readiness Check

How to install Magento 2

  1. Use Start Readiness Check option.
  2. Resolve all the problems if there are any before you go to the next step.
  3. Use More detail to see the additional information about each check.
  4. Click Next.

Step 2: Add a Database

Magento 2 Installation Guide

Item Description
Database Server Host Enter localhost for the web and database servers  located on the same host. For the database server from a different host, use its fully qualified IP address or hostname.
Database Server Username Enter the username of the instance owner of Magento database.
Database Server Password Enter the user’s password, if any or leave the blank field if you didn’t configure any password.
Database Name Enter the instance name of Magento database.
Table prefix You should use this field only if you’re installing the Magento database tables in a database instance with already existing Magento tables. 

To identify the Magento tables for this installation, use a prefix.


Step 3: Web Configuration

How to install Magento 2

Item Description
Your Store Address Enter the URL of your storefront. It should include scheme and trailing slash (
Magento Admin Address Enter the URL of your Magento Admin.


Optionally, click Advanced Options and enter the following information:

Item Description
HTTPS Options To enable the use of SSL in the indicated URL, select the checkbox. Do this only if your web server supports SSL.
Apache Rewrites Select this check box only if you enabled server rewrites while Apache installation.
Encryption Key Magento can generate an encryption key. Use I want to use a Magento generated key option to receive it. If you have your own encryption key, you should use I want to use my own encryption key.


Step 4: Customize Your Store

Magento 2 Installation Guide

  1. Use Store Default Time Zone list to set the timezone of your store.
  2. Use Store Default Currency list to choose the default currency.
  3. Use Store Default Language list to choose the default language.

Step 5: Create Admin Account

How to install Magento 2

Item Description
New Username Enter a username with which you will log in to the Admin of your Magento store. You will be an administrator and will be able to create other users and administrative users under this username.
New E-Mail This is the field for e-mail address of Magento administrator.
New Password The field for the password of administrator.
Confirm Password Password confirmation field.


Step 6: Install

Magento 2 Installation Guide

Click Install Now and you will get the following options:

  • By clicking Console Log, you will be able to see installation progress and error details.
  • By clicking Previous in the event of problems, you will be able to go back to fix incorrect entries.
  • By clicking Try Again, you will be able to run the installation again.

If the installation was successful, you will see the message Success.

Viewing the installation log

The Setup Wizard creates install.log – a log file, which can be useful for the debugging or in the actions verification. To locate the log, you should:

  1. Use a text editor to open php.ini. If you don’t know where php.ini is located:
    1. Switch to or log in as or the web server user.
    2. In the docroot of your web server, create phpinfo.php.
    3. Use a web browser to access phpinfo.php.
    4. You can find the location of php.ini specified as Loaded Configuration File.
  2. Find sys_temp_dir. Its value determines the location of install.log. PHP uses that value as its default in a case when the value is commented out. Keep in mind, that a typical default value is /tmp, so the log is /tmp/install.log.

Magento Software Installation From The Command Line

First steps

  1. You should log in to the Magento server as the web server user or you can switch.
  2. Change cd <your Magento install dir>/setup: cd /var/www/magento2/setup for Ubuntu and cd /var/www/html/magento2/setup for CentOS.
  3. You can also use the following commands to find some values for required options: php -f index.php help language for Language; php -f index.php help timezone for  Time zone and php -f index.php help currency for Currency.

Installing the Magento 2 software from the command line

Magento 2 Dev Beta – Installation with CLI from Magento on Vimeo.

The install command follows the next format:

Name Value Required?
base_url Use Base URL to access your Magento Admin and storefront in the format http[s]://[host or ip]/[your Magento base dir]/. A scheme and a slash are required. 

[your Magento base dir] is the docroot-relative path, where the Magento software will be installed. It can be magento2 or might be blank.

Use http://localhost/[your Magento base dir]/ or[your Magento base dir]/ to access Magento on localhost.

backend_frontname This is the path to access the Magento Admin. It is is appended to Base URL. For the Base URL and the  Admin Pat  admin, the Admin Panel’s URL would be is Yes
  • You can use the database server’s fully qualified hostname, IP address, localhost if your database web servers are on the same host, or UNIX socket (/var/run/mysqld/mysqld.sock)

In addition, there is an option to specify the database server port in its host name:

db_name This is the name of the Magento database instance where you are going to install the Magento database tables. Yes
db_user Magento database instance owner’s username. Yes
db_pass The password of Magento database instance owner. No
db_prefix Use it if you have more than one Magento instance running on a server with all tables in the same database. No
admin_firstname First name of Magento administrator user. Yes
admin_lastname Last name of Magento administrator user. Yes
admin_email E-mail address of Magento administrator user’s. Yes
admin_username Username of Magento administrator. Yes
admin_password Password of Magento administrator user. Yes
language Language code for the Admin and storefront. To view the list of language codes enter php -f index.php help language from the setup directory. Yes
currency Default currency – php -f index.php help currency from the setup directory.) Yes
timezone Default timezone – php -f index.php help timezone from the setup directory.) Yes
use_secure 1 enables the use of SSL in all URLs (your web server should supports SSL). 

0 disables the use of SSL.

base_secure_url 1 – SSL is preferred in Magento URLs 

0 – SSL is not used.

use_secure_admin 1 – SSL is used to access the Magento Admin. 

0  – SSL is not used with the Admin.

admin_use_security_key 1  – Magento software uses a randomly generated key value to access different pages in the Admin and forms. 

0 disables the feture.

session_save Use files to store session data in the file system; db.files – in the database. No
key Specify a key to encrypt data in the Magento database or Magento will generate its own. No
cleanup_database Specify this parameter without a value to drop database tables before Magento software installation, or the Magento database will be  left intact. No
db_init_statements This is the advanced parameter for MySQL configuration. To set any values use this this link – you will find all the necessary information there. No
sales_order_increment_prefix Set a string value, which will be used as a prefix for sales orders. As a result the payment processor will be provided with unique order number. No

Sample localhost installation

As a result of such installation, your Magento receives the following options:

  • The software is be installed in the magento2 directory. Your storefront URL –  http://localhost; Magento Admin – http://localhost/admin;
  • The database and web server are on the same host.
  • The database name, username and password are magento.
  • The properties of Magento administratorincludes:
    • Both first and last name are Magento User
    • Username – admin, the password – iamtheadmin
    • E-mail address –
  • The default language is U.S. English.
  • The currency is U.S. dollars.
  • The timezone is U.S. Central.

  • Enter this command as a single line.

Reinstalling the Magento software

  1. Delete and re-create the database instance (you can do it optionally).
  2. Log in to your server as a user, who has a permissions to modify files in the file system of Magento.
  3. Run the following commands:

  1. Repeat all the section about Magento installation from the command line.

Magento 2 sample data

Magento 2 Dev Beta – Sample Content from Magento on Vimeo.

Magento 2 sample data is available only if you edit composer.json. In order to do this, you have to:

  1. Log in to your server as a user with root privileges or as a web server user.
  2. Change to installation directory of your Magento.
  3. Use a text editor to open composer.json.
  4. Find a “repositories”: section. Add the following block without “repositories”:  to the section. If there is no “repositories”: section, add the block before the “require”: section:

  1. Add “magento/sample-data”: “0.42.0-beta1” and “magento/sample-data-media”: “0.42.0-beta1” to the “require”: section.
  2. Install the Magento software.

Magento 2 Setup Verification

Open a web browser and go to your storefront. If the browser displays the same storefront page, your installation was a success.

How to install Magento 2

Verify the Magento 2 Admin

Magento 2 Installation Guide

Use the same browser to open Magento 2 Admin, and  log in as a Magento Administrator. If your Admin looks like a sample Magento 2 Admin page, then your installation was successfull.