标签: KVM安装windows 1、查看CPU是否支持虚拟化 cat /proc/cpuinfo | grep --

时间:2022-01-20 06:30:28

标签:

KVM安置windows


1、检察CPU是否撑持虚拟化

cat /proc/cpuinfo | grep --color vmx

2、安置KVM

yum install qemu-kvm libvirt libguestfs-tools virt-install virt-manager libvirt-python -y


3、启动KVM,添加开机自启动

systemctl start libvirtd

systemctl enable libvirtd

//检察

systemctl is-enabled libvirtd

lsmod | grep kvm

4、安置VNCserver,便于安置windows

yum -y install tigervnc tigervnc-server tigervnc-server-module


5、复制配置模板文件为[email protected]:1.service

cp /lib/systemd/system/[email protected] /lib/systemd/system/[email protected]:1.service

> /lib/systemd/system/[email protected]:1.service

vim /lib/systemd/system/[email protected]:1.service

[Unit]

Description=Remote desktop service (VNC)  

After=syslog.target network.target  

[Service]  

Type=forking  

ExecStartPre=http://www.mamicode.com/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'  

ExecStart=http://www.mamicode.com/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"  

PIDFile=http://www.mamicode.com/root/.vnc/%H%i.pid  

ExecStop=http://www.mamicode.com/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'  

[Install]  

WantedBy=multi-user.target

6、设置VNC用户暗码

vncpasswd

7、从头载入system配置

systemctl daemon-reload

8、启动[email protected]:1.service处事,并设置开机自启

systemctl start [email protected]:1.service && systemctl enable [email protected]:1.service

//检察

systemctl is-enabled [email protected]:1.service

######如果启动报错rm -rf /tmp/.X11-unix/*然后再启动 ########

9、安置windows 

//下载镜像dvd

//挂着光盘

mount /dev/sdb /var/lib/libvirt/images/

10、安置windows

virt-install --name=win2008  --ram 512 --vcpus=1 --disk path=http://www.mamicode.com/var/lib/libvirt/images/win2008.img,size=30 --accelerate --cdrom /var/lib/libvirt/images/zh-\ Hans_windows_server_2008_datacenter_enterprise_standard_x86_dvd_x14-26742.iso --vnc --vncport=5917 --vnclisten=0.0.0.0 --network bridge=br0,model=virtio --noautoconsole

windows下用tightVNC viewer  长途连接10.0.0.121:5917  进行图形化安置,,安置过程中会重启,需要手动启动virsh start win2008

virsh start win2008

virsh shutdown win2008

virsh autostart win2008

//姑且添加网卡

virsh attach-interface win20018 --type network --source default

virsh attach-interface win20018 --type network --source default --config


Linux下KVM安置windows