一番ハマったのはRealVNCでは接続できず、
UltraVNCじゃないとダメだったところですw
DebianでKVM-withoutVNC
に引き続き、今度はVNCを使ってみます。
少しばかり、ご作法が違います。
ドメイン(ゲストOS)名・・・ubuntu-vnc
HDDイメージ・・・/var/vm/ubuntu-vnc.img
CPU・・・2つ
メモリ・・・512MB
ネットワーク・・・ブリッジ
VNCポート・・・5901
VNC許可アドレス・・・・0.0.0.0(どこからでもOK)
下準備
VNCを使う場合は、ホストOSの設定を変更します。
# vi /etc/libvirt/qemu.conf vnc_listen = "0.0.0.0" vnc_password = "XYZ12345"
を設定して下さい。
ゲストOS用HDDを作ります。
# qemu-img create -f raw /var/vm/ubuntu-vnc.img 10G Formatting '/var/vm/ubuntu-vnc.img', fmt=raw size=10737418240
コマンドいっぱーつ
# virt-install \ --name ubuntu-vnc \ --ram 512 \ --vcpus=2 \ --disk path=/var/vm/ubuntu-vnc.img \ --os-variant=virtio26 \ --network=bridge:br0 \ --location http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/ \ --vnc \ --vncport=5901 \ --vnclisten=0.0.0.0 \ --keymap=ja
こんな感じでいけます。
–os-variant
Linux系とかUnix系、Win系でオプションが違います。
準仮想化ドライバが使えるようになります。
–location
ネットワークインストールさせています。
–vnc
–vncport=5901
–vnclisten=0.0.0.0
VNCを使ってポートは5901、すべてのネットワークから接続許可しています。
インストールが開始されると、
インストールを開始しています... ファイル MANIFEST を読出中... | 3.5 kB 00:00 ... ファイル MANIFEST を読出中... | 3.5 kB 00:00 ... ファイル linux を読出中... | 9.5 MB 00:07 ... A ファイル initrd.gz を読出中... | 33 MB 00:24 ... TA ドメインを作成中... | 0 B 00:00 Cannot open display: Run 'virt-viewer --help' to see a full list of available command line options Domain installation still in progress. You can reconnect to the console to complete the installation process.
一度、コンソールから切断されるので、
VNCクライアントで
ホストOSのIPアドレス+設定したポート番号(上記だと5901)
で接続して下さい。
出来上がったXMLは
<domain type='kvm'> <name>ubuntu-vnc</name> <uuid>09699431-fc9f-37db-937e-df7e162b24c8</uuid> <memory>524288</memory> <currentMemory>524288</currentMemory> <vcpu>2</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/vm/ubuntu-vnc.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <interface type='bridge'> <mac address='52:54:00:6e:6a:82'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5901' autoport='no' listen='0.0.0.0' keymap='ja'/> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> </domain>
こんな感じ。
以下が追加されているのがわかります
<input type='mouse' bus='ps2'/> <graphics type='vnc' port='5901' autoport='no' listen='0.0.0.0' keymap='ja'/> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video>
ここで一番大事なのが「slot=’0x02’」です。
withoutVNCからVNCを使うようにするためには、これが重要みたい。
さて、ここで大問題が。。。
RealVNCだとKVM-VNCに繋がらないということがありました。
接続はするけど、すぐに切断されてしまう。。。
なので、UltraVNCを使いました。
原因までは探ってないですが、Mac版でもダメでした。
WindowsならVMWareのドライバーが使えるみたい
http://www.linux-kvm.com/content/using-vmware-vga-kvm-windows-guests
[tegaki]RealVNCめ・・・[/tegaki]