Tuesday, December 25, 2012

CREATE AND DELETE ZONE ON SOLARIS 10

Below is some step, but you can set less / more setting depend on your requirement.

Checking the interface (if you have multiple interface and want to assign one of them later)
# dladm show-link
e1000g0         type: non-vlan  mtu: 1500       device: e1000g0
or
# dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full

Create Solaris Zone
# zonecfg -z newzone
newzone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:newzone> create
zonecfg:newzone> set zonepath=/zones/newzone
zonecfg:newzone> set autoboot=true
zonecfg:newzone> add fs
zonecfg:newzone:fs> set dir=/opt
zonecfg:newzone:fs> set special=/opt
zonecfg:newzone:fs> set type=lofs
zonecfg:newzone:fs> add options [ro,nodevices]
zonecfg:newzone:fs> end
zonecfg:newzone> verify
zonecfg:newzone> add net
zonecfg:newzone:net> set address=10.10.1.20/24
zonecfg:newzone:net> set physical=e1000g0
zonecfg:newzone:net> end
zonecfg:newzone> verify
zonecfg:newzone> info
zonename: newzone
zonepath: /zones/newzone
brand: native
autoboot: true
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
fs:
        dir: /opt
        special: /opt
        raw not specified
        type: lofs
        options: [ro,nodevices]
net:
        address: 10.10.1.20/24
        physical: e1000g0
        defrouter not specified
zonecfg:newzone> set bootargs="-m verbose"
zonecfg:newzone> verify
zonecfg:newzone> commit
zonecfg:newzone> exit

Install Solaris Zone
# zoneadm -z newzone install
Preparing to install zone <newzone>.
Creating list of files to copy from the global zone.
Copying <7529> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1102> packages on the zone.
Initialized <1102> packages on zone.
Zone <newzone> is initialized.
The file </zones/newzone/root/var/sadm/system/logs/install_log> contains a log of
the zone installation.

Show / List Configured Zone
# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global                running       /                                    native   shared
   - newzone            installed      /zones/newzone            native   shared

Start Solaris Zone and Check the Status 
# zoneadm -z newzone boot
# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global                running       /                                    native   shared
   1 newzone            running       /zones/newzone           native   shared

Log in to Solaris Zone from Global Zone and Exit From Solaris Zone
# zlogin newzone
[Connected to zone 'newzone' pts/4]
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
# hostname
newzone
# exit
[Connection to zone 'newzone' pts/4 closed]

Shutdown Solaris Zone and Check the Status 
# zoneadm -z newzone halt
# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global                running       /                                    native   shared
   - newzone            installed      /zones/newzone            native   shared

Uninstall Solaris Zone and Check the Status
# zoneadm -z newzone uninstall
Are you sure you want to uninstall zone newzone (y/[n])? y
# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global                running       /                                   native   shared
   - newzone            configured   /zones/newzone           native   shared

Delete Solaris Zone and Check the Status
# zonecfg -z newzone delete
Are you sure you want to delete zone newzone (y/[n])? y
# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global                running       /                                    native    shared

No comments:

Post a Comment