1、首先我利用vmware workstation來創建centos7虛擬機,然後開啓虛擬化,如下圖所示。
2、啓動虛擬機,查看是否支持了虛擬化
[root@template ~]# cat /proc/cpuinfo | grep -E 'vmx|svm'
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx
ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm epb tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx
ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm epb tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
3、再次,查看是否kvm的驅動已經加載,
[root@template ~]# lsmod | grep kvm
kvm_intel 188416 0
kvm 581632 1 kvm_intel
irqbypass 16384 1 kvm
# 如果沒有加載kvm驅動,利用命令加載驅動
modprobe -a kvm
modprobe -a kvm_intel
4、安裝qemu-kvm
yum install -y qemu-kvm
5、安裝libvirt
yum install -y libvirt
[root@template ~]# systemctl restart libvirtd
#驗證libvirt是否正常啓動
[root@template
~] #
systemctl status libvirtd ●
libvirtd.service - Virtualization daemon Loaded:
loaded ( /usr/lib/systemd/system/libvirtd .service;
enabled; vendor preset: enabled) Active:
active (running) since Sat 2018-01-20 08:46:47 CST; 29s ago Docs:
man :libvirtd(8) http: //libvirt .org Main
PID: 1424 (libvirtd) Tasks:
18 (limit: 19660) CGroup:
/system .slice /libvirtd .service ├─1081
/sbin/dnsmasq --conf- file = /var/lib/libvirt/dnsmasq/default .conf
--leasefile-ro --dhcp-script ├─1082
/sbin/dnsmasq --conf- file = /var/lib/libvirt/dnsmasq/default .conf
--leasefile-ro --dhcp-script └─1424
/usr/sbin/libvirtd Jan
20 08:46:47 template.com systemd[1]: Starting Virtualization daemon... Jan
20 08:46:47 template.com systemd[1]: Started Virtualization daemon. Jan
20 08:46:48 template.com dnsmasq[1081]: read /etc/hosts -
2 addresses Jan
20 08:46:48 template.com dnsmasq[1081]: read /var/lib/libvirt/dnsmasq/default .addnhosts
- 0 addresses Jan
20 08:46:48 template.com dnsmasq-dhcp[1081]: read /var/lib/libvirt/dnsmasq/default .hostsfile |
#查看版本
[root@template ~]# virsh version
Compiled against library: libvirt 2.2.1
Using library: libvirt 2.2.1
Using API: QEMU 2.2.1
Running hypervisor: QEMU 2.7.1
6、安裝virt-manager工具
yum install -y virt-manager
7、自己的Windows pc 安裝Xmanager
8、xshell 工具File--->Properties,如下圖所示
9、萬事具備了,用xshell工具連接centos服務器,執行命令virt-manager, 呀,亂碼
破解亂碼的解決辦法爲安裝virt-manager字體:
yum install dejavu-lgc-sans-fonts -y
10、在打開一個xshell窗口,再次執行virt-manager,一切ok了。