How to setup IPKG zone with OpenIndiana

Install package and create pkg image:
# install packages for ipkg zones setup
apt-get install zones-ipkg pkg5

# run command for local pkg repo - it needs for zone process bootstrap
pkg image-create -f -F -p openindiana.org=http://pkg.openindiana.org/hipster/ /
# on SPARC
# pkg image-create -f -F -p opensolaris.org=http://pkg.openindiana.org/legacy/ /
Create dataset (need run at ones)
zfs create -o mountpoint=/zones rpool/zones


Example IPKG zone
zonecfg -z oi4

zonecfg:oi4> create -t SUNWipkg
zonecfg:oi4> set zonepath=/zones/oi4

zonecfg:oi4> set brand=ipkg
 
zonecfg:oi4> add net
zonecfg:oi4:net> set address=172.16.92.4/16
zonecfg:oi4:net> set defrouter=172.16.90.1
zonecfg:oi4:net> set physical=e1000g0
zonecfg:oi4:net> end

zonecfg:oi4> add fs
zonecfg:oi4:fs> set dir=/export/home/admin
zonecfg:oi4:fs> set special=/export/home/admin
zonecfg:oi4:fs> set type=lofs
zonecfg:oi4:fs> end

zonecfg:oi4> add fs
zonecfg:oi4:fs> set dir=/export/builds
zonecfg:oi4:fs> set special=/export/builds
zonecfg:oi4:fs> set type=lofs
zonecfg:oi4:fs> end

zonecfg:oi4> commit
zonecfg:oi4> verify
zonecfg:oi4> exit
Install IPKG zone with OI/hipster:
zoneadm -z oi4 install -P openindiana.org=http://pkg.openindiana.org/hipster
# on SPARC we can use another repo:
# zoneadm -z oi4 install -P openindiana.org=http://neutron-star.mit.edu:10151/
Boot zone:
zoneadm -z oi4 boot
Login to zone for configuration:
zlogin -e\# -C oi4

Hint:

type '#.' for exit from 'zlogin'

Example of screens based on my local system you can find here: [screens of zone configuration]

Login by 'root' for next modifications:
oi4 console login:root
Password: <your own>

You can add local 'admin' user with the same UID/GID from global zone.

INFO:

Before steps below you have to identify UID and GID of user 'admin' on global zone by command:

# id admin

uid=1000(admin) gid=10(staff) groups=10(staff)

# useradd -u 1000 -g staff -d /export/home/admin -s /bin/bash admin
# passwd admin
You be able to login to your new zone by SSH from global zone or another comp by command:
$ ssh admin@<your ip>