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:
- Install VirtualBox
- Install Vagrant
- 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
- Set up the needed files within the VM for the hands-on portion of the workshop at
- This will include an
expressivefolder where you will code, and an
expressive-finalfolder 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.
- Install VirtualBox
- Get VirtualBox from this URL: https://www.virtualbox.org/wiki/Downloads
- Install Vagrant
- Get Vagrant from this URL: http://www.vagrantup.com/downloads.html
- Check your BIOS to ensure hardware virtualization is enabled (this is a 64-bit VM).
- Vagrant File
- Create an empty folder where you will run the virtual machine (e.g.,
- Using git-bash, OSX Terminal, Windows Command Interpreter, or your favorite Linux shell, change to the empty folder you created in the previous step:
Download the course Vagrantfile from this URL: https://s3.amazonaws.com/expressive-workshop/Vagrantfile
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 updoesn't succeed to completely set up the VM you can use
vagrant provisionto rerun the provision scripts.
- 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 upto 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
- Stopping the VM: at the command line within the directory where you executed
vagrant upyou can type the command
vagrant haltfor the VM to gracefully shutdown without deleting it.
- Alternatively you could use
vagrant destroyto completely remove the VM and then
vagrant upto 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
.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.
- 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
hostfile 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)
127.0.0.1 expressive expressive-final
- Save and close the host file
- 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/keyboardwithin the VM by following the instructions at http://askubuntu.com/questions/342066/how-to-permanently-configure-keyboard
- Inside the VM window open Firefox from the launch panel on the left. Open a tab and navigate to: http://localhost
- IDE or Editor
To get the most out of this workshop you will be coding. There are two ways to do this:
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
expressivefolder 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: http://www.slideshare.net/adamculp/zend-expressive-workshop
Code for this workshop can be found at: https://github.com/adamculp/expressive-workshop