Creating a Zone in Solaris 11

download Creating a Zone in Solaris 11

of 12

Transcript of Creating a Zone in Solaris 11

  • 7/23/2019 Creating a Zone in Solaris 11

    1/12

    How To Creating Zone in

    Solaris 11Prepared By

    F. Mohaideen Abdul Kader

    Document Type: How ToWIPRO LIMITED

  • 7/23/2019 Creating a Zone in Solaris 11

    2/12

    Creating a Zone in Solaris 11

    In oracle solaris 10, zones was introduced which gave us an ability to create isolated environments for

    applications that can run on a single machine. Solaris 11 has added a lot of new features to the zones

    technology. Let us get started and see how we can create a zone in solaris 11.

    Pre-requisites:

    1.

    A server with Solaris 11 installed

    2.

    IPS repository

    3. ZFS file system to install zone (This is mandatory is Solaris 11)

    Configuring the zone

    First thing we need is a installation path for the new zone to be created. I am going to create a

    filesystem under rpool of global zone.

    root@testlab:~# zfs create rpool/zone01

    Using zonecfg we will create the new zone, zone01 and assign the necessary resources through the

    interactive configuration flow of zonecfg command.

    root@testlab:~# zonecfg -z zone01

    Use 'create' to begin configuring a new zone.

    zonecfg:zone01> create

    create: Using system default template 'SYSdefault'zonecfg:zone01> set zonepath=/rpool/zone01

    zonecfg:zone01> set autoboot=true

    zonecfg:zone01> set bootargs="-m verbose"

    zonecfg:zone01> verify

    zonecfg:zone01> commit

    zonecfg:zone01> exit

    Verify the zone we have created

    root@testlab:~# zoneadm list -icvID NAME STATUS PATH BRAND IP

    0 global running / solaris shared

    - zone01 configured /rpool/zone01 solaris excl

    Installing the zone

    Before installing the zone make sure you have a IPS repository available to use as Solaris 11 uses IPS

    to install the new zone by downloading the installation image from IPS repository. I have a local

    repository set in my global zone.

  • 7/23/2019 Creating a Zone in Solaris 11

    3/12

    root@testlab:~# pkg publisher

    PUBLISHER TYPE STATUS P LOCATION

    solaris origin online F file:///sol_11_repo/repo/

    Now install the zone using below command:

    root@testlab:~# zoneadm -z zone01 install

    /rpool/zone01 must not be group readable.

    /rpool/zone01 must not be group executable.

    /rpool/zone01 must not be world readable.

    /rpool/zone01 must not be world executable.

    changing zonepath permissions to 0700.

    Progress being logged to /var/log/zones/zoneadm.20131122T084145Z.zone01.install

    Image: Preparing at /rpool/zone01/root.

    AI Manifest: /tmp/manifest.xml.C8aOIiSC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml

    Zonename: zone01

    Installation: Starting ...

    Creating IPS image

    Startup linked: 1/1 done

    Installing packages from:

    solaris

    origin: http://localhost:1008/solaris/ffbe7adc15370eee5e159f41613703a3f440bf35/

    DOWNLOAD PKGS FILES XFER (MB) SPEEDCompleted 183/183 33556/33556 222.2/222.2 560k/s

    PHASE ITEMS

    Installing new actions 46825/46825

    Updating package state database Done

    Updating image state Done

    Creating fast lookup database Done

    Installation: Succeeded

    Note: Man pages can be obtained by installing pkg:/system/manual

    done.

    Done: Installation completed in 510.747 seconds.

    Next Steps: Boot the zone, then log into the zone console (zlogin -C)

    to complete the configuration process.

    Log saved in non-global zone as

    /rpool/zone01/root/var/log/zones/zoneadm.20131122T084145Z.zone01.install

  • 7/23/2019 Creating a Zone in Solaris 11

    4/12

    The zone is installed now. Check the status of the installed zone:

    root@testlab:~# zoneadm list -icv

    ID NAME STATUS PATH BRAND IP

    0 global running / solaris shared

    - zone01 installed /rpool/zone01 solaris excl

    You can also check the file systems that are created under /rpool/zone01 for the zone01.

    root@testlab:~# zfs list |grep zone

    rpool/zone01 414M 4.50G 32K /rpool/zone01

    rpool/zone01/rpool 414M 4.50G 31K /rpool

    rpool/zone01/rpool/ROOT 414M 4.50G 31K legacy

    rpool/zone01/rpool/ROOT/solaris 414M 4.50G 390M /rpool/zone01/root

    rpool/zone01/rpool/ROOT/solaris/var 24.3M 4.50G 23.7M /rpool/zone01/root/var

    rpool/zone01/rpool/VARSHARE 31K 4.50G 31K /var/sharerpool/zone01/rpool/export 62K 4.50G 31K /export

    rpool/zone01/rpool/export/home 31K 4.50G 31K /export/home

    The ZFS dataset used to create the zones gives us the ability to clone the zones.

    Booting the zone

    Now the final step is to boot the configured, installed zone and configure the zone using the System

    Configuration Tool (SCI).

    root@testlab:~# zoneadm -z zone01 boot

    root@testlab:~# zlogin -C zone01

    [Connected to zone 'zone01' console]

  • 7/23/2019 Creating a Zone in Solaris 11

    5/12

    The system configuration tool starts after you press enter. Use ESC + 2 to navigate through the next

    screens.

    Set the hostname for the zone as zone01 and mode of network configuration as manual.

  • 7/23/2019 Creating a Zone in Solaris 11

    6/12

    On the next screen give the IP address to the NIC card net0 and a netmask.

    We will not configure any DNS service so select Do not configure DNS.

  • 7/23/2019 Creating a Zone in Solaris 11

    7/12

    Select None option for alternate name service.

    On the next screens set the time zone according to your location.

  • 7/23/2019 Creating a Zone in Solaris 11

    8/12

  • 7/23/2019 Creating a Zone in Solaris 11

    9/12

    Now set the root password. Also if you want any user to be created, you can do it on this screen.

    Double check the system configuration summary before going forward.

  • 7/23/2019 Creating a Zone in Solaris 11

    10/12

    After this the system will get configured. No need to login as its the console login of the zone. Use ~.

    to come out of the console.

    Check the status of the zone01 from the global zone. It should be running now.

    root@testlab:~# zoneadm list -icv

    ID NAME STATUS PATH BRAND IP

    0 global running / solaris shared

    1 zone01 running /rpool/zone01 solaris excl

    If you check dladm, you would see a virtual NIC created:

    root@testlab:~# dladm show-link

    LINK CLASS MTU STATE OVER

    net0 phys 1500 up --

    zone01/net0 vnic 1500 up net0

    Now login to the zone

    root@testlab:~# zlogin zone01

    [Connected to zone 'zone01' pts/3]

    Oracle Corporation SunOS 5.11 11.1 September 2012

    root@zone01:~# uname -a

    SunOS zone01 5.11 11.1 i86pc i386 i86pc

    Check the network settings:

    root@zone01:~# dladm show-link

    LINK CLASS MTU STATE OVER

    net0 vnic 1500 up ?

    root@zone01:~# ipadm show-addr

    ADDROBJ TYPE STATE ADDR

    lo0/v4 static ok 127.0.0.1/8

    net0/v4 static ok 192.168.1.25/24

    lo0/v6 static ok ::1/128

    net0/v6 addrconf ok fe80::8:20ff:fe89:4b7c/10

    root@zone01:~# ifconfig -a

    lo0: flags=2001000849 mtu 8232 index 1

    inet 127.0.0.1 netmask ff000000

    net0: flags=1000843 mtu 1500 index 2

    inet 192.168.1.25 netmask ffffff00 broadcast 192.168.1.255

    ether 2:8:20:89:4b:7c

    lo0: flags=2002000849 mtu 8252 index 1

    inet6 ::1/128

    net0: flags=20002004841 mtu 1500 index 2

    inet6 fe80::8:20ff:fe89:4b7c/10ether 2:8:20:89:4b:7c

  • 7/23/2019 Creating a Zone in Solaris 11

    11/12

    If you check zfs list, you would only see zfs dataset assigned to zone and not the global file system.

    root@zone01:~# zfs list

    NAME USED AVAIL REFER MOUNTPOINT

    rpool 441M 4.48G 31K /rpool

    rpool/ROOT 441M 4.48G 31K legacy

    rpool/ROOT/solaris 441M 4.48G 416M /

    rpool/ROOT/solaris/var 24.4M 4.48G 23.8M /var

    rpool/VARSHARE 39K 4.48G 39K /var/share

    rpool/export 63K 4.48G 32K /export

    rpool/export/home 31K 4.48G 31K /export/home

    To check the complete configuration details of the zone from non-global zone:

    root@testlab:~# zonecfg -z zone01 info

    zonename: zone01zonepath: /rpool/zone01

    brand: solaris

    autoboot: true

    bootargs: -m verbose

    file-mac-profile:

    pool:

    limitpriv:

    scheduling-class:

    ip-type: exclusive

    hostid:fs-allowed:

    anet:

    linkname: net0

    lower-link: auto

    allowed-address not specified

    configure-allowed-address: true

    defrouter not specified

    allowed-dhcp-cids not specified

    link-protection: mac-nospoof

    mac-address: random

    auto-mac-address: 2:8:20:89:4b:7c

    mac-prefix not specified

    mac-slot not specified

    vlan-id not specified

    priority not specified

    rxrings not specified

    txrings not specified

    mtu not specified

    maxbw not specified

    rxfanout not specified

    vsi-typeid not specifiedvsi-vers not specified

  • 7/23/2019 Creating a Zone in Solaris 11

    12/12

    vsi-mgrid not specified

    etsbw-lcl not specified

    cos not specified

    pkey not specified

    linkmode not specified