Solaris10下区域创建基本步骤

06:19下午 一月 07, 2008 in category Solaris by 牛客

创建一个区域

系统启动就进入'全局'区域。这是一个主要的区域。

# mkdir /x1/zones/<zonename>   [不能是一个符号链接]
# chmod 700 /x1/zones/<zonename>
# zonecfg -z <zonename>
create
set zonepath=/x1/zones/<zonename>
set autoboot=true (或者 autoboot=false)
add inherit-pkg-dir
[只读路径, 从全局区域使用回送文件系统(lofs)挂载]
set dir=/opt
end
add net
set address=<ip> [区域IP]
set physical=bge0 [使用的网络接口]
end
add dataset [如果使用ZFS存储器]
set name=zonestorage/<zonename>
end
commit
exit
# zoneadm -z <zonename> install
[安装区域,需要一定的时间]
# zoneadm -z <zonename> boot
# zlogin -C <zonename>

初次进入区域,会提示你配置区域。就像你新安装了一个Solaris系统,例如主机名、root口令、DNS配置、时间区域等等。

在第一次启动的时候配置区域

1. 选择 'X Terminal Emulator' (xterms)    - 选项 12
...
2. 输入完整的主机名 (例如 <zonename>zones.apache.org)
[ 此处使用Esc-2来代替F2的功能. ]
[ Before this step, minotaur's named should have the name as a valid DNS entry ]
3. 不配置Kerberos security (这个是默认的)
4. 选择DNS

domain zones.apache.org
nameserver 140.211.166.130
nameserver 140.211.166.131
search apache.org zones.apache.org

5. 选择时间区域 (timezone offset of 0)
It is the bottom option; scroll down
6. 选择root口令
7. 选择 'discover NFSv4 domain',当然如果是独立的计算机,此处不选!
[ 系统重起 ]



8. 初始化 sfw配置文件的本地拷贝
(允许本地的sudoers)

# cp -rp /opt/sfw/etc.orig /etc/opt/sfw

9. 禁止服务 (看下面).

10. 完成!

---
建议使用smf管理服务,而不是使用/etc/init.d/。

禁止服务:
svcadm disable network/smtp [i.e. sendmail]

启用服务:
svcadm enable network/smtp [i.e. sendmail]

列出正在运行的服务:
svcs

建议在区域中禁止的服务,可根据自己的实际情况来决定。
[可以把这些命令粘贴到你的终端]:
svcadm disable network/smtp
svcadm disable network/telnet
svcadm disable network/ftp
svcadm disable network/finger
svcadm disable network/login:rlogin
svcadm disable network/shell:default
svcadm disable application/x11/xfs
svcadm disable network/rpc/rstat
svcadm disable network/rpc/rusers
svcadm disable network/rpc/smserver
svcadm disable network/rpc/gss
svcadm disable network/rpc/rquota
svcadm disable network/rpc/cde-calendar-manager
svcadm disable network/rpc/cde-ttdbserver
svcadm disable network/nfs/client
svcadm disable network/nfs/cbd
svcadm disable network/nfs/mapid
svcadm disable network/nfs/status
svcadm disable network/nfs/nlockmgr
svcadm disable network/nfs/rquota
svcadm disable network/stdiscover
svcadm disable network/stlisten
svcadm disable network/cde-spc
svcadm disable network/rpc-100235_1/rpc_ticotsord
svcadm disable network/security/ktkt_warn

---
为了最新的安全更新:
[ 仅在全局区域中执行]

# smpatch update

有用的区域命令

这些命令都在全局区域中运行。

列出所有区域:
$ zoneadm list -vc

启动一个区域:
# zoneadm -z <zonename> boot

登录到区域的控制台:
# zlogin -C <zonename>
[escape via ~. ;
remember to ~~ if you are connecting via SSH!]

进入一个区域
[必须是root帐号; 进入到区域后使用区域的root身份]:
# zlogin <zonename>
[通过关闭shell退出区域]

通过指定用户登录到区域:
# zlogin -l <username> <zonename>

关闭一个区域:
# zlogin
# shutdown -i5 -y -g0 [典型的Solaris关闭命令]

重起一个区域
[强制重起; 通过shutdown脚本]:
# zoneadm -z <zonename> reboot

删掉一个区域:
# zoneadm -z <zone-to-zap> uninstall [卸载]
# zonecfg -z <zone-to-zap> delete [删除]

评论[0]

评论:

发表一条评论:
  • HTML语法: 启用