KVM虚拟化部署与应用

第一步:

更新系统:yum -y update

第二步:

  关闭防火墙:systemctl  stop firewalld

  设置不开机启动防火墙:   systemctl disable firewalld

  关闭selinux:  vi /etc/selinux/config           SELINUX=disabled

  重启系统:  reboot

第三步:安装KVM

a.查看主机是否支持虚拟化

  Intel CPU:cat /proc/cpuinfo |grep --color vmx

   AMD CPU:cat/proc/cpuinfo |grep --color smv


b.安装KVM

   ####****   yum -y install epel-release -y     (如果是通过Inter网络部署才安装)

  yum-y install kvm libvirt libvirt-python python-virtinst qemu-kvm-tools qemu-img   (参考不用安装)

  ****   yum -y install qemu-kvmlibvirt libguestfs-tools virt-install virt-manager libvirt-python    


c.启动KVM服务

 systemctl start libvirtd

 systemctl enable  libvirtd

 systemctl status   libvirtd        或者    systemctl  is-enabled  libvirtd


d.使用virt-manager 调出图形管理界面

[if !vml]

[endif]


注意:在生产环境中如果提示没有X11就是缺少远程桌面依赖,那么就需要安装相关的插件

yum -y install libX11xorg-x11-server-utils xorg-x11-proto-devel dbus-x11 xorg-x11-xauthxorg-x11-drv-ati-firmware xorg-x11-xinit

 

第四步配置网桥

cp /etc/sysconfig/network-scripts/ifcfg-ens33/etc/sysconfig/network-scripts/ifcfg-br0        


A.编辑ens33网卡信息

vi/etc/sysconfig/network-scripts/ifcfg-ens33

[if !vml][endif][if !vml]

[endif]   


B.编辑br0网卡信息

vi

/etc/sysconfig/network-scripts/ifcfg-br0

[if !vml]

[endif]

C.重启网络: 

service network restart   之后ip  a查看 br0 网卡的IP地址是否生效  。没有就直接:reboot  再查看ip a  中的br0是否有IP地址

[if !vml]

[endif]

d.测试网络是否正常

第五步KVM安装虚拟机之前的部署

[if !supportLists]a.     [endif]递归创建存储池

mkdir -pv /kvm/{store,iso}

[if !vml]

[endif]

b.运行虚拟机管理软件部署ISO,和存储的路径

[if !vml]

[endif]


c. 双击QEMU/KVM选择"存储选项卡",然后单击"+"按钮新建存储池


[if !vml]

[endif]


d.根据提示输入存储池的名称,如store;

[if !vml]

[endif]


e.点击(前进)Forward,指定store存储池里面内容的store存储目录(该处为之前新建的/kvm/store);


[if !vml]

[endif]


[if !vml]

[endif]


f. 同样的操作创建iso的镜像存储池,单击"+"按钮新建存储池;完成后如下图。


[if !vml]

[endif]


g.上传镜像到ISO目录中,也称为镜像池


[root@localhost ~]# cd /kvm/iso/

[root@localhost iso]# rz

[if !vml]

[endif]

h. 查看上传的ISO镜像

[if !vml]

[endif]

第六步KVM安装虚拟机

新建存储卷:存储卷即安装系统时虚拟机所使用的磁盘文件,在vmware软件中新建虚拟机时可选择磁盘文件的位置和大小,而KVM可提前新建虚拟机所使用磁盘文件及大小(当然也可直接使用默认KVM创建的default存储池空间),相比更加灵活


[if !supportLists]a.     [endif]单击刚创建好的"store"存储池,单击对话框中间的"+"按钮建立一个存储卷;

[if !vml]

[endif]

[if !vml]

[endif]


[if !supportLists]b.     [endif]回到首页虚拟系统管理器后,选择"第一个电脑图标"选项;


[if !vml]

[endif]


[if !supportLists]c.     [endif]选择上传的镜像

[if !vml]

[endif]


[if !supportLists]d.     [endif]更改虚拟机的cpu、内存配置:


[if !supportLists]e.     [endif]选择之前创建好的卷

[if !vml]

[endif][if !vml]

[endif]


[if !supportLists]f.      [endif]指定虚拟机名称,然后将Storage选项下方的方格勾选上;

[if !vml]

[endif]


[if !supportLists]g.     [endif]点击“开始安装(Begin Installation)”


[if !supportLists]h.     [endif]解决virt-manager (KVM)安装虚拟机无法使用键盘

[if !vml]

[endif]

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容