Chapter 2. Magento 2 System Tools

In this chapter, we will cover the basic tasks related to managing the system tools of Magento 2. You will learn the following recipes:

  • Installing Magento 2 sample data via GUI
  • Installing Magento 2 sample data via the command line
  • Managing Magento 2 indexes via the command line
  • Managing Magento 2 cache via the command line
  • Managing Magento 2 backup via the command line
  • Managing Magento 2 set mode (MAGE_MODE)
  • Transferring your Magento 1 database to Magento 2

Introduction

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

help

This displays help for a command

list

This lists the commands

admin

 

admin:user:create

This creates an administrator

admin:user:unlock

This unlocks the administrator account

cache

 

cache:clean

This cleans the cache type(s)

cache:disable

This disables the cache type(s)

cache:enable

This enables the cache type(s)

cache:flush

This flushes the cache storage used by the cache type(s)

cache:status

This checks the cache status

catalog

 

catalog:images:resize

This creates resized product images

cron

 

cron:run

This runs jobs by schedule

customer

 

customer:hash:upgrade

This upgrades the customer's hash according to the latest algorithm

deploy

 

deploy:mode:set

This sets the application mode

deploy:mode:show

This displays the current application mode

dev

 

dev:source-theme:deploy

This collects and publishes source files for a theme

dev:tests:run

This runs tests

dev:urn-catalog:generate

This generates the catalog of URNs to *.xsd

dev:xml:convert

This converts XML files using XSL style sheets

i18n

 

i18n:collect-phrases

This discovers phrases in the code base

i18n:pack

This saves language packages

i18n:uninstall

This uninstalls language packages

indexer

 

indexer:info

This shows allowed indexers

indexer:reindex

This reindexes data

indexer:set-mode

This sets the index mode type

indexer:show-mode

This shows the index mode

indexer:status

This shows the status of an indexer

maintenance

 

maintenance:allow-ips

This sets the maintenance mode exempt IPs

maintenance:disable

This disables the maintenance mode

maintenance:enable

This enables the maintenance mode

maintenance:status

This displays the maintenance mode status

module

 

module:disable

This disables specified modules

module:enable

This enables specified modules

module:status

This displays the status of modules

module:uninstall

This uninstalls modules installed by Composer

sampledata

 

sampledata:deploy

This deploys sample data modules

sampledata:remove

This removes all sample data from composer.json

sampledata:reset

This resets sample data modules for reinstallation

theme

 

theme:uninstall

This uninstalls the theme

info

 

info:adminuri

This displays the Magento Admin URI

info:backups:list

This prints a list of available backup files

info:currency:list

This displays the list of available currencies

info:dependencies:show-framework

This shows the number of dependencies on the Magento framework

info:dependencies:show-modules

This shows the number of dependencies between modules

info:dependencies:show-modules-circular

This shows the number of circular dependencies between modules

info:language:list

This displays a list of available language locales

info:timezone:list

This displays a list of available time zones

setup

 

setup:backup

This takes a backup of the Magento Application code base, media, and database

setup:config:set

This creates or modifies the deployment configuration

setup:cron:run

This runs a cron job scheduled for the setup application

setup:db-data:upgrade

This installs and upgrades data in the DB

setup:db-schema:upgrade

This installs and upgrades the DB schema

setup:db:status

This checks whether the DB schema or data require an upgrade

setup:di:compile

This generates the DI configuration and all non-existing interceptors and factories

setup:di:compile-multi-tenant

This generates all non-existing proxies and factories and precompiles class definitions, inheritance information, and plugin definitions

setup:install

This installs the Magento application

setup:performance:generate-fixtures

This generates fixtures

setup:rollback

This rolls back the Magento application code base, media, and database

setup:static-content:deploy

This deploys static view files

setup:store-config:set

This installs the store configuration

setup:uninstall

This uninstalls the Magento application

setup:upgrade

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.212.102