KVM安装方法

/etc/sysconfig/network-scripts/

1桥接

yum -y install bridge-utils

systemctl restart network

2添加网桥

brctl addbr br0

brctl addbr br1

3复制网络配置

cp 物理网卡 ifcfg-br0

4关闭 NetworkManager

chkconfig NetworkManager off

service NetworkManager stop

 

5.设置网桥配置

注意所有网卡的UUID不要动

物理网卡

BOOTPROTO=none

DEVICE=eth0  物理网卡名字

NM_CONTROLLED=no

ONBOOT=yes

BRIDGE=br0 虚拟网卡名字

 

网桥

DEVICE=br0

ONBOOT=yes

TYPE=Bridge

NM_CONTROLLED=no

BOOTPROTO=static

IPADDR=xx.xx.xx.xx

NETMASK=xx.xx.xx.xx

GATEWAY=xx.xx.xx.xx

DEFROUTE=yes

DNS1=114.114.114.114

DNS2=8.8.8.8

 

重启网络service network restart
查看桥接是否成功 brctl show
重启系统reboot

 

安装vnc和virt-manager

 

yum -y install libcanberra-gtk2 qemu-kvm.x86_64 qemu-kvm-tools.x86_64  libvirt.x86_64 libvirt-cim.x86_64 libvirt-client.x86_64 libvirt-java.noarch libvirt-python.x86_64 libiscsi-1.7.0-5.el6.x86_64  dbus-devel virt-clone tunctl virt-manager libvirt libvirt-python python-virtinst

 

启用libvirt

[root@kevin ~]# systemctl enable libvirtd

[root@kevin ~]# systemctl start libvirtd

 

安装zkvm

 

缩小镜像

查看镜像挂载virt-df Centos65v10.qcow2

查看镜像大小qemu-img info Centos65v10.qcow2
缩小分区 guestfish -a Centos65v10.qcow2

launch

list-partitions

resize2fs-size /dev/sda3 100G

sync

exit

 

 

缩小镜像

创建镜像qemu-img create -f qcow2 Centos65_small.qcow2 105G

导入镜像 virt-resize --shrink /dev/sda3 Centos65v10.qcow2 Centos65_small.qcow2

压缩镜像 qemu-img convert -c -O qcow2 /data/template/CentOS76/20gkehu.qcow2 /data/template/CentOS76/20gkehuyasuo.qcow2

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容