VAAMP - part 1

In this three-part series, I'll walk you through setting up a cross-platform LAMP server for local development.  I'll be using VirtualBox, Alpine Linux, Apache, MySQL, and PHP so I've nicknamed it VAAMP.


Your first question is probably "Why not just use Docker, Vagrant, or XAMPP?"

Docker shows good promise, but is wildly in flux so I'll wait until OCP OCI becomes standardized.  It's also somewhat complicated to set up and use for a novice programmer simply looking to develop locally.

Vagrant does a good job of simplifying the setup and run process but customizing it requires knowledge of Ruby (which many developers may not know) and Windows support in version 1.7.2 is buggy.

XAMPP avoids additional virtualization overhead by installing Apache and PHP directly on the host OS but isn't easily scriptable to create a custom development workflow suited to your unique tastes and needs (such as installing Drush along with the LAMP stack).

Since VirtualBox is free, supports Windows, Mac, and Linux, and provides a command-line interface, it's a nice fit for my needs.  Also, Alpine Linux is smaller and more secure than many other common Linux distros so it's a good fit for basic local development.  Caveat: the Alpine Linux VirtualBox guest additions are currently in testing (at the time of this writing) so you're limited to a VirtualBox screen size of 800x600 (fortunately our use case leverages the host browser and a shared file system to communicate with the VM so this shouldn't be a problem).

VirtualBox and Alpine Linux setup



If you don't want to manually perform all the steps below, you can just download the VirtualBox appliance here.


1.  Download the latest alpine-mini1 iso file

2.  Download and install VirtualBox

3.  Open VirtualBox and choose File > Preferences...

4.  In the Network section, click on the Host-only Networks tab and then click on the + button.  This will create a new network interface

5.  Once the new network interface has been created, make sure it's selected and then click on the screwdriver button

6.  Set the IPv4 Address to and the IPv4 Network Mask to

7.  Then, click on the DHCP Server tab and uncheck the Enable Server checkbox (we'll be using a static IP instead of DHCP for this network interface)

8.  Click OK multiple times until you return to the default VirtualBox window.

9.  Click New and provide a descriptive Name and for Type choose Linux and Version choose Other Linux (64-bit)

10.  Assign the desired amount of memory to the VM

11. Create a virtual hard drive

12. Choose the VMDK format (since it's more widely used by other virtualization platforms and tools)

13. Use a dynamically allocated virtual hard drive

14. Indicate the desired disk size and then click Create

15. Once the VM has been initialized, make sure it's highlighted in the list and then click Settings

16. Click on Storage and then click on the Empty CD-ROM and use the dropdown button to choose the alpine-mini iso file from step 1 above

17. Then, click on Network and verify Adapter 1 is set to NAT

18. Click on the Adapter 2 tab and click the checkbox to enable it and choose Host-only Adapter and choose the new network interface you created in step 5

19. Click OK multiple times until you return to the default VirtualBox window.

20. Click Start

21. Login as root

22. Then run setup-alpine

23. You'll be prompted to select your keyboard

24. Choose a hostname (or just press ENTER to keep the default localhost).  For eth0 (NAT) press ENTER to keep the default dhcp.  For eth1 (host-only) type and press ENTER.  Then, press ENTER for the remaining network options to keep the defaults.  Note: in the remainder of this guide, if I don't provide a recommendation, you can just use ENTER to keep the default Alpine Linux recommendation.

25.  Choose a mirror (I chose 1 since the default scan 'f' seemed to hang)

26. When prompted to choose a hard disk, select sda and then sys and finally type y to install Alpine Linux to the virtual hard disk you created in step 14.

27. After the installation is complete, type poweroff to shut down the VM

28. Click on Settings

29. Click on Storage and then click on alpine-mini to highlight it.  Click on the CD-ROM dropdown and choose Remove disk from virtual drive and click OK

30. The CD-ROM drive should now show as Empty

31. Click OK multiple times until you return to the default VirtualBox window.

32. Click Start

33. When the VM boots, login as root with the new password you were prompted to set during the alpine-setup phase.

34. You should be able to access the Internet (thanks to the eth0 NAT network interface)

35. You should also be able to ping the Alpine Linux guest VM from your host computer (thanks to the eth1 host-only network interface)

Congratulations!  You've installed Alpine Linux on VirtualBox.  Check out the next post in this series: Apache, MySQL, and PHP setup




Post a Comment

Keep it clean and professional...