=====Create a zone=====
====Zone configuration====
===Simple Zone===
$ mkdir /zones
$ mkdir /zones/zone1
$ chmod 700 /zones/zone1
$ zonecfg -z zone1
zonecfg> create zone1
zonecfg:zone1> set zonepath=/zones/zone1
zonecfg:zone1> add net
zonecfg:zone1:net> set physical=hme0
zonecfg:zone1:net> set address=192.168.99.42
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
===Zone Initialization==
If you want use a sysidcfg file, just copy it in /root/etc/
$ zoneadm -z zone1 install
$ zoneadm -z zone1 boot
$ zlogin -C zone1
====Zones extra resources====
===Using a raw device===
zonecfg:squid> add fs
zonecfg:squid:fs> set dir=/var/spool/squid
zonecfg:squid:fs> set special=/dev/md/dsk/d0
zonecfg:squid:fs> set raw=/dev/md/rdsk/d0
zonecfg:squid:fs> set type=ufs
===lofs===
Loopback fs allow mount global zone's FS from non global zones in read write.
$ zonzonecfg -z zone1
zonecfg:zone1> add fs
# dir is the directory in global zone
zonecfg:zone1:fs> set dir=/usr/pkg
# special is the mountpoint inside the non global zone
zonecfg:zone1:fs> set special=/usr/pkg
zonecfg:zone1:fs> set type=lofs
zonecfg:zone1:fs> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
=====Zones administration=====
====Start and stop====
# zoneadm -z zone1 boot
====Console====
# zlogin zone1
The first time you login into a zone, you'll see an initialization counter.
**zlogin bindkeys**
* ~. : exit. Since this bindkey is ever used by ssh, I recommand to use zlogin -e \`
====Delete a zone====
^ Uninstall | zoneadm -z uninstall |
^ Delete | zonecfg -z delete |
====Configuration changes====
# zonecfg -z zone1
zonecfg:zone1> select net physical=hme0
zonecfg:zone1:net> set address=192.168.99.45
zonecfg:zone1:net> end
zonecfg:zone1:> verify
zonecfg:zone1:> commit
=====Templates=====
====Create a new template====
At this time, the only way i find is to create the xml file by hand (in /etc/zones).
I tried to create a template via zonecfg, but I can't save it because the zonepath is invalid. But
it's possible to set it to a default value, like the zones root (/export/zone for example)
All inherited-pkg-dir directories will be mount as read-only inside non-global zones.
**default.xml**
====Using a template====
zonecfg -z ol
zonecfg:ol> create -t default
zonecfg:ol> set autoboot=true
zonecfg:ol> set zonepath=/zones/ol
zonecfg:ol> add net
zonecfg:ol:net> set physical=hme0
zonecfg:ol:net> set address=192.168.99.45
zonecfg:ol:net> end
zonecfg:ol> verify
zonecfg:ol> commit
=====See Also=====
* [[docs::solaris::smf]]
* [[http://users.tpg.com.au/adsln4yb/zones.html|A good paper about zone, and especially resource managements]]
* [[http://www.sun.com/bigadmin/content/zones/|Bigadmin Zones discussions]]