戴尔有一份简单操作手册,可以参考:

https://linux.dell.com/files/whitepapers/KVM_Virtualization_in_RHEL_7_Made_Easy.pdf

下面是根据我个人遇到的问题做的一些修正

1、新建kvm虚拟机

[code type=”bash”]
virt-install \
–network bridge:br0 \
–name vm1 \
–ram=1024 \
–vcpus=1 \
–disk path=/vm-images/vm1.img,size=10 \
–graphics none \
–input tablet,bus=usb \
–cdrom /root/RHEL-7.0-20140507.0-Server-x86_64-dvd1.iso
[/code]

2、这样linux就开始新建虚拟机并启动运行,这时候先退出,关闭虚拟机。因为我们要配置一下vnc跟光盘启动。这样才能通过vnc连过去安装系统。linux服务器是没有界面的。

3、配置虚拟机文件,执行 virsh edit vm1命令

配置启动顺序,硬盘无法启动就从光盘启动。

[code type=”text”]
<os>
<type arch=’x86_64′ machine=’pc-i440fx-rhel7.0.0′>hvm</type>
<boot dev=’hd’/>
<boot dev=’cdrom’/>
</os>
[/code]

配置光驱镜像文件

[code type=”text”]
<disk type=’file’ device=’cdrom’>
<driver name=’qemu’ type=’raw’/>
<source file=’/home/images/CentOS-7-x86_64-Minimal-1611.iso’/>
<target dev=’hda’ bus=’ide’/>
<readonly/>
<address type=’drive’ controller=’0′ bus=’0′ target=’0′ unit=’0’/>
</disk>
[/code]

配置vnc

[code type=”text”]
<devices>
<graphics type=’vnc’ port=’5911′ autoport=’no’ listen=’0.0.0.0′>
<listen type=’address’ address=’0.0.0.0’/>
</graphics>
</devices>
[/code]

4、启动虚拟机,并用vnc客户端连过去,这样就可以安装操作系统了。

推荐个vnc客户端 https://www.realvnc.com/download/vnc/

5、安装acpid,kvm的shutdown命令依赖这玩意,如果没装就没法在kvm的层面关闭虚拟机。

[code type=”bash”]
yum install acpid
service acpid start
chkconfig acpid on
[/code]

6、常见问题

关于vnc鼠标不同步的问题,可能是安装的时候忘了加上tablet设备。可以编辑虚拟机文件,加上就可以了

By charlie

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注