[UPDATE 8/26/2010: Since I wrote this article last year, I discovered that VPC 2007 does not run on Windows 7, it has been superseded by Windows Virtual PC. This information should also work for Windows Virtual PC. If you have any questions, feel free to contact me, contact info is in the "About" section of the site.
If the screenshot pictures won't load, refresh the page a couple of times, they've been problematic on this article and I haven't had time to go through and figure out why and fix them up.]
Recently, in needing to setup an exact local-only copy of a Joomla-powered website, I found myself in need of a LAMP (Linux, Apache, MySQL, PHP) server in a hurry. I wanted it to be portable so I could use it in multiple places, or even base it off a usb flash drive.
So, I opened up Microsoft Virtual PC 2007, a freeware PC virtualization tool and installed OpenSUSE Linux into it. I stripped it down to the bare essentials and set it up to run in Runlevel 3 as a text-only server (no GUI to work with. Sorry!) It will run with the RAM set as low as 128 MB in MS VPC, and perhaps even lower, though I suggest using at least 512 so that the server will be more responsive, particularly for database-heavy websites.
You can download my MS VPC VHD (Virtual Hard Disk) and settings file here for Virtual PC. (415 MB) Archived in RAR format, because uncompressed it's around 2.4 GB Total. Get WinRAR here.
Root Password is "Pass2009". There is a default user account as well, login name "user", password "Pass2009".
This LAMP server is based on OpenSUSE 10.2. I did try it with 11.2, the most current version, but I needed PHP 5.2.11 or older, and 11.2 was packed in with 5.3.1, which broke the old Joomla 1.0 release I needed to work with at that moment.
Here are the install's "vitals":
- Linux Version: OpenSUSE 10.2, Starts in Runlevel 3 (no graphics/x window system)
- php Version: 5.2.0
- MySQL Version: 5.0.26 (login as "root", no password)
- Apache HTTPD version: 2.2.3
All services should start on startup, so by the time you get to the login, everything is ready to fly.
The network interface is set to DHCP by default. You should try to start the server with the settings file included in the downloaded archive (OpenSUSE 10.2 Generic LAMP Server.vmc). You will likely need to change the file path to the virtual hard disk file in Virtual PC to the path on your system (just hit "Browse" and select it.)
If you make your own "New Virtual Machine " and set it up to use the existing hard drive, it will work. The only kicker is that the network card settings in OpenSUSE will not work because each time you make an new virtual machine in VPC, it generates a new MAC address for the emulated network card. So, OpenSUSE sees this "new" card as an unconfigured network card and thinks the old one (from my original setup) has been removed. Follow these easy steps to get the network card going:
- Go into the settings for your virtual machine and make sure that Network Adapter 1 in "Networking" is set to your network-connected network adapter. It doesn't matter if it's wired or wireless. (VPC Sets itself to "Host only" by default with a new VM for some reason.)
- Login to OpenSUSE as root.
- Enter "yast" at the bash prompt.
- Take a look at the following picture (Click to enlarge). This covers how to setup the adapter for DHCP, if you're going to use a static IP, that can be done here too naturally.
Once all that is done, issue an "init 6" or "shutdown -r now" command to reboot and the adapter should come up and get an address on it's own this time around. if you miss it during boot, you can always find out what IP it was assigned by passing the command "ifconfig" (You will need to be running as root to do this.)
The HTML files are set to the default, "/srv/www/htdocs/". So, if you didn't already know, that's where you put your website files and such.
vsFTPd is running as the FTP server, you can login using "user" by default. It will drop you in user's home folder. I usually upload my page items to user's home and then move them to /srv/www/htdocs from the tty or console, but there's probably a better way (such as reconfiguring vsftp to chroot you right to the web server.) I just like to keep my bash command knowledge fresh!
Feel free to contact me with any questions using Backwood Realm Systems' contact page.