VirtualBox installationDownload and install VirtualBox from https://www.virtualbox.org/wiki/Downloads My testing has been on version 4.1.8 (4.1.10 is the latest). Web service setupOn Linux systems, VirtualBox creates the init script /etc/init.d/vboxweb-service when it is installed. This can be used to start and stop vboxwebsrv. In order to start vboxwebsrv, the file /etc/default/virtualbox must exist with correct settings. If this file does not exist on your system, create it as follows: $ cat /etc/default/virtualbox VBOXWEB_USER=yamini VBOXWEB_USER should be set to the user that runs VirtualBox virtual machines on your system. Start web service
$ sudo /etc/init.d/vboxweb-service start * Starting VirtualBox web service * done. $ netstat -an|grep 18083 tcp 0 0 127.0.0.1:18083 0.0.0.0:* LISTEN For Ubuntu,see https://help.ubuntu.com/community/VirtualBox/Networking for more info on networking. Configure IMS on DASSet GF_HOME to point to installation. Copy over virtualbox.jar into $GF_HOME/modules directory. Copy paste the following commands in a file (change the VDI location and the user name) and run the script. rm -rf ~/virt/templates/* rm -rf ~/virt/disks/* $GF_HOME/bin/asadmin start-domain --debug $GF_HOME/bin/asadmin create-ims-config-virtualbox --emulatorpath /usr/lib/virtualbox virtualbox $GF_HOME/bin/asadmin create-server-pool --virtualization virtualbox --subnet 192.168.1.0/24 --portName "br0" cloud $GF_HOME/bin/asadmin create-template --virtualization virtualbox --files /space/vbox/glassfish/glassfish.vdi --indexes ServiceType=JavaEE,VirtualizationType=virtualbox glassfish $GF_HOME/bin/asadmin create-template-user --virtualization virtualbox --template glassfish cloud $GF_HOME/bin/asadmin create-machine --serverPool cloud --networkName localhost local $GF_HOME/bin/asadmin create-machine-user --serverPool cloud --machine local yamini #copying of the template (~1GB) into ~/virt/templates takes about a min. echo "Copying of template into ~/virt/templates in progress..." sleep 60 ls -l ~/virt/templates/glassfish $GF_HOME/bin/asadmin stop-domain As you can see above you should have the preconfigured templates ready. Start DAS
$ asadmin start-domain Waiting for domain1 to start ......... Successfully started the domain : domain1 domain Location: /space/bg/main/appserver/distributions/glassfish/target/stage/glassfish3/glassfish/domains/domain1 Log File: /space/bg/main/appserver/distributions/glassfish/target/stage/glassfish3/glassfish/domains/domain1/logs/server.log Admin Port: 4848 Command start-domain executed successfully. The moment the VMs are created and launched, you can see the console widows automatically opening up in VirtualBox. $ asadmin list-instances cloud_local_helloworld1Instance running cloud_local_helloworld2Instance running Command list-instances executed successfully. Undeploy the app
$ asadmin undeploy helloworld Command undeploy executed successfully. $ sudo /etc/init.d/vboxweb-service start * Starting VirtualBox web service * VirtualBox kernel module not loaded! Run the following script to compile VirtualBox kernel $ sudo sh /etc/init.d/vboxdrv setup * Stopping VirtualBox kernel modules [ OK ] * Uninstalling old VirtualBox DKMS kernel modules [ OK ] * Removing old VirtualBox pci kernel module [ OK ] * Removing old VirtualBox netadp kernel module [ OK ] * Removing old VirtualBox netflt kernel module [ OK ] * Removing old VirtualBox kernel module [ OK ] * Trying to register the VirtualBox kernel modules using DKMS * Failed, trying without DKMS * Recompiling VirtualBox kernel modules [ OK ] * Starting VirtualBox kernel modules $ sudo /etc/init.d/vboxweb-service start * Starting VirtualBox web service * done. |
$ vboxmanage setproperty websrvauthlibrary null
$ cat /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto br0 iface br0 inet dhcp bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0
$ sudo chown :vboxusers /dev/net/tun $ sudo chmod 0660 /dev/net/tun
$ sudo /etc/init.d/networking restart * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces * Reconfiguring network interfaces... ssh stop/waiting ssh start/running, process 5297 ssh stop/waiting ssh start/running, process 5404 [ OK ] $ ifconfig br0 Link encap:Ethernet HWaddr 5c:26:0a:83:61:67 inet addr:192.168.1.13 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::5e26:aff:fe83:6167/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:24 errors:0 dropped:0 overruns:0 frame:0 TX packets:88 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3166 (3.1 KB) TX bytes:39532 (39.5 KB) eth0 Link encap:Ethernet HWaddr 5c:26:0a:83:61:67 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:66676 errors:0 dropped:0 overruns:0 frame:0 TX packets:93294 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:53021155 (53.0 MB) TX bytes:22929009 (22.9 MB) Interrupt:20 Memory:e2e00000-e2e20000 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:60263 errors:0 dropped:0 overruns:0 frame:0 TX packets:60263 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:30297269 (30.2 MB) TX bytes:30297269 (30.2 MB) virbr0 Link encap:Ethernet HWaddr d6:25:fd:9d:c2:a1 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
$ asadmin deploy /tmp/helloworld.war Application deployed with name helloworld. Command deploy executed successfully.