2006/11/09
VMware Server ゲストOS作成
前回の VMware Server インストール に引き続き、仮想マシンの作成とゲストOSのセットアップを行おう。
まずは VMware Server Console を起動しよう。Windowsだったら スタート メニュー にあるし、Linuxなら以下のコマンドで起動できる。
$ vmware
VMware Server をインストールしたマシンから VMware Server Console を起動したのであれば Local host を選択し、異なるマシンから起動したのであれば Remote host を選択して VMware Server をインストールしたマシンのホスト名、ユーザー名、パスワードを入力する。ユーザーはrootでなくてもかまわない。
仮想マシンが一台もない状態なので、New Virtual Machine をクリックしてウィザードを起動する。
New Virtual Machine Wizard が起動するので、「次へ」ボタンをクリックする。
仮想マシンの作成方法を選択するが、まずはTypicalで良いだろう。そして「次へ」ボタンをクリック。
ゲストOSに最適化された仮想マシンが作成されるため、ゲストOSは適切に選ぼう。CentOSならば Red Hat Enterprise Linux にしておけばよいだろう。そして「次へ」ボタンをクリック。
仮想マシン名と保存ディレクトリを設定する。そして「次へ」ボタンをクリック。
今回はゲストOS独自のIPアドレスを割り当てるため、Use bridged network を選択する。そして「次へ」ボタンをクリック。
ゲストOSの使用するディスクサイズを設定する。Allcoate all disk spcae now をオンにするとこの時点で指定サイズのファイルが事前に作成されるが、オフにするとまずは最小サイズで作成されて必要に応じて自動拡張される。ただし、オフにするとパフォーマンスが悪くなる。ディスク容量とパフォーマンスをトレードオフして適切なほうを選ぼう。2GB以上のファイルが扱えないディスク・フォーマットにファイルを移動する可能性がある場合は Split disk into 2GB files をオンにしよう。ext3では2GB以上のファイルも扱えるので、管理面からここではオフにした。そして「次へ」ボタンをクリック。
Allocate all disk space now を選択した場合、ディスク容量が確保されるまでしばらく待ったあとに、Inventoryに仮想マシンが登録される。これを選択して Edit virtual machine settigs をクリックしよう。
重要なのはメモリーの割り当てだ。黄色の矢印が推奨最小容量、緑の矢印が推奨容量、青の矢印が推奨最大容量だ。黄色と青の矢印の範囲でゲストOSに割り当てるメモリー容量を決めよう。実マシンに512MBしかないのだが、とりあえず160MB割り当てることにした。状況を見て実マシンのメモリーを増設したいと思う。
実マシンのCPUはデュアルコアの Intel Pentium D だが、ゲストOSのProcessorsを2にしてしまうとホストOSのCPUが二つ空くまで待機してしまって(一つ空いただけではゲストOSは動かない)ゲストOSのレスポンス時間が悪化するので1にした。なお、4wayマシンでもこの設定は2までしかできない。
ネットワークの構成上、Ethernet Adaptor が2枚欲しかったのでAdd..ボタンをクリックして Ethernet Adaptor を追加する。デバイスをただで増やせるのは仮想マシンのメリットのひとつなので、気軽に追加しよう。
ホストOSの再起動でゲストOSが破壊されたり再起動し忘れたりしないように、OptionsタグのStartup/Shutdownを変更しておこう。On host startup を Power on virtual machine に、On host shutdown を Shut down guest operationg system にする。
手元に実マシンがあるのであればそれにCDを入れればいいけど、ない場合は VMware Server Console を実行しているマシンにCDを入れてそれをマウントさせることもできる。CD-ROMを選択して、Connectionを Use a physical drive にし、LocationをClientにしよう。ホストOSにISOイメージがあれば Use ISO image も使用できる。
Start this virtual machine ボタンをクリックするとBIOSが起動しCDからブートするので、あとは通常のOSインストールを行う。なお、ゲストOS内のポインタをホストOSの制御下に戻す場合は Contorl + Alt キーを押す。
OSのインストールが終わったらグラフィック・パフォーマンスやホストOSとのコピー&ペーストを実現する VMware Tools をインストールしよう。ついでなので、“撮ったタイミングまであとから戻れる” スナップショットを機能を使って、万が一に備えてみよう。スナップショットを撮るには、メニュー「Snapshot → Take Snapshot...」を選択する。
メニュー「VM → Install VMware Tools...」を選択すると、VMware Tools という仮想CDが準備されるので、それをマウントして中のRPMをインストールしよう。
# mount /media/cdrom mount: ブロックデバイス /dev/hdc は書き込み禁止です、読込み専用でマウントします # rpm -ihv /media/cdrom/VMwareTools-1.0.1-29996.i386.rpm Preparing... ########################################### [100%] 1:VMwareTools ########################################### [100%]
VMware Tools の設定を行うため、vmware-config-tools.plをランレベル3で実行する。なお、途中でネットワークが停止するため、VMware Server Console から実行する必要がある。
# vmware-config-tools.pl Stopping VMware Tools services in the virtual machine: Guest operating system daemon: [ OK ]
vmhgfsのコンパイルが行われる。
Trying to find a suitable vmhgfs module for your running kernel. None of the pre-built vmhgfs modules for VMware Tools is suitable for your running kernel. Do you want this program to try to build the vmhgfs module for your system (you need to have a C compiler installed on your system)? [yes] [Enter] Using compiler "/usr/bin/gcc". Use environment variable CC to override. What is the location of the directory of C header files that match your running kernel? [/lib/modules/2.6.9-42.0.3.plus.c4smp/build/include] [Enter] Extracting the sources of the vmhgfs module. Building the vmhgfs module. Using 2.6.x kernel build system. make: Entering directory `/tmp/vmware-config2/vmhgfs-only' make[1]: Entering directory `/usr/src/kernels/2.6.9-42.0.3.plus.c4-smp-i686' CC [M] /tmp/vmware-config2/vmhgfs-only/cpName.o CC [M] /tmp/vmware-config2/vmhgfs-only/cpNameLinux.o CC [M] /tmp/vmware-config2/vmhgfs-only/dev.o CC [M] /tmp/vmware-config2/vmhgfs-only/driver.o CC [M] /tmp/vmware-config2/vmhgfs-only/hgfsUtil.o CC [M] /tmp/vmware-config2/vmhgfs-only/main.o CC [M] /tmp/vmware-config2/vmhgfs-only/staticEscape.o LD [M] /tmp/vmware-config2/vmhgfs-only/vmhgfs.o Building modules, stage 2. MODPOST CC /tmp/vmware-config2/vmhgfs-only/vmhgfs.mod.o LD [M] /tmp/vmware-config2/vmhgfs-only/vmhgfs.ko make[1]: Leaving directory `/usr/src/kernels/2.6.9-42.0.3.plus.c4-smp-i686' cp -f vmhgfs.ko ./../vmhgfs.o make: Leaving directory `/tmp/vmware-config2/vmhgfs-only' The module loads perfectly in the running kernel. pcnet32 31049 0 Unloading pcnet32 module
ネットワーク・パフォーマンスを向上させるvmxnetのコンパイルが行われる。
Extracting the sources of the vmxnet module. Using 2.6.x kernel build system. make: Entering directory `/tmp/vmware-config2/vmxnet-only' make -C /lib/modules/2.6.9-42.0.3.plus.c4smp/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules make[1]: Entering directory `/usr/src/kernels/2.6.9-42.0.3.plus.c4-smp-i686' CC [M] /tmp/vmware-config2/vmxnet-only/vmxnet.o Building modules, stage 2. MODPOST CC /tmp/vmware-config2/vmxnet-only/vmxnet.mod.o LD [M] /tmp/vmware-config2/vmxnet-only/vmxnet.ko make[1]: Leaving directory `/usr/src/kernels/2.6.9-42.0.3.plus.c4-smp-i686' cp -f vmxnet.ko ./../vmxnet.o make: Leaving directory `/tmp/vmware-config2/vmxnet-only' The module loads perfectly in the running kernel.
ディスプレイ・サイズなどのXの設定を行う。
Detected X.org version 6.8. Please choose one of the following display sizes (1 - 13): [1] "640x480" [2] "800x600" [3] "1024x768" [4] "1152x864" [5] "1280x800" [6] "1152x900" [7] "1280x1024" [8] "1376x1032" [9] "1400x1050" [10] "1680x1050" [11] "1600x1200" [12] "1920x1200" [13] "2364x1773" Please enter a number between 1 and 13:[3] [Enter] X Window System Version 6.8.2 Release Date: 9 February 2005 X Protocol Version 11, Revision 0, Release 6.8.2 Build Operating System: Linux 2.6.9-42.0.2.ELsmp i686 [ELF] Current Operating System: Linux zulu 2.6.9-42.0.3.plus.c4smp #1 SMP Fri Oct 6 12:16:15 CDT 2006 i686 Build Date: 13 September 2006 Build Host: build-i386 Before reporting problems, check http://wiki.X.Org to make sure that you have the latest version. Module Loader present OS Kernel: Linux version 2.6.9-42.0.3.plus.c4smp (buildsvn@build-i386) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)) #1 SMP Fri Oct 6 12:16:15 CDT 2006 P Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (++) Log file: "/tmp/vmware-config2/XF86ConfigLog.4424", Time: Thu Nov 9 23:02:00 2006 (++) Using config file: "/tmp/vmware-config2/XF86Config.4424" (WW) VMWARE(0): Failed to set up write-combining range (0xf0000000,0x1000000) X is running fine with the new config file.
サービスが再起動され、いくつかの注意書きのともに設定が完了する。
Starting VMware Tools services in the virtual machine: Switching to guest configuration: [ OK ] Guest filesystem driver: [ OK ] Guest vmxnet fast network device: [ OK ] DMA setup: [ OK ] Guest operating system daemon: [ OK ] The configuration of VMware Tools 1.0.1 build-29996 for Linux for this running kernel completed successfully. You must restart your X session before any mouse or graphics changes take effect. You can now run VMware Tools by invoking the following command: "/usr/bin/vmware-toolbox" during an X session. To use the vmxnet driver, restart networking using the following commands: /etc/init.d/network stop rmmod pcnet32 rmmod vmxnet depmod -a modprobe vmxnet /etc/init.d/network start Enjoy, --the VMware team
vmxnetドライバーを使うため、注意書きどおりにコマンドを実行する。
# service network stop インターフェース eth0 を終了中: [ OK ] インターフェース eth1 を終了中: [ OK ] ループバックインターフェースを終了中 [ OK ] # rmmod pcnet32 # rmmod vmxnet # depmod -a # modprobe vmxnet # service network start ネットワークパラメーターを設定中: [ OK ] ループバックインターフェイスを呼び込み中 [ OK ] インターフェース eth0 を活性化中: [ OK ] インターフェース eth1 を活性化中: [ OK ]
VMware Toolbox を起動する場合は、X環境で以下のコマンドを実行する。
# vmware-toolbox
1 Trackback
VMware ServerのゲストOSにCentOSをインストール
VMware ServerのゲストOSとしてCentOS 4.4を導入したときの...
Track from Your Website
http://rewse.jp/fukugan/trackback/tb.php?id=834

Comment
No Comments