所以我试图用KVM创build一个虚拟机(在CentOS 6.3上),我使用的命令如下:
virt-install --connect qemu:///system --virt-type kvm --name ffVM32 --ram 1024 --disk path=/home/datastore/images/ffVM32.img,size=10 --vnc --cdrom /home/datastore/backups/CentOS-6.4-i386-minimal.iso --bridge bridge0
我得到的输出是:
Starting install... Allocating 'ffVM32.img' | 10 GB 00:00 Creating domain... | 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.
我已经做了一个“X Windows系统”的组安装,但它没有帮助。 我试图通过我的笔记本电脑运行Ubuntu 13..04访问这个。 奇怪的是,当我从PCLinuxOS的另一台机器尝试相同的时候,virt-viewer打开,我可以继续安装。
列出所有虚拟机时,我发现虚拟机正在运行
[root@ts3 ~]# virsh list --all Id Name State ---------------------------------------------------- 8 ffVM32 running
我错过了什么?
您可能还没有使用ssh的-X开关login到您的硬件节点。
[root@yourmachine]# ssh -X root@<your-hardware-node-ip>
从man页:
Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file. X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X authorization database) can access the local X11 display through the forwarded connection. An attacker may then be able to perform activities such as keystroke monitoring. For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information.
要禁用X11转发,可以使用-x开关。
要启用X11转发,请编辑位于/etc/ssh/sshd_config的conf文件并取消注释以下行:
X11Forwarding Yes
并使用service sshd restart
希望这可以帮助。
从Ubuntu笔记本电脑连接-X开关( ssh -X [host] )。
完整的步骤让vnc与libvirt一起工作:
如果你正在做主机的SSH:
ssh -XY ...@....
如果未安装,请安装X11(对于RHEL,请为其他人调整):
yum groupinstall "X Window System"
您可能需要尝试按照步骤1重新注销和ssh。
只有上述不能自行工作, $DISPLAY没有定义时,试着定义它:
export DISPLAY=":0"