{"id":20095736,"url":"https://github.com/magepsycho/magento2-installer-bash-script","last_synced_at":"2025-05-07T17:50:38.122Z","repository":{"id":142444290,"uuid":"124571969","full_name":"MagePsycho/magento2-installer-bash-script","owner":"MagePsycho","description":"Simplistic Magento 2 Installer Bash Script","archived":false,"fork":false,"pushed_at":"2024-10-28T18:42:08.000Z","size":317,"stargazers_count":52,"open_issues_count":0,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T12:39:05.192Z","etag":null,"topics":["bash","bash-script","cli","command-line-tool","install-script","installer","installer-script","magento","magento2","nginx","shell","shell-script"],"latest_commit_sha":null,"homepage":"https://www.magepsycho.com/extensions/magento-2.html","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MagePsycho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-09T17:26:04.000Z","updated_at":"2024-12-03T16:28:03.000Z","dependencies_parsed_at":"2024-12-27T02:06:37.170Z","dependency_job_id":"d0ced5b6-e7e0-445f-b551-4568642e1d20","html_url":"https://github.com/MagePsycho/magento2-installer-bash-script","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-installer-bash-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-installer-bash-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-installer-bash-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagePsycho%2Fmagento2-installer-bash-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MagePsycho","download_url":"https://codeload.github.com/MagePsycho/magento2-installer-bash-script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931391,"owners_count":21827104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","cli","command-line-tool","install-script","installer","installer-script","magento","magento2","nginx","shell","shell-script"],"created_at":"2024-11-13T16:56:18.426Z","updated_at":"2025-05-07T17:50:38.095Z","avatar_url":"https://github.com/MagePsycho.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simplistic Magento 2 Installer\n\nThis bash script helps you to quickly install Magento2 from different sources (`tar`, `composer` etc.) with sample data for development purpose.\n\n## INSTALL\nYou can simply download the script file and give the executable permission.\n```\ncurl -0 https://raw.githubusercontent.com/MagePsycho/magento2-installer-bash-script/master/src/m2-installer.sh -o m2-installer.sh\nchmod +x m2-installer.sh\n```\n\nTo make it a system-wide command (preferred)\n```\nsudo mv m2-installer.sh /usr/local/bin/m2-installer\n```\nOR\n```\nmv m2-installer.sh ~/bin/m2-installer\n```\n*Make sure your `$HOME/bin` folder is in executable path*\n\n## USAGE\n### To display help\n```\nm2-installer --help\n```\n\n![Magento 2 Installer Help](https://github.com/MagePsycho/magento2-installer-bash-script/raw/master/docs/magento2-installer-bash-script-help-v0.1.3.png \"Magento2 Installer Help\")\n\n### To install Magento CE v2.4.6 (with sample data)\n```\nm2-installer --version=2.4.6 --base-url=magento246.test --install-sample-data --db-user=root --db-pass=pass --db-name=magento246\n```\n- `--install-sample-data` option is required to install the sample data.\n\nIf you want to install via `composer`, you can simply use `--source=composer` option:\n```\nm2-installer --source=composer --version=2.4.6 --base-url=magento246.test --install-sample-data --db-user=root --db-pass=pass --db-name=magento246\n```\n*If `--source` option is not passed, default `tar` source is used for downloading.*\n\n**Notes**  \n*Since `elasticsearch` is the default search engine since `v2.4.0` onwards. Make sure to install it prior to M2 installation*  \n\nYou can explicitly pass `elasticsearch` params as\n- `--search-engine` (default: `elasticsearch7`)\n- `--elasticsearch-host` (default: `127.0.0.1`)\n- `--elasticsearch-port` (default: `9200`)\n- `--elasticsearch-index` (default: `magento2`)\n\nUsage example:\n```\nm2-installer --version=2.4.6 --base-url=magento246.test --db-user=root --db-pass=pass --db-name=magento246 --search-engine=elasticsearch7 --elasticsearch-host=127.0.0.1\n```\n\n### To install Magento CE 2.4.6 (without sample data)\n```\nm2-installer --version=2.4.6 --base-url=magento246.test --db-user=root --db-pass=pass --db-name=magento246\n```\n\n### To install Magento with Redis Caching\nIf you want to use `redis` as session storage, frontend and full-page caching, you have to use the following params:\n- `--use-redis-cache` (required)\n- `--redis-host` (optional, default: `127.0.0.1`)\n- `--redis-port` (optional, default: `6379`)\n\nUsage example:\n```\nm2-installer --version=2.4.6 --base-url=magento246.test --db-user=root --db-pass=pass --db-name=magento246 --use-redis-cache\nm2-installer --version=2.4.6 --base-url=magento246.test --db-user=root --db-pass=pass --db-name=magento246 --use-redis-cache --redis-host=127.0.0.1 --redis-port=6379\n# using different hosts for session/full page caching\nm2-installer --version=2.4.6 --base-url=magento246.test --db-user=root --db-pass=pass --db-name=magento246 --use-redis-cache --redis-session-host=127.0.0.1 --redis-default-host=127.0.0.1 --redis-fullpage-host=127.0.0.1\n```\n\n### Use of `--force` option\nUse `--force` option, if you want to\n- Skip the installation wizard/confirmation\n- Clean up the directory prior installation\n\nUsage example:\n```\nm2-installer --version=2.4.6 --base-url=magento246.test --db-user=root --db-pass=pass --db-name=magento246 --force\n```\n\n### Use of config files \nIf you repeatedly install Magento on your development machine, it is recommended to use the config file in one of the following locations:\n1. `~/.m2-installer.conf` - `$HOME` directory (*global scope*)\n1. `./.m2-installer.conf` - project directory (*local/project scope*)\n\n*You can copy the sample config provided in the repo `.m2-installer.conf.dist` to the desired location*\n```\ncurl -0 https://raw.githubusercontent.com/MagePsycho/magento2-installer-bash-script/master/.m2-installer.conf.dist -o .m2-installer.conf\n\n# cp .m2-installer.conf.dist ~/.m2-installer.conf\n# OR\n# cp .m2-installer.conf.dist ./.m2-installer.conf\n```\n\nAnd edit `.m2-installer.conf` config file as\n```\n# Binary Settings\nBIN_COMPOSER=\"composer\"\nBIN_PHP=\"php\"\n\n# Web Settings\n#PROJECT_NAME=\nUSE_SECURE=1\nLANGUAGE='en_US'\nCURRENCY='USD'\nTIMEZONE='America/Chicago'\n\n# Storage Settings\n# files|redis\nSESSION_SAVE='redis'\nCACHING_TYPE=redis\n\n# Admin Settings\nBACKEND_FRONTNAME=\"backend\"\nADMIN_FIRSTNAME='John'\nADMIN_LASTNAME='Doe'\nADMIN_EMAIL='admin@example.com'\nADMIN_USER='admin'\nADMIN_PASSWORD=$(genRandomPassword)\n\n# DB Settings\nDB_HOST=localhost\nDB_NAME=\"${PROJECT_NAME}\"\nDB_USER=root\nDB_PASS=root\n\n# Elasticsearch\nSEARCH_ENGINE='elasticsearch7'\nELASTICSEARCH_HOST='127.0.0.1'\nELASTICSEARCH_PORT=9200\nELASTICSEARCH_INDEX_PREFIX=\"${PROJECT_NAME}_\"\n\n# Redis\nREDIS_HOST='127.0.0.1'\nREDIS_PORT=6379\n#REDIS_PREFIX=\"${PROJECT_NAME}_\"\nREDIS_SESSION_HOST=\"$REDIS_HOST\"\nREDIS_SESSION_PORT=\"$REDIS_PORT\"\nREDIS_DEFAULT_HOST=\"$REDIS_HOST\"\nREDIS_DEFAULT_PORT=\"$REDIS_PORT\"\nREDIS_FULLPAGE_HOST=\"$REDIS_HOST\"\nREDIS_FULLPAGE_PORT=\"$REDIS_PORT\"\n```\n\nNow you can install Magento 2 simply as:\n```\n./m2-installer.sh --version=2.4.6 --base-url=magento246.test --use-secure --force\n```\n\n### To update the script\n```\nm2-installer --self-update\n```\n*Note: This option will only work for version \u003e 0.1.2*\n\n### BONUS 1\nYou can use this script to quickly install the Magento in your beloved [warden](https://github.com/davidalger/warden) environment\n```\ncd /path/to/warden/m2/project\nwarden shell\n```\nAfter login to the container, you can download the script (as mentioned above) and install Magento as\n```\n# With sample data\nm2-installer --version=2.4.6 --install-sample-data --use-secure --base-url=app.\u003cproject\u003e.test --db-host=\u003cproject\u003e_db_1 --db-user=magento --db-pass=magento --db-name=magento --elasticsearch-host=\u003cproject\u003e_elasticsearch_1 --use-redis-cache --redis-host=\u003cproject\u003e_redis_1 --force\n\n# Without sample data\nm2-installer --version=2.4.6 --use-secure --base-url=app.\u003cproject\u003e.test --db-host=\u003cproject\u003e_db_1 --db-user=magento --db-pass=magento --db-name=magento --elasticsearch-host=\u003cproject\u003e_elasticsearch_1 --use-redis-cache --redis-host=\u003cproject\u003e_redis_1 --force\n```\n\n## BONUS 2\nAfter installation, you can create virtual host with this FREE bash script - \nhttps://github.com/MagePsycho/nginx-virtual-host-bash-script\n```\nsudo vhost-nginx --domain=magento246.test --app=magento2\n```\n\n## RoadMap\n - [X] Support of installation parameters via config files (`~/.m2-installer.conf` or `./.m2-installer.conf`)\n - [ ] Support multiple compression types (`.gz`, `.zip`, `.tar.bz2`)\n - [ ] Option to install Magento 2 Enterprise Edition\n - [X] Option to install via composer\n - [ ] Option to install via git clone\n - [ ] Option to check system readiness (PHP \u0026 it's extensions, MySQL, Nginx/Apache)\n - [X] Option to create virtual host (nginx)\n - [ ] Option to create crontab settings\n - [ ] Option to migrate with local codebase + database\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fmagento2-installer-bash-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagepsycho%2Fmagento2-installer-bash-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagepsycho%2Fmagento2-installer-bash-script/lists"}