Setup Virtualbox for Local Development Environment

Setup Virtualbox for Local Development Environment

Hi Today i am going show you how to setup virtualbox for local Development which will be useful when you are developing / deploying application inside the virtual machine and want to interact with it outside the virtual machine or from host machine,this is also helpful when you are developing for openstack you have installed openstack in vm and want to interact and test the api from host machine, before starting download & install Virtualbox.

Watch Video Tutorial Over Here

Create Host only network adapter

Click on File -> Preference Create Host only network adapter 1

Choose Network, Click Host-only Networks and click on plus sign Create Host only network adapter 2

Click on Settings button of vboxnet0 Create Host only network adapter 3

Under Adapter Tab Create Host only network adapter 4

IPv4 Address 192.168.56.1
IPv4 Network Mask 255.255.255.0

Under DHCP Server Tab Create Host only network adapter 5
Check mark the “Enable Server option”

Server Address 192.168.56.2
Server Mask 255.255.255.0
Lower Address Bound 192.168.56.3
Upper Address Bound 192.168.56.240

Add Host only adapter to virtual machine as Network Adapter 2

Right Click on the vm and click on settings Create Host only network adapter 6

Choose Network , Under Adapter 2
Check Enable Network Adapter
Attached to: Host-only Adapter
Name: vboxnet0 Create Host only network adapter 7

Then boot the vm and run sudo vim /etc/network/interfaces Add These two lines at end

auto enp0s8
iface enp0s8 inet dhcp

Save the file and reboot the vm

Full Contents of /etc/network/interfaces file

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp

auto enp0s8
iface enp0s8 inet dhcp

Once the vm is booted find the ip address given by hostonly adapter by running ip a of enp0s8 interface. Once you get that ip address you can ping, ssh, ftp or if you are running a webserver in vm you can access it from host machine. From your host machine run ping [ip address of vm], install webserver on vm open it on host machine.