Close [x]

Installation quick reference (tutorial)

Edit this page on GitHub

We know it鈥檚 challenging to install the Magento software. We鈥檇 like to help you by simplifying the process as much as possible.

This topic assumes:

  • You have your own Magento server (you鈥檙e not using a shared hosting provider).
  • You鈥檙e starting the installation using composer create-project, which enables you to get the most recent Magento software and to add your own customizations to it, if desired.
  • Everything is installed on one host (database, web server, and so on).
  • The host you鈥檙e installing on is either Ubuntu or CentOS.

    (You can use the same instructions to install on other UNIX distributions like RedHat Enterprise Linux (RHEL), or Debian, but these instructions aren鈥檛 for Mac or Windows.)

  • Your host鈥檚 IP address is 192.0.2.5
  • You鈥檙e installing to the magento2 subdirectory under your web server鈥檚 docroot (full path is /var/www/html/magento2)

    You can optionally set up static routing or a virtual host to install to a host name instead of an IP but that鈥檚 beyond the scope of this topic.

We鈥檝e broken the installation process into three main parts: getting started, installing, and post-installation. We hope that what follows helps you; if you鈥檇 like to suggest improvements, click Edit this page on GitHub at the top of this page and let us know.

Precondition: How advanced are you?

Do you know what a 鈥渢erminal鈥 application is? Do you know what operating system your server runs? Do you know what Apache is?

If not, see the Installation overview.

Installation part 1: Getting started

  1. See the system requirements.
  2. If your system lacks any requirements, see the prerequisites documentation:

  3. Just as importantly, set up the Magento file system owner on the server.
  4. Switch to the Magento file system owner.

Get the Magento software

When all prerequisites have been met, get the Magento software using Composer as follows:

cd <web server docroot directory>
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition

You鈥檙e required to authenticate; see Get your authentication keys for details. This downloads Magento code only; it doesn鈥檛 install the software for you.

Alternatively, you can also download a Magento software archive.

Set file system ownership and permissions

Use the following steps:

  1. If you haven鈥檛 already done so, log in to your Magento server as, or switch to, the Magento file system owner.
  2. Change to the Magento installation directory:

    cd <web server docroot>/<magento2 base dir>
    

    The base directory is typically a subdirectory named magento2 under your web server鈥檚 docroot. Need help locating the docroot? Click here.

    Examples:

    • Ubuntu: /var/www/magento2
    • CentOS: /var/www/html/magento2
  3. Set ownership:

    chown -R :<your web server group name> .
    

    Typical examples:

    • CentOS: chown -R :apache .
    • Ubuntu: chown -R :www-data .
  4. Set permissions:

    find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x bin/magento
    

    If you must enter the commands as sudo, use:

    sudo find . -type d -exec chmod 770 {} \; && sudo find . -type f -exec chmod 660 {} \; && sudo chmod u+x bin/magento
    

Installation part 2: Installing the Magento software

You can choose to install the Magento software using either a web-based Setup Wizard or using the command line.

The following example shows how to install using the command line with the following options:

  • The Magento software is installed in the /var/www/html/magento2 directory and the path to the Magento Admin is admin; therefore:

    Your storefront URL is http://192.0.2.5

  • The database server is on the same host as the web server.

    The database name is magento, and the user name and password are both magento

  • Uses server rewrites

  • The Magento administrator has the following properties:

    • First and last name are Magento User
    • User name is admin and the password is admin123
    • E-mail address is user@example.com
  • Default language is en_US (U.S. English)
  • Default currency is U.S. dollars
  • Default time zone is U.S. Central (America/Chicago)

    php /var/www/html/magento2/bin/magento setup:install --base-url=http://192.0.2.5/magento2/ \
    --db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
    --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
    --admin-user=admin --admin-password=admin123 --language=en_US \
    --currency=USD --timezone=America/Chicago --use-rewrites=1
    

Optionally switch to developer mode.

cd <your Magento install dir>/bin
php magento deploy:mode:set developer

Installation part 3: Post-installation