VirtualBox is an open source virtualizer, an application that can run an entire operating system within its own virtual machine.
Stable version >= 5.2.0
- Download the installer for your laptop operating system using the links below.
- Run the installer, choosing all of the default options.
- Windows: Grant the installer access every time you receive a security prompt.
- Mac: Enter your admin password.
- Linux: Enter your user password if prompted.
- Reboot your laptop if prompted to do so when installation completes.
- Close the VirtualBox window if it pops up at the end of the install.
Vagrant is an open source command line utility for managing reproducible developer environments.
Stable version >= 2.2.0
- Download the installer for your laptop operating system using the links below.
- Reboot your laptop if prompted to do so when installation completes.
- Made by Onilab for Windows 10:
https://onilab.com/blog/install-magento-2-on-localhost-a-windows-10-guide/
⚠ DO NOT USE SSH KEY WITH PASSPHRASE, this vagrant installation is non-interactive.
If your ssh key has been created with a passphrase, please create an other one.
- On Windows only: open UEFI BIOS and make sure virtualization is turned 'on'
- On Windows only: open powershell as administrator and run:
Add-MpPreference -ExclusionProcess winnfsd.exe
- On Windows only: open
C:\Windows\System32\drivers\etc\hosts
as administrator then addnetwork_ip
andmagento_url
Default values would be:192.168.200.50 dev.magento.com
- On Linux only: in order to install NFS, run
sudo apt install nfs-kernel-server
- On Linux/MacOS only: open
/etc/hosts
as sudo then addnetwork_ip
andmagento_url
Default values would be:192.168.200.50 dev.magento.com
- Clone this project:
git clone [email protected]:zepgram/magento2-fast-vm.git
- Copy/past:
ssh.example
rename itssh
then put yourid_rsa
andid_rsa.pub
keys - Copy/past:
config.yaml.example
rename itconfig.yaml
Then customize configurations according to Yaml config overview - If you want to import an existing database: create a compressed sql dump and name it
db-dump.sql.gz
.
You must also fillcrypt_key
in config.yaml - To start install run:
vagrant up
(duration: ~20 minutes) - Finally run:
vagrant ssh
to access to your guest machine
- Vmconf
- machine_name: oracle virtual machine name (Vagrant Magento 2)
- network_ip: virtual machine ip (192.168.200.50)
- host_name: virtual machine host name (zepgram)
- memory: RAM of virtual machine (4096)
- cpus: CPU usage (2)
- mount: nfs / rsync / default (nfs)
- path:
- 'app' mount only app directory /var/www/magento/app
- 'root' mount whole directory /var/www/magento
- provision: define shell provisionning sequence (all)
- 'all' run all provisionner files
- 'system' run only machine provisionner
- 'magento' run magento provisionner
- Composer
- username: magento access set your magento credentials (magentoUsernameKey)
- password: magento access set your magento credentials (magentoPasswordKey)
- Git (optional)
- name: git account username (John Doe)
- email: git account email ([email protected])
- host: set your git host server to add ssh key to "known hosts" (github.com)
- repository: clone your existing magento project (ssh://[email protected]:project-name.git)
- Magento
- url: magento site host name (dev.magento.com)
FI do not use .dev or .localhost as extension - source: define installation source (composer)
- 'composer' install magento source code from official composer repository
- 'git-branch-name' install magento project from your git repository based on defined branch (ex: master)
- edition: magento project edition, used only on composer source installation (community)
- 'community' install magento community edition
- 'enterprise' install magento enterprise edition
- version: set magento version and also define PHP version (2.3.3)
- php_version: override the default required version by yours, for example '7.1' (default)
- sample: install sample data, used only on composer source installation (true)
- mode: magento mode (developer)
- currency: set currency (USD)
- language: set language (en_US)
- time_zone: set time zone (Europe/London)
- crypt_key: crypt key under your app/etc/env.php (only required if db-dump.sql.gz exist)
- url: magento site host name (dev.magento.com)
- root directory: mount the entire project.
- app directory: mount only app directory. Ensure great performance by not sharing generated files between machines.
Only useful on path set to root
.
- Loss of performance is due to files generated on the fly, by excluding them you can mount the whole directory
root
and get performance equal to anapp
mount. - The
vagrant rsync-auto
is launched by default on vagrant up, even with that if you need to force an update you can runvagrant rsync
. Terminal should be kept open for rsync-auto: do not close it. - Rsync is unilateral, your host machine push files to guest but not the other way.
Anyway if it's necessary, after acomposer update
for example, you can runvagrant rsync-back
to push files from guest to host.
Recommended for root
and app
path.
The most stable option, config has been made to ensure compliance with all OS.
Less performant than rsync but files are perfectly shared between guest and host machine.
It can be used with app
path if you encountered any issue with NFS and rsync mount.
You can add extra shell provisions.
Those provisions will be executed on pre-defined sequences:
extra/001-env.sh
his purpose is to provide extra environment variables or extra package, executed after script001-system-env.sh
extra/100-pre-build.sh
define your specific system configuration before installation, executed after script100-magento-pre.sh
extra/120-post-build.sh
you can execute magento command in this sequence, executed after script120-magento-post.sh
- To be executed you must remove the string
-example
from the filename script. - As an example of use, you can adapt data from your database import by using the script
100-pre-build.sh
Magento file system owner is configured for vagrant
user, it means all commands in magento project must be executed by this user.
By default command line vagrant ssh
will log you as vagrant user.
- To re-apply magento permission you can run
permission
in command line: this is only applicable forapp
path ordefault
mount configurations.
- magento (Magento CLI for your project)
- magento-cloud (CLI provided for Magento Cloud)
- pestle (A collection of command line scripts for Magento 2 code generation)
- magerun (The swiss army knife for Magento developers)
- permission (Apply magento2 permissions on project)
Enable cron:
./bin/magento cron:install
Disable cron:
./bin/magento cron:remove
Version 7.6.x of Elasticsearch is available for Magento.
If your Magento version is lower than 2.4 then version 6.x will be installed.
For version lower than 2.4, you can disable it and fall back to mysql:
./bin/magento config:set catalog/search/engine mysql
- php + required extensions
- curl
- git
- gitflow
- vim
- composer
- nginx
- php-fpm
- percona
- redis-server
- elasticsearch
- grunt
- postfix
- mailcatcher
- pestle
- magereun
- adminer
- magento-cloud cli
- bin/magento bash completion
- User bash terminal
- user: vagrant
- Back-office
- url: magento[url]/admin
- user: magento.admin
- pass: admin123
- Database
- user: vagrant
- pass: vagrant
- name: magento
- Mailcatcher
- url: [network_ip]:1080
- Adminer
- url: [network_ip]/adminer
- Phpinfo
- url: [network_ip]/php
There is a known issue with composer installation on windows 10.
This issue could not be solved yet, and has already been reported 2 times.
- It's related to the computer and BIOS configuration.
- It's only with "nfs" setting for mount option.
To solve this, just try to set mount option to "rsync", then after full installation you should be able to fallback to NFS.
- If you have trouble during installation please open a new issue on this git repository.