Software engineer, data guy, Open Source enthusiast, New Hampshire resident, husband, father. Fan of guitars, hiking, photography, homebrewing, sarcasm.
Creating and configuring a virtual machine for LAMP development
After losing my development virtual machine yesterday, I thought I’d document my process for creating a new one. The first thing to do is download your favorite Linux distribution. I prefer Centos (RHEL without the support contract) but what’s most important is creating one that’s as close to your production environment as possible (to avoid package version differences, differences in documentation, and deployment issues). The second step is creating a new virtual machine and defining it’s properties. For a basic development system, I give it 512MB of RAM and a large enough hard drive for your projects. After defining it’s properties, point the CDrom drive at your downloaded Linux distribution ISO and install the operating system. Here’s the fun part, getting everything to work:
Update your packages
Install your favorite text editor
Configure sudo so you don’t have to use root (in: /etc/sudoers)
Create a new user for yourself, and set your new password
Install subversion
Install mysql
Install PHP
(OPTIONAL) upgrade PEAR packages
(OPTIONAL) install additional PEAR packages
(OPTIONAL) install openssl for HTTPS traffic
Set run levels for mysql and apache to ensure the services start automatically
Set MySQL passwords
Configure PHP (edit /etc/php.ini)
Configure Apache
Configure MySQL (edit /etc/my.cnf)
Start Apache & MySQL
(OPTIONAL) Configure Samba so you can edit your virtual machine filesystem from your host operating system
[documentation here]
Now from your host operating system, edit your /etc/hosts file and point your development hostname to the new IP address of your virtual machine. If you go to that web address you should be able to reach your Apache virtual host on your new virtual machine!