Solaris Zone

6
Updated 22 March 2010 Crea te Whole Roo t Solaris Z Description: This pr ocedure describes how to set up a full root Zone in S olaris 10 wh Prerequisites: Super user access Access to the global zone server Loopback fil es system not disabled (e .g. /etc/system ). Notes: Loopback files system must be enabled. Some Solaris10 installation ma 'exclude: lofs'). Make sure that this comment does not exist. There are three commands that are used to create and enable a zone. T zonecfg - set up zone configuration. zoneadm - administer zones (install zone) zlogin - set up zone host parameters (using -C option) Creation of a Solaris Zone fall into two classes: inherited package zone self containted zone A self-contain zone makes copies of the from the global zone of the /us A self contain zone will requir e individual patch for OS updates a nd is i There must be sufficient mounted disk space available pf approximatel References: Create Basic Solaris Zone Solaris Contai ners- Resour ce Manag ement and S olar is Zones ( ) Step Action D 1 User  zonecfg to configure a Inherited Pacakage Zone 1a # zonecfg -z selfzone Start the zonec fg command with a -z option foll owed by na me of t Zone names are case sensitive. Zone na mes mus t begin with underscore (_) and the hyphen (-). The name global and all Create Full Root Solaris Zone http://www.logiqwest.com/dataCenter/ Demos/RunBooks/Zones/createSe... 1 of 6 9/13/2011 3:13 PM

Transcript of Solaris Zone

8/4/2019 Solaris Zone

http://slidepdf.com/reader/full/solaris-zone 1/6

Updated 22 March 2010

Create Whole Root Solaris Z

Description: This procedure describes how to setup a full root Zone in Solaris 10 wh

Prerequisites: Super user access

Access to the global zone server 

Loopback files system not disabled (e.g. /etc/system).

Notes: Loopback files system must be enabled. Some Solaris10 installation ma

'exclude: lofs'). Make sure that this comment does not exist.

There are three commands that are used to create and enable a zone. T

zonecfg - set up zone configuration.

zoneadm - administer zones (install zone)zlogin - set up zone host parameters (using -C option)

Creation of a Solaris Zone fall into two classes:

inherited package zone

self containted zone

A self-contain zone makes copies of the from the global zone of the /us

A self contain zone will require individual patch for OS updates and is

There must be sufficient mounted disk space available pf approximatel

References: Create Basic Solaris ZoneSolaris Containers-Resource Management and Solaris Zones ( )

Step Action D

1 User  zonecfg to configure a Inherited Pacakage Zone

1a # zonecfg -z selfzone Start the zonecfg command with a -z option followed by name of t

Zone names are case sensitive. Zone names must begin with

underscore (_) and the hyphen (-). The name global and all

e Full Root Solaris Zone http://www.logiqwest.com/dataCenter/Demos/RunBooks/Zones/c

6 9/13/2011

8/4/2019 Solaris Zone

http://slidepdf.com/reader/full/solaris-zone 2/6

The prompt will change to zonecfg: selfzone> and issue a response

global# zonecfg -z selfzoneselfzone: No such zone configuredUse 'create' to begin configuring a new zone.zonecfg:selfzone>

1b zonecfg:selfzone> create -bUse create parameter with the "b" option to begin the configurati

global#zonecfg -z selfzone

 selfzone: No such zone configuredUse 'create' to begin configuring a new zone.zonecfg:selfzone> create -b

zonecfg:selfzone>

Use of the "b" option creates a blank zone as compared to a sparse

it is indeed blank by peforming the info command

zonecfg:selfzone> info

zonename: selfzonezonepath:brand: nativeautoboot: falsebootargs:pool:limitpriv:scheduling-class:ip-type: sharedzonecfg:selfzone>

1c zonecfg:selfzone> set zonepath=/zones/selfzone

 

Use set zonepath command to set up the loopback filesystem fozonecfg:selfzone> set zonepath=/zones/home/selfzonezonecfg:selfzone>

1d zonecfg:selfzone> set autoboot=true

 

Use set autoboot= to set autoboot of the zone to either true or f zonecfg:selfzone> set autoboot=truezonecfg:selfzone>

You can also set other parameters in this section such as limitpr

Parameters. If not they will be set to the default.

1e zonecfg:selfzone> add net

 

Setup the primary network by using the add net option. Set the int

xxx.xxx.xxx.xxx is a valid ip address and yyy is the associated n

using the set physical= and giving the name of a physical interface

the assignment of this interface. Additional interface can be also d

network interfaces will increment in order with a multiple plumb szonecfg:selfzone> add net

zonecfg:selfzone:net> set address=192.168.3.41/24zonecfg:selfzone:net> set physical=rtls0zonecfg:selfzone:net> set defrouter=192.168.3.1zonecfg:selfzone:net> end 

zonecfg:selfzone>

1f  zonecfg:selfzone> commit Display the configuration with the "info" option. Use "verify" to v

zonepath is specified. Use "commit" to move configuration from

save it and exit the zonecfg command.

e Full Root Solaris Zone http://www.logiqwest.com/dataCenter/Demos/RunBooks/Zones/c

6 9/13/2011

8/4/2019 Solaris Zone

http://slidepdf.com/reader/full/solaris-zone 3/6

zonecfg:selfzone> info

zonepath: /export/home/selfzoneautoboot: truepool:limitpriv:scheduling-class:ip-type: sharednet:

address: 192.168.3.41physical: rtls0

defrouter: 192.168.3.1zonecfg:selfzone> verifyzonecfg:selfzone> commit

zonecfg:selfzone> exit

global#

Note: "commit" also performs the verify function.

This configuration is saved in the /etc/zones directory as an xml fi

global# cat /etc/zones/selfzone.xml<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE zone PUBLIC "-//Sun Microsystems Inc//DTD Z"file:///usr/share/lib/xm

<!--DO NOT EDIT THIS FILE. Use zonecfg(1M) instead.

--><zone name="selfzone" zonepath="/export/selfzone" aut

<network address="192.168.3.41" physical="rtls0"/></zone>global# /usr/sbin/zoneadm list -vc

ID NAME STATUS PATH0 global running /1 utility running /zones/utility2 rlogic running /zones/rlogic3 myzone running /zones/myzone

- selfzone configured /export/selfzoneglobal#

The index file in this directory also contains the entry:

global# cat /etc/zones/index# ident "@(#)zones-index 1.3 05/06/08 SMI"# Copyright 2005 Sun Microsystems, Inc. All rights r# Use is subject to license terms.## CDDL HEADER START#

# The contents of this file are subject to the terms# Common Development and Distribution License, Versio# (the "License"). You may not use this file except# with the License.## You can obtain a copy of the license at usr/src/OPE# or http://www.opensolaris.org/os/licensing.# See the License for the specific language governing# and limitations under the License.## When distributing Covered Code, include this CDDL H# file and include the License file at usr/src/OPENSO# If applicable, add the following below this CDDL HE

e Full Root Solaris Zone http://www.logiqwest.com/dataCenter/Demos/RunBooks/Zones/c

6 9/13/2011

8/4/2019 Solaris Zone

http://slidepdf.com/reader/full/solaris-zone 4/6

# fields enclosed by brackets "[]" replaced with your# information: Portions Copyright [yyyy] [name of cop## CDDL HEADER END### DO NOT EDIT: this file is automatically generated b# and zonecfg(1M). Any manual changes will be lost.#global:installed:/

rlogic:installed:/zones/rlogicutility:installed:/zones/utilitymyzone:installed:/zones/myzoneselfzone:configured:/export/home/selfzoneglobal#

2 Use zoneadm to verify and install the new zone# zoneadm -z selfzone install

Use zoneadm with the -z the zone name and the install option.

created and written.global# zoneadm -z selfzone verifyWARNING: /export/home/selfzone does not exist, so itWhen 'zoneadm install' is run, 'install' will try to

/export/home/selfzone, and 'verify' will be tried agabut the 'verify' may fail if:the parent directory of /export/home/selfzone is grouor/export/home/selfzone overlaps with any other installglobal# zoneadm -z selfzone installPreparing to install zone <selfzone>.Creating list of files to copy from the global zone.Copying <138878> files to the zone.Initializing zone product registry.Determining zone package initialization order.Preparing to initialize <1099> packages on the zone.Initialized <1099> packages on zone.Zone <selfzone> is initialized.

The file </export/home/selfzone/root/var/sadm/system/contains a log of th

global#

Notes: Running the "zoneadm -z <zonename> verify" when

which is harmless in this case. You may avoid the err

of 700.

Creation of a self contain zone to the zone directory t

zone. This typically is about 3gb of data.

If the <zonename> directory directory does not exist

After a zone is installed the index file in the /etc/zones will be u

global# pwd /etc/zonesglobal# cat index

nd zonecfg(1M). Any manual changes will be lost........ ....... ........... .......... ................ ....... ........... .......... .........global:installed:/rlogic:installed:/zones/rlogicutility:installed:/zones/utilitymyzone:installed:/zones/myzoneselfzone:installed:/export/home/selfzone

e Full Root Solaris Zone http://www.logiqwest.com/dataCenter/Demos/RunBooks/Zones/c

6 9/13/2011

8/4/2019 Solaris Zone

http://slidepdf.com/reader/full/solaris-zone 5/6

global# /usr/sbin/zoneadm list -vi

ID NAME STATUS PATH0 global running /1 utility running /zones/utility2 rlogic running /zones/rlogic3 myzone running /zones/myzone- selfzone installed /export/home/sel

global#

3 Use zoneadm -z <zonename> boot to boot the zone.

# zoneadm -z selfzone boot

Boot the new zone by issuing zoneadm -z <zonename> boot.

global# zoneadm -z selfzone  bootglobal# /usr/sbin/zoneadm list -vi

ID NAME STATUS PATH0 global running /1 utility running /zones/utility2 rlogic running /zones/rlogic3 myzone running /zones/myzone4 selfzone running /export/home/sel

global#

Notes: If for some reason the zone initiation fails or cannot

Use zoneadm -z <zonename> uninstall

4 Use zlogin to perform initial setup up of new zone# zlogin -C selfzone Use zlogin <zonename> -C to login to the new zone at its console

had boot a new installation for the first time. You will be asked to

global# zlogin -C selfzone

[Connected to zone 'selfzone' console]

[NOTICE: Zone booting up]

SunOS Release 5.11 Version snv_23 64-bitCopyright 1983-2005 Sun Microsystems, Inc. All rightUse is subject to license terms.Hostname: selfzoneLoading smf(5) service descriptions: 107/107

Select a Language0. English1. Czech Republic (ISO8859-2)2. Czech Republic (UTF-8 + euro)3. German4. es5. fr6. Hungary (ISO8859-2)7. Slovakia (ISO8859-2)Please make a choice (0 - 7), or press h or ? for hel..... ......... ........... ......... ........ ........... ......... ........... ......... ........ ........... ......... ........... ......... ........ ......

Using zlogin from the global zone is as if you had login from the c

enter a tilda dot:

e Full Root Solaris Zone http://www.logiqwest.com/dataCenter/Demos/RunBooks/Zones/c

6 9/13/2011

8/4/2019 Solaris Zone

http://slidepdf.com/reader/full/solaris-zone 6/6

~.

This will return back to global zone.

selfzone console login: ~.

[Connection to zone 'selfzone' console closed]gloabl#

5 Use zoneadm list to show status of current zone# /usr/sbin/zoneadm list -vi

On the global zone, use the zoneadm list -vi to show current st# /usr/sbin/zoneadm list -vi

ID NAME STATUS PATH0 global running /1 rlogic running /zones/rlogic2 utility running /zones/utility3 myzone running /zones/myzone4 selfzone running /export/home/sel

#

Click for more info

e Full Root Solaris Zone http://www.logiqwest.com/dataCenter/Demos/RunBooks/Zones/c