Solaris Zones

From Wiki
Jump to: navigation, search
First create a pool to contain your zones:

zpool create zones <disk>

After this is done you need to create the zone and install it, these are two separate processes.

zonecfg -z lx-zone

lx-zone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1> create
zonecfg:zone1> set zonepath=/zone/1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> set brand=lx
zonecfg:zone1> add net
zonecfg:zone1:net> set address=192.168.35.210/24
zonecfg:zone1:net> set physical=hme1
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> ^D

For the install you will need the iso images or a tar ball of a file system, you also need to create a new distro file as Solaris only goes up to CentOS 3.8 right now.

wget http://mirrors.example.com/CentOS/3.9/isos/i386/CentOS-3.9-i386-bin1of3.iso
wget http://mirrors.example.com/CentOS/3.9/isos/i386/CentOS-3.9-i386-bin2of3.iso
wget http://mirrors.example.com/CentOS/3.9/isos/i386/CentOS-3.9-i386-bin3of3.iso

cd /usr/lib/brand/lx/distros/
cp centos38.distro centos39.distro

Edit this file and change the serial to "1183469235.99" and the version to "3.9"

Now install the OS

zoneadm -z lx-zone install -d /export/centos_3.9/ core

Check the results:

bash-2.05b# zoneadm list -vc
  ID NAME             STATUS         PATH
   0 global           running        /
   - lx-zone          installed      /zone/1

The STATUS is now "installed".

Boot the environment:

bash-2.05b# zoneadm -z lx-zone boot
bash-2.05b# zoneadm list -vc
  ID NAME             STATUS         PATH
   0 global           running        /
   2 lx-zone          running        /zone/1


bash-2.05b# ping 192.168.35.210
192.168.35.210 is alive

Now you can access the zone using zlogin:

# zlogin -C -e\@ lx-zone