1、创建zone系统文件所在的目录
root@HDT4-2:/ZONES# mkdir MYTEST
root@HDT4-2:/ZONES# zfs create -o mountpoint=legacy rpool/ZONES/MYTEST
root@HDT4-2:/ZONES# zfs set mountpoint=/ZONES/MYTEST rpool/ZONES/MYTEST
2、创建虚拟网卡
root@HDT4-2:/ZONES# dladm create-vnic -l net1 MYTEST_vnic1 --net1是物理网卡
root@HDT4-2:/ZONES# dladm
LINK CLASS MTU STATE OVER
net1 phys 1500 up --
net0 phys 1500 up --
net2 phys 1500 up --
MYTEST_vnic1 vnic 1500 up net1
3、开始创建zone
root@HDT4-2:/ZONES# zonecfg -z MYTEST
Use 'create' to begin configuring a new zone.
zonecfg:MYTEST> create
create: Using system default template 'SYSdefault'
zonecfg:MYTEST> set zonepath=/ZONES/MYTEST --设置zone所在的目录
zonecfg:MYTEST> set autoboot=true --设置自动启动
zonecfg:MYTEST> add dedicated-cpu --配置cpu
zonecfg:MYTEST:dedicated-cpu> set ncpus=16 --配置16个进程
zonecfg:MYTEST:dedicated-cpu> end
zonecfg:MYTEST> add capped-memory --配置内存
zonecfg:MYTEST:capped-memory> set physical=32g --设置32g的内存
zonecfg:MYTEST:capped-memory> set swap=32g --设置交换分区
zonecfg:MYTEST:capped-memory> set locked=8g --初始锁定内存
zonecfg:MYTEST:capped-memory> end
zonecfg:MYTEST> set ip-type=exclusive --设置网卡是独占
zonecfg:MYTEST> add net --添加网卡
zonecfg:MYTEST:net> set physical=MYTEST_vnic1 --把刚才建的虚拟网卡加进去
zonecfg:MYTEST:net> end
zonecfg:MYTEST> add anet
zonecfg:MYTEST:anet> set lower-link=net1 --设置所依赖的物理网卡
zonecfg:MYTEST:anet> end
zonecfg:MYTEST> verify
zonecfg:MYTEST> commit
zonecfg:MYTEST> exit
4、开始安装zone操作系统
root@HDT4-2:/ZONES# zoneadm -z MYTEST install
/ZONES/MYTEST must not be group readable.
/ZONES/MYTEST must not be group executable.
/ZONES/MYTEST must not be world readable.
/ZONES/MYTEST must not be world executable.
changing zonepath permissions to 0700.
Progress being logged to /var/log/zones/zoneadm.20131126T083253Z.MYTEST.install
Image: Preparing at /ZONES/MYTEST/root.
AI Manifest: /tmp/manifest.xml.GJaWxj
SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
Zonename: MYTEST
Installation: Starting ...
Creating IPS image
Retrieving catalog 1/1 solaris 4.67 MB
4、启动zone进行配置
root@HDT4-2:/ZONES# zoneadm -z MYTEST boot
root@HDT4-2:~# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
1 ZONETEST running /ZONE/ZONETEST solaris excl
4 MYTEST running /ZONES/MYTEST solaris excl
如下所示:
System Configuration Tool
System Configuration Tool enables you to specify the following
configuration parameters for your newly-installed Oracle Solaris 11
system:
- network, time zone, user and root accounts, name services
System Configuration Tool produces an SMF profile file in
/system/volatile/scit_profile.xml.
How to navigate through this tool:
- Use the function keys listed at the bottom of each screen to move
from screen to screen and to perform other operations.
- Use the up/down arrow keys to change the selection or to move
between input fields.
- If your keyboard does not have function keys, or they do not
respond, press ESC; the legend at the bottom of the screen will
change to show the ESC keys for navigation and other functions.
F2_Continue F6_Help F9_Quit
Network
Enter a name for this computer that identifies it on the network. It must
be at least two characters. It can contain letters, numbers, and minus
signs (-).
Computer Name: MYTEST
Select how the wired ethernet network connection is configured.
Automatically Automatically configure the connection
Manually Enter the information on the following screen
None Do not configure the network at this time
F2_Continue F3_Back F6_Help F9_Quit
按照图进行操作!
完成后会自动进入到登录界面
5、配置ssh
root@MYTEST:~# vi /etc/ssh/sshd_config
将这一行修改为如下所示:
PermitRootLogin yes
重启ssh
root@MYTEST:~# svcadm restart ssh
6、安装补丁包
root@MYTEST:~# pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibm SUNWlibms SUNWpool SUNWpoolr SUNWsprot SUNWtoo SUNWuiu8 SUNWfont-xorg-core SUNWfont-xorg-iso8859-1 SUNWmfrun SUNWxorg-client-programs SUNWxorg-clientlibs SUNWxwfsw SUNWxwplt gcc-3 solaris-desktop
system SUNWarc Lint Libraries (usr)
system SUNWbtool CCS tools bundled with SunOS
system SUNWlibm Math & Microtasking Library Headers & Lint Files (Usr)
system SUNWlibms Math & Microtasking Libraries (Usr)
system SUNWpool Resource Pools
system SUNWpoolr Resource Pools (Root)
system SUNWtoo Programming Tools
system SUNWuiu8 Iconv modules for UTF-8 Locale
ERROR: information for "SUNWhea" was not found
ERROR: information for "SUNWsprot" was not found
ERROR: information for "SUNWfont-xorg-core" was not found
ERROR: information for "SUNWfont-xorg-iso8859-1" was not found
ERROR: information for "SUNWmfrun" was not found
ERROR: information for "SUNWxorg-client-programs" was not found
ERROR: information for "SUNWxorg-clientlibs" was not found
ERROR: information for "SUNWxwfsw" was not found
ERROR: information for "SUNWxwplt" was not found
ERROR: information for "gcc-3" was not found
ERROR: information for "solaris-desktop" was not found
上述缺少的包,逐一安装!
pkg install 包名
安装图形界面时,采用如下方式
zone在安装图形界面时,要注意一点,如果不加accept,安装将会失败,同时在配置时,要注意,与一般物理机不同,如7步到后面所示
root@MYTEST:~# pkg install --accept solaris-desktop
安装字符集如下:
root@MYTEST:~# pkg install pkg:/system/locale/extra@0.5.11-0.175.1.0.0.23.1134
7、配置图形界面
zone的图形界面配置与其它是有差别的,需要注意
root@MYTEST:~# vi /etc/gdm/custom.conf
# GDM configuration storage
[daemon]
[security]
[xdmcp]
Enable=true
[greeter]
[chooser]
[debug]
root@MYTEST:/lib/svc/method# vi svc-consolekit
将以下内容注释掉
#if smf_is_nonglobalzone; then
# /usr/sbin/svcadm disable -t svc:/system/consolekit
# echo "console-kit-daemon cannot be run in non-global zones"
# sleep 5 &
# exit $SMF_EXIT_OK
#fi
root@MYTEST:/lib/svc/method# vi svc-dbus
将如下内容注释掉
#if smf_is_nonglobalzone; then
# /usr/sbin/svcadm disable -t svc:/system/dbus
# echo "dbus-daemon cannot be run in non-global zones"
# sleep 5 &
# exit $SMF_EXIT_OK
#fi
root@MYTEST:/lib/svc/method# cd /lib/svc/manifest/application/graphical-login/
root@MYTEST:/lib/svc/manifest/application/graphical-login# vi gdm.xml
将以下内容删除掉
name='hal'
grouping='require_all'
restart_on='none'
type='service'>
root@MYTEST:~# svcadm enable svc:/system/dbus:default
root@MYTEST:~# svcadm enable svc:/system/consolekit:default
root@MYTEST:~# svcadm enable svc:/application/graphical-login/gdm:default
root@MYTEST:~# svcs -d gdm
STATE STIME FMRI
online 8:17:26 svc:/system/utmp:default
online 8:24:51 svc:/system/filesystem/local:default
online 8:38:08 svc:/application/opengl/ogl-select:default
online 8:48:10 svc:/application/desktop-cache/desktop-mime-cache:default
online 8:48:13 svc:/application/font/fc-cache:default
online 8:48:15 svc:/application/desktop-cache/mime-types-cache:default
online 8:48:16 svc:/application/desktop-cache/input-method-cache:default
online 8:48:19 svc:/application/desktop-cache/gconf-cache:default
online 8:48:22 svc:/application/desktop-cache/pixbuf-loaders-installer:default
online 8:48:23 svc:/milestone/self-assembly-complete:default
online 8:48:40 svc:/milestone/multi-user:default
online 8:48:40 svc:/application/desktop-cache/icon-cache:default
online 9:07:22 svc:/system/dbus:default
online 9:07:23 svc:/system/consolekit:default
root@MYTEST:~# netservices open
restarting svc:/system/system-log:default
restarting svc:/network/smtp:sendmail
root@ides:vi /etc/default/login
注释掉CONSOLE=/dev/console
root@MYTEST:~# reboot
至此,zone全部配置完毕
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21752515/viewspace-1062569/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21752515/viewspace-1062569/