Install and configure kvm in CentOS

Source: Internet
Author: User
Modify files according to your actual situation, here only record my work environment; 1, install the system required file yum-yinstallkvmkmod-kvmkvm-qemu-imgyum-yinstallbridge-utilstunctl2, create ifcf-br0 file vi/etc/sysconfig/network-scripts/ifcfg-br0DEVICE = br0HWADDR = F4: 6D: 04: 40

Modify the file according to your actual situation, and only record your work environment here;

1. files required for installing the system

Yum-y install kvm kmod-kvm-qemu-img
Yum-y install bridge-utils tunctl


2, create the ifcf-br0 file vi/etc/sysconfig/network-scripts/ifcfg-br0

DEVICE = br0
HWADDR = F4: 6D: 04: 40: 90: 47
TYPE = Bridge
IPADDR = 192.168.1.22
NETMASK = 255.255.255.0
ONBOOT = yes
NM_CONTROLLED = no


3, modify the system Nic configuration file ifcfg-eth3, the modification content is as follows:

DEVICE = eth3
HWADDR = F4: 6D: 04: 40: 90: 47
ONBOOT = yes
BRIDGE = br0
NM_CONTROLLED = no




4. modify/etc/qemu-ifup

#! /Bin/sh
Set-x
Bridge = br0
Interface = $1
/Sbin/ip link set $ interface up
/Usr/sbin/brctl addif $ bridge $ interface




5. modify/etc/qemu-ifdown.

#! /Bin/sh
Set-x
Bridge = br0
Interface = $1
Ifconfig $ interface down
Tunctl-d $ interface


6,/etc/init. d/network restart



If the configuration is normal, after connecting the device

1. create a virtual machine

Qemu-img create-f qcow2 linux-6-x86_64.img 10G

2. install virtual machines

/Usr/libexec/qemu-kvm? M 1024-hda. /linux-6-x86_64.img-localtime-net nic, macaddr = DE: AD: BE: EF: F0: 01-net tap-cdrom/opt/release/centos-6-x86_64-CD.iso-boot d-vnc: 1

3. run the VM

/Usr/libexec/qemu-kvm-m 1024-hda. /linux-6-x86_64.img-localtime-net nic, macaddr = DE: AD: BE: EF: F0: 01-net tap-vnc: 1


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.