All posts by logituckadmin

Step 3 > Making your VirtualBox Machine autoboot in the Zone

This assumes you’ve got a fully working VirtualBox Guest
– i.e. you’ve got Windows XP fully installed and up and running
We’ll assume your Solaris Zone is called myzone2

Login to the myzone2 Solaris Zone

su

Install /etc/default/virtualbox

cat > /etc/default/virtualbox << EOF
# virtualbox defaults file
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/vbox.cfg
EOF

Create /etc/vbox directory

mkdir /etc/vbox

Create /etc/vbox/autostart.cfg

cat > /etc/vbox/autostart.cfg << EOF
default_policy = allow
EOF

Discover the name of your VirtualBox Machine

VBoxManage list vms
Your output will look similar to this :
VBoxManage list vms
in this example, the name of the VirtualBox Machine is “Windows XP”

Make the VirtualBox Machine autoboot

VBoxManage modifyvm "Windows XP" --autostart-enabled on

Adjust the /opt/VirtualBox/smf-vboxautostart.sh script

WAS:

NOW: apply changes in purple

Update the VirtualBox AutoBoot Service

svccfg -s svc:/application/virtualbox/autostart:default setprop config/config=/etc/vbox/autostart.cfg

svcadm enable svc:/application/virtualbox/autostart:default

Shutdown your existing VirtualBox Machine and Reboot your zone

When the zone boots up – the VirtualBox Machine will boot up too!

Credits:

http://www.sbrickey.com/Tech/Blog/Post/VirtualBox_on_Solaris

http://askubuntu.com/questions/404665/how-to-start-virtual-box-machines-automatically-when-booting

http://lifeofageekadmin.com/how-to-set-your-virtualbox-vm-to-automatically-startup/

Step 2 > Setting up the Zone and installing VirtualBox in the Zone

First off – we’ll create a Solaris Zone
Later we’ll install VirtualBox in the Solaris Zone

Login to your Solaris PC / Global Zone as root

Discover the name of your ip interface :

ipadm show-if
Your output will look similar to this :
ipadm show-if
in this example, the name of the interface is rge0

Create A New Solaris Zone

The zone will be called myzone2 and will have the ip address 192.168.1.102 and will be saved in /zones/myzone2

zonecfg -z myzone2
   myzone2: No such zone configured
   Use ‘create’ to begin configuring a new zone.

zonecfg:myzone2> create -b
zonecfg:myzone2> set ip-type=shared
zonecfg:myzone2> set autoboot=true
zonecfg:myzone2> set scheduling-class=FSS
zonecfg:myzone2> set zonepath=/zones/zone2

zonecfg:myzone2> add net
zonecfg:myzone2:net> set physical=rge0
zonecfg:myzone2:net> set address=192.168.1.102/24
zonecfg:myzone2:net> set defrouter=192.168.1.254
zonecfg:myzone2:net> end

zonecfg:myzone2> set limitpriv=default,sys_smb
zonecfg:myzone2> add capped-memory
zonecfg:myzone2:capped-memory> set physical=256m
zonecfg:myzone2:capped-memory> set swap=512m
zonecfg:myzone2:capped-memory> set locked=128m
zonecfg:myzone2:capped-memory> end

zonecfg:myzone2> verify
zonecfg:myzone2> commit
zonecfg:myzone2> exit

Install Solaris OS into the myzone2 Solaris Zone

zoneadm -z myzone2 install

Once the Solaris OS is installed into the myzone2 Solaris Zone

zonecfg -z myzone2 "add device; set match=/dev/vboxdrv; end"
zonecfg -z myzone2 "add device; set match=/dev/vboxusbmon; end"

Boot the myzone2 Solaris Zone

zoneadm -z myzone2 boot

Login to the myzone2 Solaris Zone

There may be a delay of 20 seconds before the Configuration Screen appears

If nothing happens after 20 seconds, press the F2 key!

zlogin -C myzone2

Once you’ve completed the Configuration Screen :

Login as root with the password you setup during the Configuration just a moment ago.

- Install Apache, PHP, MySQL :

pkg install pkg:/group/feature/amp

Activate and Run Apache Web Server

svcadm -v enable /network/http:apache22

Download and Install VirtualBox 4.2.18

wget http://download.virtualbox.org/virtualbox/4.2.18/VirtualBox-4.2.18-88780-SunOS.tar.gz
wget http://download.virtualbox.org/virtualbox/4.2.18/Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack
gunzip -cd VirtualBox-4.2.18-88780-SunOS.tar.gz | tar xvf -
pkgadd -G -d VirtualBox-4.2.18-SunOS-r88780.pkg
(answer Y to all install prompts)
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack

Check everything is fine

VBoxManage list hostinfo | less
VBoxManage list extpacks | less
VBoxManage list systemproperties | less

Setup vboxwebsrv

svccfg -s svc:/application/virtualbox/webservice:default setprop config/host=localhost
svccfg -s svc:/application/virtualbox/webservice:default setprop config/port=18083
svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=root
svcadm refresh svc:/application/virtualbox/webservice:default

Download and Setup PHPVirtualBox 4.2.18

cd /var/apache2/2.2/htdocs
mkdir phpvirtualbox
wget http://cznic.dl.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.2-8.zip
cd phpvirtualbox
unzip ../phpvirtualbox-4.2-8.zip
cp config.php-example config.php

Make the following changes to config.php

PHPVirtualBox config.php update

Remove VirtualBox Web Authentication

VBoxManage setproperty websrvauthlibrary null
svcadm enable svc:/application/virtualbox/webservice
svcadm restart svc:/application/virtualbox/webservice

Setup VirtualBox (that’s installed in zone2)

From a web browser, goto http://192.168.1.102/phpvirtualbox

user: admin

pass: admin

PHPVirtualBox Browser Window

When creating a Virtual Machine – DON’T FORGET :

* Ensure Networking is set to NAT

* In Advanced> ensure you Disable NetBIOS over TCP/IPbefore you setup Port Forwarding in VirtualBox :

Disable NetBIOS over TCP/IP

* During Installing Windows as a VirtualBox guest the mouse may be a bit ‘out of step’ – so don’t forget to install VirtualBox Guest Additions once Windows is installed – to make your mouse and screen 100% perfect !

* In Advanced> ensure Port Forwarding is setup as :

VirtualBox Solaris Zone NAT Windows Shares

Proceed to Step 3 > Making your VirtualBox Machine autoboot in the Zone

Credits:

http://learnings-on-solaris.blogspot.co.uk/2012/06/virtualbox-running-on-non-global-zone.html

http://en.helpdoc-online.com/virtualbox_4.1.2/source/ch02s04.html#solariszones

http://learnings-on-solaris.blogspot.co.uk/2012/06/installing-virtualbox.html

http://learnings-on-solaris.blogspot.co.uk/2012/06/virtualbox-running-on-non-global-zone.html

https://www.virtualbox.org/manual/ch09.html#vboxwebsrv-daemon

https://www.virtualbox.org/ticket/4876

http://www.novell.com/documentation//platespin_forge_3/user/data/bu5wx1x.html

http://sourceforge.net/p/phpvirtualbox/wiki/Home/

https://code.google.com/p/phpvirtualbox/issues/detail?id=25

Step 1 > Setting up the Global Zone / your physical Solaris PC

To get started you’ll need to install VirtualBox on the physical Solaris PC / Global Zone. You’ll aslo need to create a directory, add permissions and install a package
(!) Don’t forget we’re using VirtualBox v4.2.18 as later versions of VirtualBox have problems with Solaris Zones, but this version is 100% okay with Solaris Zones – So best not up upgrade VirtualBox after you’ve installed it

Also if you’ve already got VirtualBox installed, best to uninstall it first !

Login to your Solaris PC / Global Zone as root


mkdir /zones
zfs set mountpoint=/zones rpool/zones
zfs get mountpoint rpool/zones
chmod -R 700 /zones/.

Install and enable key dependency for capping memory :


pkg install SUNWrcap
svcadm enable rcap
rcapadm -E

Set up the system with Fair Share Scheduling as the default scheduling class when zones are in use :

dispadmin -d FSS

Download and VirtualBox 4.2.18 and it’s Extension Pack

VirtualBox 4.2.18:
http://download.virtualbox.org/virtualbox/4.2.18/VirtualBox-4.2.18-88780-SunOS.tar.gz

VirtualBox Extension Pack for VirtualBox 4.2.18:
http://download.virtualbox.org/virtualbox/4.2.18/Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack

Now unpack and install VirtualBox 4.2.18

gunzip -cd VirtualBox-4.2.18-88780-SunOS.tar.gz | tar xvf -
pkgadd -d VirtualBox-4.2.18-SunOS-r88780.pkg
(!) Answer YES to any prompts

Next, unpack and install VirtualBox Extension Pack for VirtualBox 4.2.18

VBoxManage extpack install –replace Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack

Check everthing is okay …

VBoxManage list hostinfo | less
VBoxManage list extpacks | less
VBoxManage list systemproperties | less

Proceed to Step 2 > Setting up the Zone and installing VirtualBox in the Zone

Credits:

http://learnings-on-solaris.blogspot.co.uk/2012/06/virtualbox-running-on-non-global-zone.html

http://en.helpdoc-online.com/virtualbox_4.1.2/source/ch02s04.html#solariszones

http://learnings-on-solaris.blogspot.co.uk/2012/06/installing-virtualbox.html

http://learnings-on-solaris.blogspot.co.uk/2012/06/virtualbox-running-on-non-global-zone.html

https://www.virtualbox.org/manual/ch09.html#vboxwebsrv-daemon

https://www.virtualbox.org/ticket/4876

http://www.novell.com/documentation//platespin_forge_3/user/data/bu5wx1x.html

http://sourceforge.net/p/phpvirtualbox/wiki/Home/

https://code.google.com/p/phpvirtualbox/issues/detail?id=25

http://thegeekdiary.com/resource-management-in-solaris-zones-capped-memory/