01 Jan 2017
Ubuntu LAMP VirtualBox Setup on Windows
This guide includes step-by-step instructions on how to install Ubuntu Desktop in Oracle VM VirtualBox, and the LAMP stack - Linux, Apache, MySQL and PHP 7 to run a basic PHP website.
Install Ubuntu 16.04.1 LTS: Download page. Note the download location (i.e. Downloads, Documents, etc.).
Get VirtualBox for Windows: Download page. Choose the download link, x86/amd64 depending on your system. Save the file and run the .exe file.
Follow the VirtualBox installation steps. Once complete, open the application and click, “New”.
Name the operating system – For example, “Ubuntu 16”, then follow the recommended settings to setup the OS.
- RAM size (1024MB recommended)
- Create a virtual hard disk now
- VDI (VirtualBox Disk Image)
- Dynamically Allocate
- Select size of virtual hard disk in megabytes – 8.00 GB
Once the initial setup is complete, click “Start” and locate the downloaded Ubuntu ISO file.
Follow the installation steps:
- Choose language
- Download updates while installing Ubuntu
- “Erase disk and install Ubuntu” for clean install
- Choose location, keyboard layout, username and password
- Install with updates
Once the full installation is complete, sign in with the username and password entered previously.
Install Guest Additions from “Devices”, then “Insert Guest Additions CD image…”. This optimizes the guest operating system. Reference for Guest Additions: VirtualBox Manual
Follow the prompts to install the additions.
Finally, let’s run a few more commands to check for updates, upgrade packages and install major upgrades. Once this is complete, we are ready to install our web stack.
Install Apache 2
Apache will be our main web server that is used for serving web pages to the client computer.
Test to see that Apache installed successfully. Open a web browser and type in your local IP address. To find this, go to System Settings, Network and copy the IPv4 Address number to the browser.
Alternatively, to test in the web browser, go to http://localhost/.
Test to make sure PHP installed successfully.
Create a new php file:
Within the editor, include:
type “ctrl + x” to save and quit nano.
Open a web browser and test with, http://localhost/info.php.