Install Magento prerequisites
Prepare for local environment setup
Install the following software packages and tools on your local to prepare for Magento code development. If you already have these packages installed, check for any recommendations or notes and continue to the next step.
To begin, install and set up a VM on your host computer (Windows, Mac OS, Linux-based system). A VM gives you an environment to install a different Operating System, tools, software, a database, and Magento without requiring a customized system. You only need to install the VM software on your host. All other software can be installed and configured on your VM.
When you install and configure software on your local (or VM), you will first SSH into the VM and then complete installations. Follow the SSH instructions and commands for the VM software you install. For example, you would install PHP, Nginx, and database on the VM via SSH.
Magento documentation provides installation instructions for installing software on CentOS or Ubuntu only. For installation information on Windows or MacOS, consult a community resource.
Virtual machine or container (host)
To best develop and manage your host, we recommend using a virtual machine. The VM encapsulates your code, web services, testing and supports a Unix-based environment. Select a virtual system you prefer.
For your VM, we recommend installing one of the following:
When using Vagrant, we also recommend the package hostmanager and using VirtualBox to manage the environment. VirtualBox extends support and features across all OS and platforms to create and manage multiple VMs and operating systems on your local.
- Git - Provides code branching and management for accessing Magento Commerce and your code repositories. Use Git command-line commands or applications of your choice to work with Git. You can install this on your local VM or on your host. For more information, see How Cloud uses Git.
- Composer - Used for dependency management. Composer enables us to manage the Magento components and their dependencies. Install on your local VM. For more information, see How Cloud uses Composer.
Web server (local)
We strongly recommend installing Nginx for your web server on your local. While Magento Commerce supports Apache, Magento Commerce Cloud uses Nginx. To have your local as close to cloud installations as possible, install and configure Nginx.
Install PHP on your local workstation. For information on installing PHP, see PHP Settings. For instructions for another OS, see the PHP documentation.
The following packages may also be helpful for your PHP installation:
Set up PHP memory limit
When you’re working with the Magento Cloud CLI, local environment settings come from the machine on which you’re working, not from Magento Commerce. For example, certain actions (like debugging) require a larger PHP
memory_limit than most PHP distributions provide by default.
Before working with your Magento Commerce Cloud project, set the PHP
memory_limit to at least
1G for normal use or at least
2G for debugging.
To set a memory limit:
php.inifile using the following command:
Use the value of
Loaded Configuration File.
- As a user with
php.iniin a text editor.
- Change the value of
memory_limitto at least
1Gfor normal use or at least
- Save your changes to
php.iniand exit the text editor.
Restart your web server:
service httpd restart
service apache2 restart
service nginx restart
You have multiple options for databases to use for your local. One database option you may want to consider is MariaDB. The Magento Commerce environments use MariaDB, with a Galera Cluster with triple redundancy in the Production environment.
Regardless of database, for Pro plans you need to modify the
For Pro plans, the Production environment has a three node infrastructure that uses auto-incrementing by 3 for all data IDs. Do not develop using hard-coded database IDs in your development. Due to the incremented data IDs, the referenced data will differ across the three nodes in Production.
To install and create a MariaDB database for Magento on your local:
Use this command to create the database:
apt-get install mariadb-server
Secure the database with the following command and completing all prompts:
- Access the MariaDB database.
Grant all privileges to the Magento account you created for the local:
grant all privileges on <database> to '<account>'@'localhost' identified by '<password>';
Finally create the database:
create database magento; use magento;
- Exit when done.
Pro: Set up the auto-increment for MariaDB
You need to set an auto-increment value for the MariaDB installation.
- As a user with
/etc/mysql/mariadb.conf.d/50-server.cnfin a text editor.
- In the Basic Settings section, add
auto_increment_increment = 3.
- Restart the service:
service mysql restart.
Pro: Set up the auto-increment for MySQL
The MySQL configuration parameter
auto_increment_increment is set to
1 by default in a local MySQL installation. You need to change this value to
3. The Magento Commerce database cluster includes 3 database implementations. The increment ensures data is unique across all databases for consistent data in the High Availability structure.
To avoid issues, we recommend you set
First, view the current value and verify if it is set to 3:
1 mysqladmin variables -u <root username> -p | grep 'auto_increment'
auto_increment_increment to 3:
As a user with
/etc/my.cnfin a text editor.
On Ubuntu 16, the path is typically
Add or edit the following line in the
Magento Commerce Cloud supports a High Availability configuration. This setting increments the database IDs in increments of three to ensure row uniqueness for Galera databases on each of the three HA nodes in production.
service mysqld restart
Magento Cloud CLI (local)
The Magento Cloud command-line interface (CLI) tool helps you manage your projects and code branches on Magento Commerce Cloud. For a list of available commands, see Common Magento CLI commands.
These instructions discuss installation using commands for a Unix environment. For Windows, we recommend using Cygwin or Git Bash.
To install the Magento Cloud CLI:
Log in to your local development machine or switch to the Magento file system owner.
Change to a directory to which the Magento file system owner has write access, such as the home directory.
Enter the following command:
curl -sS https://accounts.magento.cloud/cli/installer | php
After the CLI downloads, an operating system-specific command displays.
For example, on Ubuntu and CentOS, the command is similar to:
For more information about the user shell profile, see .bash_profile vs .bashrc
You can also add the
$HOME/.magento-cloud/binto the Magento user’s
Consult operating system documentation for details.
magento-cloudcommand is in your path by entering the following command:
Additional requirements for Magento Commerce
The requirements listed in this topic are specific to Magento Commerce Cloud environments. You will also install Magento Commerce on your VM or Docker container. For that installation, you should also review the following:
You can also install additional optional software. These packages should be installed on the local VM.