Solaris 10 一個創建ZONE的例子

一個創建ZONE的例子。

列出系統所有的ZONE
bash-3.00# zoneadm list -cv
ID NAME             STATUS     PATH     BRAND    IP  
 0 global           running    /        native   shared

確認網卡的介面,下列查詢出來是e1000g0
-bash-3.00# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.10.1.100 netmask ffffff00 broadcast 10.10.1.255
        ether 8:0:27:4:b7:5b

建立ZONE要使用的目錄並將權限改為700
bash-3.00# cd /export/home
bash-3.00# mkdir zone
bash-3.00# cd zone
bash-3.00# mkdir zone01
bash-3.00# chmod 700 zone01

新建一個ZONE的設定檔,名稱為zone01
bash-3.00# zonecfg -z zone01
zone01: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone01> create
設定zone01安裝的目錄
zonecfg:zone01> set zonepath=/export/home/zone/zone01
增加網卡及設定
zonecfg:zone01> add net
zonecfg:zone01:net> set address=10.10.1.101
zonecfg:zone01:net> set physical=e1000g0
zonecfg:zone01:net> end
檢查設定及儲存
zonecfg:zone01> verify
zonecfg:zone01> commit
zonecfg:zone01> exit

安裝zone01
bash-3.00# zoneadm -z zone01 install
Preparing to install zone <zone01>.
Creating list of files to copy from the global zone.
Copying <7489> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1090> packages on the zone.
Initialized <1090> packages on zone.                                
Zone <zone01> is initialized.
The file </export/home/zone/zone01/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

重新查詢,已安裝成功
bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP  
   0 global           running    /                              native   shared
   - zone01           installed  /export/home/zone/zone01       native   shared
 
啟動zone01
bash-3.00# zoneadm -z zone01 boot
bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP  
   0 global           running    /                              native   shared
   1 zone01           running    /export/home/zone/zone01       native   shared
 
登入之後再依畫面設定就可以了
bash-3.00# zlogin -C zone01
[Connected to zone 'zone01' console]    143/143
Reading ZFS config: done.
   What type of terminal are you using?
 1) ANSI Standard CRT
 2) DEC VT52
 3) DEC VT100
 4) Heathkit 19
 5) Lear Siegler ADM31
 6) PC Console
 7) Sun Command Tool
 8) Sun Workstation
 9) Televideo 910
 10) Televideo 925
 11) Wyse Model 50
 12) X Terminal Emulator (xterms)
 13) CDE Terminal Emulator (dtterm)
 14) Other

Oracle DB的listener.log清理