Skip to content

Instantly share code, notes, and snippets.

Last active January 1, 2018 22:47
Show Gist options
  • Save adamculp/8b895f964521c937a7d4a550f943ff6a to your computer and use it in GitHub Desktop.
Save adamculp/8b895f964521c937a7d4a550f943ff6a to your computer and use it in GitHub Desktop.

Virtual Machine Setup for Zend Expressive Workshop

Welcome, the workshop is hands-on where you will actually be coding while you learn. (it's the best way to learn) This setup will help you with the following:

  1. Install VirtualBox
  2. Install Vagrant
  3. Using Vagrant and VirtualBox set up an Ubuntu 16.04 desktop virtual machine (VM) running a LAMP environment
  • The PHP version in the VM is version 7
  1. Set up the needed files within the VM for the hands-on portion of the workshop at /home/vagrant/workspace/
  • This will include an expressive folder where you will code, and an expressive-final folder with a completed version of the labs for you to use as a resource.

If you have any difficulty completing the following tasks, there will be an opportunity to work with Adam either before or after the workshop. You can also contact him at adamculp[at]uws[dot]net with any questions. Thank you!

Allow approximately one hour to follow these instructions. You will need to install VirtualBox and Vagrant in order to run the virtual machine, and download a Vagrantfile which will allow automated provisioning of the workshop environment.

  1. Install VirtualBox
  1. Install Vagrant

  1. Vagrant File
  • Create an empty folder where you will run the virtual machine (e.g., /path/to/file/location/)
  • Using git-bash, OSX Terminal, Windows Command Interpreter, or your favorite Linux shell, change to the empty folder you created in the previous step:
cd /path/to/file/location
  • Download the course Vagrantfile from this URL:

  • Move the downloaded Vagrantfile from your downloads folder to the empty folder you will run the virtual machine from:

  • Start the VM via CLI from within the created project directory: (The install will take 10+/- minutes depending on your internet speed. Let it run)

vagrant up
  • If vagrant up doesn't succeed to completely set up the VM you can use vagrant provision to rerun the provision scripts.
  1. Finish up provisioning
  • IMPORTANT: After Vagrant has completely finished setting up the VM (you will be advised in the terminal) you MUST reboot the VM using vagrant halt then vagrant up to start it again. If you restart the VM using the Ubuntu gui you will not have access to the mappings for the project files needed for the workshop from the host system. Vagrant creates the mapped location.
  • Note: If the Vagrantfile script errors it’s likely either your laptop does not support virtualization (see step 2 above on how to alter your BIOS), or you are behind a firewall that does not allow the operations. In that case, try again on a different Internet connection without firewall limitations, and in a new directory.
  • Your user id and password in the VM image are both the standard vagrant
  • Stopping the VM: at the command line within the directory where you executed vagrant up you can type the command vagrant halt for the VM to gracefully shutdown without deleting it.
  • Alternatively you could use vagrant destroy to completely remove the VM and then vagrant up to recreate it again. But please do not do this before the workshop unless the provisioning fails for some reason. Otherwise you will find yourself at the mercy of the venue wifi to setup again during the workshop. (which is not a good idea)
  • At the end of the provisioning you will notice 3 new directories along with the Vagrantfile you started with. These will be expressive, expressive-final, and .vagrant. These are mapped in the VM, so you can edit them from either inside the VM (at /home/vagrant/workspace' or from the host system wherever you called Vagrant to provision.
  1. Working from host system
  • If accessing from the host system versus the desktop gui of the Ubuntu VM it is necessary to inform the host system how to find the sites, because DNS will not know.
  • Doing this will require adding the domains to the host file on the host system. (as a super or administrator user) For Windows this would be located at C:\Windows\System32\Drivers\etc\hosts. On Mac or Linux this would be at /etc/hosts.
  • Add the following to the file (note the space between expressive and expressive-final)     expressive expressive-final
  • Save and close the host file
  1. Keyboard layout (if change is necessary)
  • The virtual machine has been set up with English keyboard in mind. If you require it to be different please click the System icon in the upper right and select System Settings. From there you can select Language Support and choose a desired language for a different keyboard layout. This may require an additional install within the VM when prompted.
  • Not necessary, but if desired, you can edit the file /etc/default/keyboard within the VM by following the instructions at
  1. Firefox
  • Inside the VM window open Firefox from the launch panel on the left. Open a tab and navigate to: http://localhost
  1. IDE or Editor
  • To get the most out of this workshop you will be coding. There are two ways to do this:

    a. Install an editor or IDE you feel comfortable with inside the VM. (Zend Studio or PHPstorm recommended). Note that this may require you to allocate more RAM to the VM or it may be a bit sluggish.

    b. Edit the files from the host machine using your editor of choice. If that is an IDE (recommended) please create a project pointing to the expressive folder in your working directory.

  • Keep in mind the VM is running Ubuntu 16.04, so the editors will need to run on that OS. However, most modern editors and IDEs have a version available for Ubuntu.

Enjoy the workshop

Slides for this workshop can be found at:

Code for this workshop can be found at:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment