Skip to content
Base Vagrant image for building Magento 2 within
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Quick and dirty Vagrant image for building Magento 2. The idea is you run MySQL and Apache in a Vagrant 'box' (VM), but do all your development using your normal tools on your desktop.

It purposely only uses shell scripts to configure things so readers can poke around and not have to learn yet another technology like Chef, Puppet, or Ansible. Serious developers might like to look at other Vagrant images.

See for Vagrant installation instructions.

Make sure to install the latest version of VirtualBox and VirtualBox Addons before proceeding.

If you want a stable Vagrant set up, clone or keep a copy - I am going to rework as I see fit for a while yet.

To use, check out Magento 2 and this Vagrant files in sibling directories. For example:

cd myprojects
git clone
git clone

The Vagrantfile mounts ../magento2 under /var/www/magento2.

You can edit using your local tools in your laptop/desktop etc. Go into the 'magento2' directory and edit away!

To start up the Vagrant image, go into 'vagrant-magento2-apache-base' and run 'vagrant up'. It contains its own MySQL database and Apache web server. You need to log in and run the deploy script from inside for now. This runs the Magento setup script (wipes database, wipes caches, creates config files etc). This may change in the future

cd vagrant-magento2-apache-base
vagrant up

First time you check out the tree, you need to run composer to download 3rd party libraries. You can do this on your laptop/desktop or inside Vagrant. First time you do an install, later you would do a comoser update after each git pull to make sure the libraries are kept up to date. This is slow, so I did not include in the script.

vagrant ssh -- "cd /var/www/magento2 && composer install"

You also need to create the local database, or occasionally wipe it to start again. A shell script is provided to do this.

vagrant ssh -- sh /vagrant/scripts/

Finally, accesses your site on your laptop/desktop using http://localhost:8080/

Feedback welcome!

See also

(Future ideas include parameterizing so you can pick the web server (Apache or Nginx), pick the database server (MySQL, MariaDB, Percona etc), add Redis, Varnish etc auxiliary servers. One day!)

You can’t perform that action at this time.