|Home | Gallery | Stats | Downloads | Links | Scripts | Fuel Stats | Wiki | RSS|
I would rather you fall off the ladder then break a sprinkler head.-- Matthew Hill Add quote.
Virtualization is a big trend in computing right now and Solaris offers some very nice options of its own. One of these features is zones and branded zones which allow non-native operating systems to be installed into a container, this is similar to other technologies like OpenVZ and linux-vserver but zones add the power of ZFS as well.
I started reading the excellent article on Blastwave about setting up zones in Solaris 10 and within an hour I had everything finished with a Linux branded zone running CentOS 3.9. Here's a quick run down on how to accomplish this.
First create a file system to contain your zones:
zfs create -o mountpoint=/zone rpool/zone
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 [Connected to zone 'lx-zone' console] CentOS release 3.9 (Final) Kernel 2.4.21 on an i686 lx-zone login: -bash-2.05b# uname -a Linux lx-zone 2.4.21 BrandZ fake linux i686 i686 i386 GNU/Linux
As you can see zones are very powerful and allow a system to be divided up as you see fit. Each zone is completely isolated from the others and has its own cpu limits, process lists, network stack, etc. Even if a zone is completely wiped out it will not affect your global zone.