最近刚刚发布的 Solaris 10 操作系统,号称Sun公司的真正意义上的里程碑式操作系统,带 来了诸多突破性技术,如 Solaris Containers、动态跟踪 (DTrace)、预测性自我修复和ZFS动态 文件系统等。 比较感兴趣的是Solaris Container,也就是N1 Grid Container--网格?!现在好像比较 流行这个,Oracle 10g 也是Grid的意思。。。。 这个Solaris Container号称可以让每个 Solaris 10 创建多达 8192 个的安全、无故障软件 分区,相对于SunFire 3800/4800/6800/4900/6900/12K/15K/25K的硬件分区好像更夸张一点,感觉 有点像PC上的VMware。IBM最近的P5系列也是,好像现在各大厂商都热衷于这个,叫什么server virtualization
开始上手:
root@b1000:/# uname -a SunOS b1000 5.10 s10_63 sun4u sparc SUNW,Sun-Blade-1000
刚装完的系统,只有一个global zone root@b1000:/# zoneadm list -vc ID NAME STATUS ATH 0 global running /
首先创建一个目录,用来存放新的soft zone的文件。 root@b1000:/# mkdir -p /zone/zone1 root@b1000:/# ls -ld /zone/zone1 drwxr-xr-x 2 root other 512 Dec 4 14:42 /zone/zone1
创建一个zone1的软分区: root@b1000:/# zonecfg -z zone1 zone1: No such zone configured Use 'create' to begin configuring a new zone. zonecfg:zone1> create zonecfg:zone1> set zonepath=/zone/zone1 zonecfg:zone1> set autoboot=true zonecfg:zone1> add net zonecfg:zone1:net> set address=192.168.0.101 zonecfg:zone1:net> set physical=eri0 zonecfg:zone1:net> end zonecfg:zone1> info zonepath: /zone/zone1 autoboot: true pool: inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr net: address: 192.168.0.101 physical: eri0 zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> ^D root@b1000:/#
创建完成,查看zone1的信息: root@b1000:/# zonecfg -z zone1 info zonepath: /zone/zone1 autoboot: true pool: inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr net: address: 192.168.0.101 physical: eri0 root@b1000:/# zoneadm list -vc ID NAME STATUS ATH 0 global running / - zone1 configured /zone/zone1
安装操作系统文件刚刚配置完成的zone1: root@b1000:/# zoneadm -z zone1 install /zone/zone1 must not be group readable. /zone/zone1 must not be group executable. /zone/zone1 must not be world readable. /zone/zone1 must not be world executable. could not verify zonepath /zone/zone1 because of the above errors. zoneadm: zone zone1 failed to verify root@b1000:/# ls -ld /zone/zone1 drwxr-xr-x 2 root other 512 Dec 4 14:42 /zone/zone1 root@b1000:/# chmod 0700 /zone/zone1 root@b1000:/# ls -ld /zone/zone1 drwx------ 2 root other 512 Dec 4 14:42 /zone/zone1 root@b1000:/# zoneadm -z zone1 install Preparing to install zone . Copying <2365> files to the zone. Initializing zone product registry. Determining zone package initialization order. Preparing to initialize <994> packages on the zone. Initializing package <57> of <994>: percent complete: 5% ...... ..... ... 这里大约需要二十分钟左右 Initialized <994> packages on zone. Zone is initialized. Installation of these packages generated errors: Installation of these packages generated warnings: SUNWmga SUNWdclnt SUNWlvma SUNWlvmg SUNWrmui SUNWpmgr> The file contains a log of the zone installation. root@b1000:/# zoneadm list -vc ID NAME STATUS ATH 0 global running / - zone1 installed /zone/zone1
启动这个zone: root@b1000:/# zoneadm -z zone1 boot
进入zone1的Console: root@b1000:/# zlogin -C zone1 [Connected to zone 'zone1' console] [NOTICE: Zone booting up]
SunOS Release 5.10 Version s10_63 64-bit Copyright 1983-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Hostname: zone1 The system is coming up. Please wait.
Select a Language
0. English 1. Simplified Chinese 2. Traditional Chinese
Please make a choice (0 - 2), or press h or ? for help:
接下来的和平时安装系统一样,设置主机名,时区,域名解析方式等等,
System identification is completed.
rebooting system due to change(s) in /etc/default/init
[NOTICE: Zone rebooting]
SunOS Release 5.10 Version s10_63 64-bit Copyright 1983-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Hostname: MyWeb The system is coming up. Please wait. starting rpc services: rpcbind done. syslog service starting. Dec 4 15:18:42 MyWeb sendmail[8940]: My unqualified host name (MyWeb) unknown; sleeping for retry Dec 4 15:19:42 MyWeb sendmail[8940]: unable to qualify my own domain name (MyWeb) -- using short name WARNING: local host name (MyWeb) is not qualified; see cf/README: WHO AM I? /etc/mail/aliases: 12 aliases, longest 10 bytes, 138 bytes total Dec 4 15:19:42 MyWeb sendmail[8941]: My unqualified host name (MyWeb) unknown; sleeping for retry Dec 4 15:19:42 MyWeb sendmail[8942]: My unqualified host name (MyWeb) unknown; sleeping for retry
STSF Font Server Daemon.
Standard Type Services Framework 0.11.1 Copyright (c) 2001-2004 Sun Microsystems, Inc. All Rights Reserved. STSF is Open Source Software.
Creating new rsa public/private host key pair Creating new dsa public/private host key pair The system is ready.
prtconf有信息出来: # prtconf System Configuration: Sun Microsystems sun4u Memory size: 1024 Megabytes System Peripherals (Software Nodes):
prtconf: devinfo facility not available
# exit
按 ~ 然后按 . 退出zone1的Console,回到global zone,也就是真正的B1000 MyWeb console login: ~. [Connection to zone 'zone1' console closed] root@b1000:/# root@b1000:/# root@b1000:/# zoneadm list -vc ID NAME STATUS PATH 0 global running / 1 zone1 running /zone/zone1
root@b1000:/# telnet 192.168.0.101 Trying 192.168.0.101... Connected to 192.168.0.101. Escape character is '^]'. login: root Password: Not on system console Connection to 192.168.0.101 closed by foreign host. 忘改/etc/default/login了。。。。。。。。。。。