Solaris Zones (aka Containers) are Solaris virtual machines (Non-Global Zones) running on an underlying Solaris host (The Global Zone), i.e.
-NON-GLOBAL ZONE- -Can be a “Spars Root”, “Whole root”, or “Branded” zone.
—-GLOBAL ZONE—– -The host OS
——HARDWARE—— -The “tin”
A NON-GLOBAL ZONE is a virtual machine and can be a “Spars Root”, “Whole root”, or “Branded” zone.
A SPARS ROOT ZONE shares parts of the GLOBAL zone (host’s) filesystem, usually in a read-only manner, i.e. if you patch the GLOBAL ZONE, you’ll patch the spars root zones too.
A WHOLE ROOT ZONE takes 100% copy of GLOBAL zone and is therefore 100% independent of it.
A BRANDED ROOT ZONE allows for an entirely different version of Solaris to be installed, and is also 100% independent and different to the GLOBAL zone running on the underlying hardware.
PREPARATION
ifconfig -List network cards and decide what ones you want to use for the non-global zone
CONFIGURATION OF A NEW ZONE
zonecfg -z <zone-name> -Configure system for new zone and write configuration file to /etc/zones/ on GLOBAL zone.
“No such zone configured, use create to create zone”
zonecfg:appserv3> create
zonecfg:appserv3> set zonepath=/zone2/appserver2
zonecfg:appserv3> add net
zonecfg:appserv3:net> set physical=el1000g0 -Use ifconfig to choose from list of NICs.
zonecfg:appserv3:net> set address=192.168.1.101
zonecfg:appserv3:net> end
zonecfg:appserv3> info -Lists all input settings, including names of settings not specified.
zonecfg:appserv3> verify -Verify settings are viable
zonecfg:appserv3> commit -Save changes to /etc/zones/<zone-name>.xml
zonecfg:appserv3> exit -Exit zonecfg
INSTALL NEW ZONE
zoneadm -z <zone name> install -Install new zone. Takes a while.
DISPLAY INFO ABOUT ZONES
zoneadm list -cvi -List info about zones installed on system.
FIRST BOOT
zoneadm -z <zone-name> boot -Boot new zone
FIRST LOGIN
login -z login -C -e [ <zone-name> -Login to zone, Provide system info (C)onsole. Escap(e) character [
zlogin -C -e [ <zone-name> -Alternative login command.
“Console is already in use by PID ####” -kill -9 ####
KILL STUCK/TRAPPED TERMINAL SESSION
It’s possible to get trapped in the zone if you select the wrong terminal type.
To overcome this, start another session to the GLOBAL zone, attempt to log back into the NON-GLOBAL zone
and it’ll tell you the PID of the session. Kill that session. kill -9 <PID>
UNINSTALLING A NON-GLOBAL ZONE
zoneadm list -vci -List all non-global zones
zoneadm -z <zone-name> halt -Shut down the non-global zone
zoneadm -z <zone-name> uninstall -Uninstall the non-global zone
zonecfg -z <zone-name> delete -Delete the non-global zone