Install & Setup
Before we begin
Before we look at how to install Magento 2, you're going to need a development environment. We're not going to provide in-depth details or support on how to set up and configure a local environment; this is best provided by the author of the environment in their documentation or by other pre-existing setup guides.
High-level system requirements
Below are the key technologies Magento 2 needs to run:
- Webserver - Apache or NGINX
- PHP - use the latest version of PHP 7 supported by the version of Magento 2 you're installing, while older versions do support PHP 5.6, using unsupported and insecure PHP versions is not recommended, nor are they particularly performant
- Database - MySQL (or variants such as MariaDB or Percona)
There's more than one way to get Magento 2
There are 3 main ways to install Magento 2:
- Downloading the source code as a compressed file and extract
- Using composer
- Cloning from GitHub
For the majority of your interactions with Magento 2 (including working with examples/challenges on MageQuest), we recommend installing via composer as it is the preferred method of getting the software and puts you in full control, including whether you want to exclude or add specific packages.
Cloning from GitHub is only suitable if you want to contribute code back to the core Magento codebase (i.e. make changes and open a pull request).
The first option, in reality, does little more than skip over the initial composer setup, however, if you want to get up and running initially with this method we won't judge!
Again, we're not covering how to action this process, here, but some guidance is provided in the 'Walkthru' tab.
Ways of installing Magento 2
Once you've got Magento 2 downloaded to your local environment and ensured all composer dependencies are installed, it's time to install the Magento 2 software, and there are 2 ways to achieve this:
- Via the Web Setup Wizard (using a browser)
- Via the CLI (Command Line Interface)
The setup wizard is by far the most straightforward and most user-friendly way to install Magento 2 (even for a hardened CLI user). It can be accessed by visiting the following page 'https://{your-magento-domain}
/setup' where {your-magento-domain}
is the domain of your local environment (this is configured/set based on the development environment you are utilising).
The CLI install method is excellent if you know exactly the configuration you want to set up front, but it is cumbersome to type out each value within the terminal and prone to error. It's real benefit/use case is for automating the install process (e.g. for a continuous development pipeline).
How about some products?
A default install of Magento 2 contains no additional configuration or catalog(ue) data (products/categories) of any type.
For a real Magento project, the merchant would provide the products they need for their store.
However, to learn Magento 2, it's relatively vital to have some data to work with to develop specific areas of the site.
Thankfully Magento provides a sample data pack, which can be installed via the bin/magento
CLI tool (see the 'Walkthru' tab for details).
Wrap Up
- Magento 2 key system requirements include a web server (Apache or NGINX), PHP and MySQL (or variant)
- Magento 2 can be obtained via composer, downloading the source files or cloning from GitHub
- Getting Magento 2 via composer is recommended in most scenarios, except when contributing to the core, where cloning from GitHub is required
- Once downloaded, Magento 2 can be installed using the Web Setup Wizard or via the CLI tool
- For development/demo purposes, optional sample data can also be installed
Choose a development environment
As noted in the 'Story' tab, here are a couple of recommendations for development environments, we're staying out of further guidance on this one!
- Valet+ (macOS only) - also see great install guide from Dave Macaulay
- Mark Shust's Docker Configuration for Magento
Or see the list of available development environments on MageRes GitHub.
Get the Magento 2 software
If your chosen development environment doesn't install Magento 2 for you as part of the process, then you install it via composer.
Follow the Magento DevDocs guide here and decide whether you want to install via the command line or use the web setup wizard.
Add sample data
Once you have Magento 2 installed and have verified that you can access the storefront and admin panel via the links provided then the last step before beginning on a real 'quest' is to ensure you have data to work with.
Again Magento DevDocs has us covered here so check out their guide here.