Before we can start with anything, we need to prepare an environment to work in over the course of this book. In order to give you correct advice and useful instructions at all times, I need to know your work environment as precisely as possible. But because I’m not exactly sitting next to you, this is a challenge. Fortunately, there is a very simple solution for this.

Instead of working directly in the environment you already have (which might be a Windows desktop, a Mac laptop, a Linux system, or something else I cannot anticipate), we are setting up a clearly defined work environment on not clearly defined computer, and voila, the problem is solved.

We do this by setting up a virtual machine which is going to run a Linux desktop environment, and by doing all the work within this virtual machine. By following the installation instructions below, you will end up with a virtual machine, and therefore a work environment, which is clearly defined and which is therefore guaranteed to be the optimal environment for working through this book.

Installing VirtualBox

The very first step we need to do is to download and install VirtualBox. VirtualBox is a virtual machine host software which is provided free of charge. It allows to run virtual machines on physical computers which run Microsoft Windows, macOS, or Linux.

Your physical computer is called the host system - it hosts the virtual machine which we will use for this book.

Please download the platform package version matching the operating system of your host from

As of this writing, VirtualBox is at version 5.1.22, but downloading and installing a newer version probably doesn’t hurt.

After downloading the installation file, run it to set up VirtualBox on your system.

Downloading the Linux installation image

With VirtualBox installed, we do not yet have a virtual machine running Linux. We need to create it first.

To do so, we need the installation medium of the Linux distribution we are going to use. In our case, that’s Ubuntu, the most widely used Linux desktop distribution available.

In order to allow me to know your work system as precisely as possible, it is neccessary that you download the installation medium for version 16.04 of Ubuntu Desktop for amd64 platforms - even if newer version may already be available!

Please download the ISO file containing the installation image from

Creating a new virtual machine

Before we can install Ubuntu from its installation ISO, we need to create a new virtual machine in VirtualBox.

To do so, launch VirtualBox, and choose New… from the Machine menu.

Give it a name of your choice (maybe something like “Ubuntu for PHP book”), and define its type as Linux and its version as Ubuntu (64-bit).

Hit Continue.

On the next screen, you set the memory size. You can always change this later, and the default of 1024 MB is just fine.

Hit Continue again.

You are now asked to create a hard disk for you virtual machine. This hard disk is also “virtual” in the sense that it is in fact just a file on the physical hard disk of your physical host system.

Choose “Create a virtual hard disk now” and hit Create.

The upcoming dialogue asks for the hard disk file type. The default of “VDI” is fine.

Hit Continue again.

You are now asked if you want the storage for your hard disk to be allocated dynamically, which is indeed what we want.

Hit Continue again.

Now you can set the size of the virtual hard disk and the location of the file which represents the hard disk. Please choose 15,00 GB for the size and keep the location unchanged.

Hit Create.

With this, the dialogue closes, and you now have a virtual machine. It should show up in the list of virtual machines on the main screen of VirtualBox

It is powered off, and also, its hard disk is completely empty, because nothing has been installed onto this machine yet. It’s like having a brand new physical computer from the store with an empty physical hard drive.

Next, we need to install Ubuntu onto the virtual machine by using the downloaded ISO installation image.

Installing Ubuntu on the virtual machine

To start installation, simply boot the virtual machine by hitting the Start button on the VirtualBox main screen.

VirtualBox will immediately present a dialogue which allows to select the installation medium. Choose the Ubuntu ISO file you have downloaded. To open a file browser, click on the small yellow folder symbol with the green arrow.