PHPackages                             yvoronoy/m2install - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yvoronoy/m2install

ActiveLibrary

yvoronoy/m2install
==================

Magento 2 Bash Install/Restore Script

1.0.4(8y ago)8126844[6 issues](https://github.com/yvoronoy/m2install/issues)[1 PRs](https://github.com/yvoronoy/m2install/pulls)GNUShell

Since Jun 14Pushed 3y ago10 watchersCompare

[ Source](https://github.com/yvoronoy/m2install)[ Packagist](https://packagist.org/packages/yvoronoy/m2install)[ RSS](/packages/yvoronoy-m2install/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)DependenciesVersions (20)Used By (0)

Magento 2 Bash Install/Restore Script
=====================================

[](#magento-2-bash-installrestore-script)

[![Docker Image CI](https://github.com/yvoronoy/m2install/actions/workflows/functional-tests.yml/badge.svg)](https://github.com/yvoronoy/m2install/actions/workflows/functional-tests.yml) [![GitHub closed pull requests](https://camo.githubusercontent.com/ef27079c3b52f711acd147ad36eda4d9aa9398aab0098cef0801666ee987f7b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722d636c6f7365642f79766f726f6e6f792f6d32696e7374616c6c2e7376673f6d61784167653d32353932303030)](https://github.com/yvoronoy/m2install/pulls?q=is%3Apr+is%3Aclosed) [![GitHub closed issues](https://camo.githubusercontent.com/62aedb5815dd66e9be3fa81cee06a923bb5421f5204bb77afd74ade99ca7d774/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d636c6f7365642f79766f726f6e6f792f6d32696e7374616c6c2e7376673f6d61784167653d32353932303030)](https://github.com/yvoronoy/m2install/issues?q=is%3Aissue+is%3Aclosed)

This script is designed to simplify the installation process of Magento 2 and rapid deployment of merchant code and DB dumps.

m2install can be a helpful tool for support teams and teams who often need to install or deploy merchant backups or dumps.

The main purpose of this script is run m2install, wait a bit and get a working magento instance. Don't waste time on routine operations.

If you have any issues please report them to

What can m2install exactly do?
------------------------------

[](#what-can-m2install-exactly-do)

- Can automatically restore backup files created by
- `php bin/magento setup:backup --code --db`
- Can automatically restore support dumps created by Enterpsie Support Tool
- `php bin/magento support:backup:code (db)`
- Script can automatically install vanilla magento

Installation
------------

[](#installation)

Download latest version by curl

```
curl -o m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh

```

You can install by composer

```
composer require yvoronoy/m2install

```

In case you are using `bash completion` you can download completion for this script.

```
#For Linux User
curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion

#For OSX User with brew
curl -o /usr/local/etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion

```

Usage
-----

[](#usage)

```
$ m2install.sh --help
m2install.sh is designed to simplify the installation process of Magento 2
and deployment of client dumps created by Magento 2 Support Extension.

Usage: m2install.sh [options]
Options:
    -h, --help                           Get this help.
    -s, --source (git, composer)         Get source code.
    -f, --force                          Install/Restore without any confirmations.
    --sample-data (yes, no)              Install sample data.
    --ee                                 Install Enterprise Edition.
    --b2b                                Install B2B Extension.
    -v, --version                        Magento Version - it means: Composer version or GIT Branch
    --mode (dev, prod)                   Magento Mode. Dev mode does not generate static & di content.
    --quiet                              Quiet mode. Suppress output all commands
    --skip-post-deploy                   Skip the post deploy script if it is exist
    --step (restore_code,restore_db      Specify step through comma without spaces.
        configure_db,configure_files     - Example: m2install.sh --step restore_db,configure_db
        installB2B --b2b                 - Example: m2install.sh --step installB2B --b2b
        installLiveSearch)               - Example: m2install.sh --step installLiveSearch
    --restore-table                      Restore only the specific table from DB dumps
    --debug                              Enable debug mode
    --php                                Specify path to PHP CLI (php71 or /usr/bin/php71)
    --remote-db                          Remote database name
    --es-host, --elasticsearch-host      Set the Elasticsearch host
    --es-port, --elasticsearch-port      Set the Elasticsearch port
    --uninstall                          Delete database and application from the current folder
    _________________________________________________________________________________________________
    --ee-path (/path/to/ee)              (DEPRECATED use --ee flag) Path to Enterprise Edition.

```

How to deploy backup/support dumps
----------------------------------

[](#how-to-deploy-backupsupport-dumps)

In order to deploy the customer dumps you need:

- Put DB and code dumps to new directory
- Go to directory and run m2install

How to install Magento 2 using GIT
----------------------------------

[](#how-to-install-magento-2-using-git)

To install Magento 2 from git repository run m2install with --source git param

- `m2install --source git` or
- `m2install -s git`

How to install Magento 2 using Composer
---------------------------------------

[](#how-to-install-magento-2-using-composer)

To install Magento 2 from composer run m2install with --source composer param

- `m2install --source composer` or
- `m2install -s composer`

#### How to Install Magento 2 with Sample Data

[](#how-to-install-magento-2-with-sample-data)

- Run m2install
- Use wizard to install the sample data.

#### How to Install Magento 2 with B2B extension

[](#how-to-install-magento-2-with-b2b-extension)

With wizard

- Run m2install
- Use wizard to install the B2B

With CLI flags

- `m2install --ee --b2b` or
- `m2install --step installB2B --b2b` if you already have Magento EE

Remember that you have to install Enterprise Edition to be able to install B2B extension

Wizard
------

[](#wizard)

m2install shows you wizard on first run and prompts to save entered values to config file.

```
$ m2install.sh
Current Directory: /Users/yvoronoy/Sites/m2/ee202
Configuration loaded from:
Enter Server Name of Document Root (default: http://mage2.dev/):
Enter Base Path (default: ee202):
Enter DB Host (default: localhost):
Enter DB User (default: root):
Enter DB Password:
Enter DB Name (default: root_ee202):
Do you want to install Sample Data (y/N) n
Enter Path to EE or [nN] to skip EE installation: n
--------------------------------------------------
BASE URL: http://mage2.dev/ee202/
DB PARAM: root@localhost
DB NAME: root_ee202
Sample Data will NOT be installed.
Magento EE will NOT be installed.
In order to generate static/di content, add mode param: m2install.sh --mode prod
Are you sure? [y/N]

```

How to use configuration files
------------------------------

[](#how-to-use-configuration-files)

The config file allows you to store params for DB and URL. Example of config file

```
HTTP_HOST=http://your-mage-host.com/
BASE_PATH=your/base/path/${CURRENT_DIR_NAME}
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=dbpassword

```

When you first run m2install script, it shows wizard which prompts to save the config file to your home directory.

m2install uses fallback mechanism to find config files recursively from home directory to current directory. For example if you want to install magento to directory ~/www/m2/ga/magento2ee

you can override config file which is placed in your home directory.

```
~/.m2install.conf
~/www/.m2install.conf
~/www/m2/.m2install.conf
~/www/m2/ga/.m2install.conf
~/www/m2/ga/magento2ee/.m2install.conf

```

How to use ssh tunnels for remote DB connection
-----------------------------------------------

[](#how-to-use-ssh-tunnels-for-remote-db-connection)

Make sure that you have correct parameters in .m2install.conf file Parameters example:

```
REMOTE_DB_HOST=mysql-host:3306
REMOTE_HOST=user@ssh.domain
REMOTE_KEY=/Users/path/to/ssh_key
LOCAL_PORT=33060

```

As a result you will get:

```
ssh -i /Users/path/to/ssh_key -o StrictHostKeyChecking=no -4fN -L 33060:mysql-host:3306 user@ssh.domain >> /dev/null

```

All created ssh tunnels pids located in file kill\_tunnel.sh in Magento root folder (or pub)

To run you will need only code dump file (Example code.tar.gz).

```
m2install.sh --remote-db database_name

```

Make attention that in --remote-db database\_name first part before "\_" is database user name

Make attention that in bootstrap added SECURE and UNSECURE BASE\_URL to prevent DB modification

```
$_ENV['CONFIG__DEFAULT__WEB__UNSECURE__BASE_URL'] = 'http://magento.local/';

```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community27

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 69.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~121 days

Total

4

Last Release

3253d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e2f42cd61358538792b5ccd8e9f7bc72906dd3b30f8e344c9333080c1d12573?d=identicon)[yvoronoy](/maintainers/yvoronoy)

---

Top Contributors

[![yvoronoy](https://avatars.githubusercontent.com/u/8588929?v=4)](https://github.com/yvoronoy "yvoronoy (191 commits)")[![agorbivskyi](https://avatars.githubusercontent.com/u/8568714?v=4)](https://github.com/agorbivskyi "agorbivskyi (21 commits)")[![o-rykh](https://avatars.githubusercontent.com/u/93227551?v=4)](https://github.com/o-rykh "o-rykh (13 commits)")[![snosov](https://avatars.githubusercontent.com/u/8612963?v=4)](https://github.com/snosov "snosov (7 commits)")[![isitnikov](https://avatars.githubusercontent.com/u/576294?v=4)](https://github.com/isitnikov "isitnikov (6 commits)")[![novykov](https://avatars.githubusercontent.com/u/5372577?v=4)](https://github.com/novykov "novykov (6 commits)")[![aabumuslimov](https://avatars.githubusercontent.com/u/3819085?v=4)](https://github.com/aabumuslimov "aabumuslimov (5 commits)")[![ytorbyk](https://avatars.githubusercontent.com/u/6418650?v=4)](https://github.com/ytorbyk "ytorbyk (4 commits)")[![glo47154](https://avatars.githubusercontent.com/u/89967831?v=4)](https://github.com/glo47154 "glo47154 (3 commits)")[![xeonkiev](https://avatars.githubusercontent.com/u/6483486?v=4)](https://github.com/xeonkiev "xeonkiev (3 commits)")[![rimomcosta](https://avatars.githubusercontent.com/u/19884676?v=4)](https://github.com/rimomcosta "rimomcosta (3 commits)")[![abumuslimov](https://avatars.githubusercontent.com/u/49996077?v=4)](https://github.com/abumuslimov "abumuslimov (2 commits)")[![radek-ziemniewicz](https://avatars.githubusercontent.com/u/44390595?v=4)](https://github.com/radek-ziemniewicz "radek-ziemniewicz (2 commits)")[![robertorubino](https://avatars.githubusercontent.com/u/2581259?v=4)](https://github.com/robertorubino "robertorubino (2 commits)")[![katmoon](https://avatars.githubusercontent.com/u/1260101?v=4)](https://github.com/katmoon "katmoon (1 commits)")[![soklymeach](https://avatars.githubusercontent.com/u/54864601?v=4)](https://github.com/soklymeach "soklymeach (1 commits)")[![valdislav](https://avatars.githubusercontent.com/u/2062909?v=4)](https://github.com/valdislav "valdislav (1 commits)")[![cgarrigues](https://avatars.githubusercontent.com/u/6314007?v=4)](https://github.com/cgarrigues "cgarrigues (1 commits)")[![biyoum](https://avatars.githubusercontent.com/u/89178955?v=4)](https://github.com/biyoum "biyoum (1 commits)")[![awktion](https://avatars.githubusercontent.com/u/3934392?v=4)](https://github.com/awktion "awktion (1 commits)")

---

Tags

magentomagento-bashmagento-bash-scriptsmagento-climagento2

### Embed Badge

![Health badge](/badges/yvoronoy-m2install/health.svg)

```
[![Health](https://phpackages.com/badges/yvoronoy-m2install/health.svg)](https://phpackages.com/packages/yvoronoy-m2install)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
