码迷,mamicode.com
首页 > 其他好文 > 详细

KVM配置

时间:2019-08-20 18:22:31      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:ast   rman   graph   电脑   sys   boot   mod   关闭   bsp   

 

安装依赖包(因最小化安装)

[root@slave-master ~]# yum install -y vim wget tree  lrzsz gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop  lsof  ntpdate telnet bridge-utils -y

 

安装kvm相关的包

[root@slave-master ~]# yum install qemu-kvm qemu-kvm-tools libvirt libvirt-client virt-manager virt-install -y

 

启动libvirt虚拟网卡

[root@slave-master ~]# systemctl start libvirtd
[root@slave-master ~]# systemctl enable libvirtd  #添加开机自启动

 

配置网卡绑定

[root@slave-master network-scripts]# vim ifcfg-bond0  #先配置bond0
BOOTPROTO=static
NAME=bond0
DEVICE=bond0
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br0
[root@slave-master network-scripts]# vim ifcfg-br0 #配置br0
TYPE=Bridge
BOOTPROTO=static
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=172.16.129.102
NETMASK=255.255.0.0
GATEWAY=172.16.129.1
[root@slave-master network-scripts]# vim -o ifcfg-eth0 ifcfg-eth1 # 配置eth0和eth1
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
USERCTL=no
SLAVE=yes
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
ifcfg-eth0 [+]                                                                                         8,10           All
BOOTPROTO=static
NAME=eth1
DEVICE=eth1
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
USERCTL=no
SLAVE=yes

[root@slave-master network-scripts]# vim -o ifcfg-bond0 ifcfg-bond1 #配置bond1 配置内网
BOOTPROTO=static
NAME=bond0
DEVICE=bond0
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br0
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
ifcfg-bond0                                                                                            7,1            All
BOOTPROTO=static
NAME=bond1
DEVICE=bond1
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br1

[root@slave-master network-scripts]# vim -o ifcfg-br0 ifcfg-br1

TYPE=Bridge
BOOTPROTO=static
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=172.16.129.102
NETMASK=255.255.0.0
GATEWAY=172.16.129.1
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
~                                                                                                                       
ifcfg-br0                                                                                              3,1            All
TYPE=Bridge
BOOTPROTO=static
NAME=br1
DEVICE=br1
ONBOOT=yes
IPADDR=192.168.37.102
NETMASK=255.255.255.0

 

关闭服务

[root@slave-master ~]# systemctl stop NetworManager
[root@slave-master ~]# systemctl disable NetworkManager
[root@slave-master ~]# systemctl disable firewalld
[root@slave-master ~]# vim /etc/sysconfig/selinux
SELINUX=disabled

 

安装组件

[root@slave-master ~]# yum install bridge-utils -y

 

重启网络服务或重启电脑

[root@slave-master ~]# systemctl restart network

 

创建虚拟磁盘

[root@slave-master ~]# qemu-img create -f qcow2 /var/lib/libvirt/images/linux_bridge.qcow2 10G

 

创建虚拟机

[root@slave-master ~]# virt-install --virt-type kvm --name centos7_bridge --ram 1024 --vcpu 2 --cdrom=/usr/local/src/CentOS-7-x86_64-Minimal-1810.iso  --disk path=/var/lib/libvirt/images/linux_bridge.qcow2 --network bridge=br0 --graphics vnc,listen=0.0.0.0 --noautoconsole

 

管理虚拟机

[root@slave-master ~]# virt-manager

 

修改参数

技术图片

 

安装系统

技术图片

 

 技术图片

 

 技术图片

技术图片

技术图片

技术图片

 

KVM配置

标签:ast   rman   graph   电脑   sys   boot   mod   关闭   bsp   

原文地址:https://www.cnblogs.com/maxuebin/p/11384638.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!