This is a beta release of documentation for Magento 2.4, published for previewing soon-to-be-released functionality. Content in this version is subject to change. Links to the v2.4 code base may not properly resolve until the code is officially released.
You must install Elasticsearch before installing Magento Commerce or Magento Open Source 2.4.0. See Elasticsearch for details.

Configure the store

First steps

  1. Log in to the Magento server as, or switch to, a user with permissions to write to the Magento file system. See switch to the Magento file system owner.

    If you use the bash shell, you can use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    1
    
    su <Magento file system owner> -s /bin/bash -c <command>
    

    If the Magento file system owner does not allow logins, you can do the following:

    1
    
    sudo -u <Magento file system owner>  <command>
    
  2. To run Magento commands from any directory, add <magento_root>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like unix.stackexchange.com.

    Sample bash shell for CentOS:

    1
    
    export PATH=$PATH:/var/www/html/magento2/bin
    

    Optionally, you can run the commands in the following ways:

    • cd <magento_root>/bin and run them as ./magento <command name>
    • <magento_root>/bin/magento <command name>
    • <magento_root> is a subdirectory of your web server docroot. Need help locating the docroot?

In addition to the command arguments discussed here, see Common arguments.

Prerequisites

Before you run this command, you must do all of the following or you must install the Magento software:

Completely secure installation

To use Secure Sockets Layer (SSL), also referred to as HTTPS, for both the Magento Admin and the storefront, you must set all of the following parameters:

  • --use-secure: Set to 1
  • --base-url-secure: Set to a secure URL (that is, starting with https://)
  • --use-secure-admin Set to 1

More details about these parameters can be found later in this topic.

Configure the store

Command usage:

1
bin/magento setup:store-config:set [--<parameter_name>=<value>, ...]

where the following table defines parameters and values.

Name Value Required?
--base-url Base URL to use to access your Magento Admin and storefront in any of the following formats:

- http[s]://<host or ip>/<your Magento install dir>/.

Note: The scheme (http:// or https://) and a trailing slash are both required. <your Magento install dir> is the docroot-relative path in which to install the Magento software. Depending on how you set up your web server and virtual hosts, the path might be magento2 or it might be blank.

To access Magento on localhost, you can use http://127.0.0.1/<your Magento install dir>/.

- `` which represents a base URL defined by a virtual host setting or by a virtualization environment like Docker. For example, if you set up a virtual host for Magento with the hostname magento.example.com, you can install the Magento software with --base-url= and access the Magento Admin with a URL like http://magento.example.com/admin.
No
–language Language code to use in the Admin and storefront.

(If you have not done so already, you can view the list of language codes by entering magento info:language:list from the bin directory.)
No
--currency Default currency to use in the storefront.

(If you have not done so already, you can view the list of currencies by entering magento info:currency:list from the bin directory.)
No
--timezone Default time zone to use in the Admin and storefront. (If you have not done so already, you can view the list of time zones by entering magento info:timezone:list from the bin directory.) No
--use-rewrites 1 means you use web server rewrites for generated links in the storefront and Admin.

0 disables the use of web server rewrites. This is the default.
No
--use-secure 1 enables the use of Secure Sockets Layer (SSL) in storefront URLs. Make sure your web server supports SSL before you select this option.

0 disables the use of SSL with Magento. In this case, all other secure URL options are assumed to also be 0. This is the default.
No
--base-url-secure Secure base URL to use to access your Magento Admin and storefront in the following format:http[s]://<host or ip>/<your Magento install dir>/ No
--use-secure-admin 1 means you use SSL to access the Magento Admin. Make sure your web server supports SSL before you select this option.

0 means you do not use SSL with the Admin. This is the default.
No
--admin-use-security-key 1 causes the Magento software to use a randomly generated key value to access pages in the Magento Admin and in forms. These key values help prevent cross-site script forgery attacks. This is the default.

0 disables the use of the key.
No
--magento-init-params Add to any command to customize Magento initialization parameters

For example: MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/example.com&MAGE_DIRS[cache][path]=/var/tmp/cache
No