Solarisコンテナを使う。

Solaris10の新機能として、Solarisコンテナがある。
簡単に言えば、Solarisの中にSolarisを作ることができる。
従ってIPアドレスを振り分けて使おうというコンセプト。
それぞれの中で依存関係が無くなるので、やりやすいかもしれない。


私の場合、itunesサーバを別コンテナとして用意して使いたいので、
今日はコンテナを作る。
↓を全力で参考にする予定。
http://1x4x9.net/2009/04/solaris-1.html

非帯域ゾーンの作成

zonecfg -z zone1

zonecfg:zone1> create
zonecfg:zone1> set zonepath=/export/zone/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> add net
zonecfg:zone1:net> set address=192.168.250.2
zonecfg:zone1:net> set physical=hme0
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
zonepathは、わりあてる場所

zoneadm list -vc

でちゃんとできていることが確認できる。

zoneadm -z zone1 install

Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <7337> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1158> packages on the zone.
Initialized <1158> packages on zone.
Zone is initialized.
The file contains a log of the zone installation.
あとは、インストールすればよい。
続けて非大域ゾーンのOSを起動する。

# zoneadm -z zone1 boot

確認するとこうなる。

# zoneadm list -vc  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared
   3 zone1            running    /export/zone/zone1             native   shared

ちゃんとrunnningになっていることがわかる。

zlogin -C zone1

非帯域ゾーンにログインする。

Select a Language

  0. English
  1. Japanese

Please make a choice (0 - 1), or press h or ? for help: 1

こうなるので、後はインストールで。
zloginから抜けるには、~ ^D(チルダ, Ctrl+D)と入力する。
zoneをアンインストールするには、

# zoneadm -z zone1 uninstall

zonecfgで継承の設定を変更する。

zonecfg:zone1> remove inherit-pkg-dir dir=/usr
zonecfg:zone1> commit
zonecfg:zone1> exit

zoneadm -z zone1 install

ちなみに、今現在の場所は、

$ zonename
global ← 大域ゾーン

とかで分かる。
hiroyaさんに感謝