In this chapter, we will cover the basic tasks related to managing the system tools of Magento 2. You will learn the following recipes:
This chapter explains how to install and manage Magento 2 on a production-like environment. We will be installing a new Magento 2 instance via the shell command with and without sample data. Besides the setup, managing Magento 2 is different from the current Magento version. We will be using a lot of tools from the command line so basic shell knowledge is advised. The command-line tool in the /bin
directory is similar to the current Swiss
army knife tool in the current Magento version known as n98-magerun.
Using bin/magento
and
Composer is one of the new key features in Magento 2 that will rock your world.
The recipes in this chapter will focus primarily on a more advanced setup of how to install Magento 2 and manage it. However, in some situations, we will dive in deeper related to the subject.
Here is an overview of all the command-line tools in Magento 2:
root@mage2cookbook:/var/www/html# bin/magento Magento CLI version 2.0.0 Usage: command [options] [arguments] Options: --help (-h) Display this help message --quiet (-q) Do not output any message --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version (-V) Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output --no-interaction (-n) Do not ask any interactive question
The following commands are available in the command-line tools in Magento 2:
Commands |
Description |
---|---|
|
This displays help for a command |
|
This lists the commands |
admin | |
|
This creates an administrator |
|
This unlocks the administrator account |
cache | |
|
This cleans the cache type(s) |
|
This disables the cache type(s) |
|
This enables the cache type(s) |
|
This flushes the cache storage used by the cache type(s) |
|
This checks the cache status |
catalog | |
|
This creates resized product images |
cron | |
|
This runs jobs by schedule |
customer | |
|
This upgrades the customer's hash according to the latest algorithm |
deploy | |
|
This sets the application mode |
|
This displays the current application mode |
dev | |
|
This collects and publishes source files for a theme |
|
This runs tests |
|
This generates the catalog of URNs to |
|
This converts XML files using XSL style sheets |
i18n | |
|
This discovers phrases in the code base |
|
This saves language packages |
|
This uninstalls language packages |
indexer | |
|
This shows allowed indexers |
|
This reindexes data |
|
This sets the index mode type |
|
This shows the index mode |
|
This shows the status of an indexer |
maintenance | |
|
This sets the maintenance mode exempt IPs |
|
This disables the maintenance mode |
|
This enables the maintenance mode |
|
This displays the maintenance mode status |
module | |
|
This disables specified modules |
|
This enables specified modules |
|
This displays the status of modules |
|
This uninstalls modules installed by Composer |
sampledata | |
|
This deploys sample data modules |
|
This removes all sample data from |
|
This resets sample data modules for reinstallation |
theme | |
|
This uninstalls the theme |
info | |
|
This displays the Magento Admin URI |
|
This prints a list of available backup files |
|
This displays the list of available currencies |
|
This shows the number of dependencies on the Magento framework |
|
This shows the number of dependencies between modules |
|
This shows the number of circular dependencies between modules |
|
This displays a list of available language locales |
|
This displays a list of available time zones |
setup | |
|
This takes a backup of the Magento Application code base, media, and database |
|
This creates or modifies the deployment configuration |
|
This runs a cron job scheduled for the setup application |
|
This installs and upgrades data in the DB |
|
This installs and upgrades the DB schema |
|
This checks whether the DB schema or data require an upgrade |
|
This generates the DI configuration and all non-existing interceptors and factories |
|
This generates all non-existing proxies and factories and precompiles class definitions, inheritance information, and plugin definitions |
|
This installs the Magento application |
|
This generates fixtures |
|
This rolls back the Magento application code base, media, and database |
|
This deploys static view files |
|
This installs the store configuration |
|
This uninstalls the Magento application |
|
This upgrades the Magento application, DB data, and schema |
Throughout this chapter, you can pick your own preferred hosting setup as we set up in Chapter 1, Installing Magento 2 on Apache and NGINX. We will be using an NGINX-based setup. The Apache setup is pretty straightforward; when needed, we will address specified configuration settings when they occur.
13.58.51.36