前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >kvm安装

kvm安装

作者头像
零月
发布2018-04-25 15:55:45
1.3K0
发布2018-04-25 15:55:45
举报
文章被收录于专栏:从零开始的linux从零开始的linux

yum install -y kvm virt-* libvirt bridge-utils qemu-img

是否加载模块

lsmod |grep kvm

编辑网卡

[root@node01 ~]# cd /etc/sysconfig/network-scripts/

[root@node01 network-scripts]# cp ifcfg-eth0 ifcfg-br0

[root@node01 network-scripts]# vim ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

BRIDGE=br0

[root@node01 network-scripts]# vim ifcfg-br0

DEVICE=br0

TYPE=Bridge

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

IPADDR=192.168.2.71

PREFIX=24

GATEWAY=192.168.2.1

DNS1=192.168.2.1

重启网络

启动或重启libvirtd服务和messagebus 服务

[root@node01 ~]# /etc/init.d/libvirtd start

Starting libvirtd daemon:

[root@node01 ~]# /etc/init.d/messagebus restart

Stopping system message bus: [ OK ]

Starting system message bus: [ OK ]

此时可以查看网络接口列表

[root@node01 ~]# brctl show

bridge name bridge id STP enabled interfaces

br0 8000.000c29af5025 no eth0

virbr0 8000.52540085962c yes virbr0-nic

添加额外的分区

[root@node01 ~]# virt-install --name redhat6.7_1 --ram 512 --disk path=/data/redhat6.7_1.img,size=30 --vcpus 1 --os-type linux --os-variant rhel6 --network bridge=br0 --graphics none --console pty,target_type=serial --location 'http://mirrors.aliyun.com/centos/6.9/os/x86_64/' --extra-args 'console=ttyS0,115200n8 serial'

配置网络

完成

本地安装

root@node01 data]# qemu-img create -f qcow2 -o preallocation=metadata /data/test02.qcow2 7G

Formatting '/data/test02.qcow2', fmt=qcow2 size=7516192768 encryption=off cluster_size=65536 preallocation='metadata'

[root@node01 ~]# virt-install --name redhat6.7_2 --ram 512 --disk path=/data/test02.qcow2,format=qcow2,size=10,bus=virtio --vcpus 1 --os-type linux --os-variant rhel6 --network bridge=br0 --graphics none --console pty,target_type=serial --location '/mnt/' --extra-args 'console=ttyS0,115200n8 serial'

查看机器

[root@node01 ~]# virsh list --all

Id Name State

----------------------------------------------------

2 redhat6.7_1 running

4 redhat6.7_2 running

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2017-06-18,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 从零开始的linux 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档