Before you begin

Before you install Magento, you must do all of the following:

  • Set up one or more hosts that meet the Magento system requirements.
  • If you are setting up more than one web node with load balancing, set up and test that part of your system before you install Magento.
  • Make sure you can back up your entire system at various points during the installation so you can roll back in the event of issues.

We assume you’re installing the Magento 2 software in a development environment, which means you have root user access to the machine and that the machine does not need to be highly secure. If you’re setting up a more secure machine, we strongly recommend you consult a network administrator for additional assistance.

We strongly recommend you update and upgrade your operating system software. These upgrades can provide security and software fixes that might prevent future problems.

Don’t know what any of this means? Check out our installation overview page.

Enter the following commands as a user with root privileges:

  • Ubuntu

    apt-get update
    apt-get upgrade
  • CentOS

    yum -y update
    yum -y upgrade

Prerequisite check

To check your system for prerequisites, enter the following commands:


CentOS: httpd -v

Ubuntu: apache2 -v

You must run Apache version 2.2 or 2.4 as the following result indicates:

Server version: Apache/2.2.15 (Unix)
Server built: Jul 23 2014 14:17:29

To install or upgrade Apache, see Apache.


php -v

You must run PHP version 7.0.x or 7.1.x as the following result indicates:

PHP (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
  with Zend OPcache, Copyright (c) 1999-2016, by Zend Technologies

To install PHP, see:


mysql -u <database root user or database owner name> -p

For example:

mysql -u magento -p

You must run MySQL version 5.6 or later as the following result indicates:

	Welcome to the MySQL monitor. Commands end with ; or \g.
	Your MySQL connection id is 871
	Server version: 5.6.21 MySQL Community Server (GPL)

	Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

	Oracle is a registered trademark of Oracle Corporation and/or its
	affiliates. Other names may be trademarks of their respective

	Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Enter exit at the mysql> prompt to exit.

To install or upgrade MySQL, see MySQL.

Next step

Choose how to install the Magento software