:::: MENU ::::

View web pages on a local web server from a virtual machine on Fedora 17

These instructions will allow you to view web pages that are served by your local web development server from within a virtual machine.

Example scenario: you run a local web server on Fedora for development, and you want to test your local site pages from within another operating system which is running in a virtual machine, e.g. to test compatibility with Internet Explorer 9. The below method saves you from having to upload your development files somewhere remote – you can keep all your development local and also try out your pages on all platforms.

1. Install VirtualBox from https://www.virtualbox.org/. Download the .rpm and install it via GUI or commandline

Note: Using either Virtual Machine Manager, or VirtualBox from the rpmfusion repositories does not work.

2. Install and boot your desired OS in VirtualBox (I’ll assume that this is Windows)

3. Edit and save the hosts file of the guest OS to include entries for each of the local websites that you wish to access from the virtual machine. The site names should be identical to the ones in your Fedora /etc/hosts file:

10.0.2.2 local.mysite example.devsite

Note: on Windows saving the hosts file takes effect immediately. On Windows the file is located at c:windowssystem32driversetchosts

Note: Windows 7 requires an additional step to edit the hosts file

4. Start Apache on your host machine, if it isn’t already running

5. On the virtual machine visit example.devsite in a web browser

UPDATE: If you encounter problems when starting your virtual machine relating to kernel modules, try the following:

yum install gcc kernel-devel kernel-headers kernel-PAE-devel

/etc/init.d/vboxdrv setup


One Comment

So, what do you think ?