Few days ago I've installed VirtualBox from Oracle on my windows7 machine because I needed a linux where to play with apache webserver.
The instalation was very easy (I assume that internet is available on the host system :D)
- Installed VirtualBox
- Created a guest machine for Debian
- Downloaded Debian Netinstall Image; it is a small CD image which allow ou to install Debian via network. Just google for debian netinst iso , and you should get the latest version.
- Tell to VirtualBox to boot first from the downloaded iso file, and "start" the guest machine.
- Machine boots and next steps are straightforward: select language, partition disk, select and install packages
- The guest machine will then download the needed packages from the internet and will be installed.
Then I made a login to the guest system and play a little with apache, browsing etc...
My expectation was I'll be able to browse the guest apache from the host system.
It does not work by default installation :(... so, I had to read some docs 😀 .
The idea is that on default install the VirtualBox will create an network adapter of type NAT (Network Address Translation). This type of adapter will permit to the guest to browse om Internet via host IP; but it does not allow connections to the guest.
Just stop the guest operating system and in VirtualBox Manager go to Settings->Network and change the network adapter from NAT to Bridged Adapter like in next picture.
If you have more than one network adapter on your host system, be sure that in the same window you have selected the proper one. See Name: field, in my case the active one was the Wireless LAN the one that has internet access, so I've selected that one. Be sure that Cable connected checkbox is on.
No other settings are needed.
Click OK and restart your guest operating system.
If you are in a DHCP network (IPs allocated dynamic) do login on the guest operating system and run the ifconfig command to see what IP was alocated. E.g in my case I got:
eth0 Link encap:Ethernet HWaddr 08:00:27:d7:2d:94
inet addr:192.168.1.105 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fed7:2d94/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:51 errors:0 dropped:0 overruns:0 frame:0
TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:14365 (14.0 KiB) TX bytes:10874 (10.6 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:60 errors:0 dropped:0 overruns:0 frame:0
TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:23077 (22.5 KiB) TX bytes:23077 (22.5 KiB)
Then I just go to the host system and browse to http://192.168.1.105/ , and all was fine.
If you are not an a DHCP network (ou are using static IPs), you have to set also the IP on the guest system. The same ifconfig command needs to be used, and it will require root permissions.
More info and details about network adapters available on VirtualBox virtualmanchine cahn be found here http://www.virtualbox.org/manual/ch06.html