Other Topics, Software Technology - Development and Test Engineering, software testing

Running a Web Application on Ubuntu Virtual Machine (with VirtualBox)

Adding  Ubuntu VM visible on your network.

Running a web server using a virtual machine is useful and needed in most of coorporations. To run web server on virtual machine that is visible to other network machine you need to follow following simple steps.

You can use Host-Only or Bridge Networking option to bring a VM to network. If you want to access internet on the VM then use bridge otherwise host-only. Host-only is more secure when you are running an intranet web application on your VM.

  1. Stop your VM and open its settings in the VirtualBox (OSE) Manager
  2. Go to the Network tab
  3. Select the network mode at your choice (bridged networking or host-only) (in the below example, I’m using host-only)If you want to use bridged networking, you’ve to select the right network adapter at Name. For wired connections, you’d select something named like eth0. Wireless connections are usually named wlan0 (the numbers may vary)
  4. Save the settings
  5. Start the Ubuntu VM
  6. When up, you can gather the IP address by running:
    ifconfig | grep addr
    

    In the below output, 192.168.56.101 is the IP address that can be used in your Win7 host system to access your VM:

    eth0  Link encap:Ethernet  HWaddr 08:00:27:70:27:fe  
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe7b:25fe/64 Scope:Link
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
    
  7. In your windows host system, edit C:\Windows\drivers\etc\hosts as administrator and add a line:
    192.168.56.101   guestserver.com
    

    If you’ve a Ubuntu host system, edit /etc/hosts using sudo nano /etc/hosts

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s