Install kvm in centos 7.0

Source: Internet
Author: User

Install kvm in centos 7.0

PRE-INSTALL

========================================================== ==================================

Kvm-related installation packages and their functions

Major kvm packages of qemu-KVM

Command Line tools and libraries required for creating virtual machines using python-javasinst

Virt-manager GUI Virtual Machine Management Tool

Virt-top VM statistics command

Virt-viewer GUI Connection Program, connected to the configured Virtual Machine

Libvirt C language toolkit, provides libvirt Service

C language Toolkit provided by libvirt-client for virtual clients

Virt-install Virtual Machine creation Command Based on libvirt Service

Bridge-utils tools for creating and managing bridge Devices

INSTALL

========================================================== ==================================

[Root @ localhost ~] # Yum install qemu-kvm libvirt virt-install bridge-utils

# Check whether the kvm module is loaded

[Root @ kvm ~] # Lsmod | grep kvm

Kvm_intel 138567 0

Kvm 441119 1 kvm_intel

# If the two are not available, you can use "modprobe kvm" to load them;

# Related commands "insmod; rmmod; modinfo"

# Start libmongod

[Root @ localhost ~] # Systemctl start libcmdd; systemctl enable libcmdd

[Root @ localhost ~] # Systemctl list-unit-files | grep lib1_d

Libmongod. service enabled

NETWORK CONFIGURATION

========================================================== ==================================

# Modifying the NIC file eno16777736

[Root @ kvm ~] # Cd/etc/sysconfig/network-scripts/

[Root @ kvm network-scripts] # echo "BRIDGE = br0"> ifcfg-eno16777736 # Add "BRIDGE = br0" to the ifcfg-e ** original Nic File"

# Create a bridge file ifcfg-br0 (Bridge name), add the following content

[Root @ kvm network-scripts] # vi ifcfg-br0

**************************************** *********

DEVICE = br0

TYPE = "Bridge" # case sensitive, so it must be Bridge

BOOTPROTO = "dhcp"

ONBOOT = "yes"

DELAY = "0"

STP = "yes" # This line is used to start STP, which is related to the result of brctl command line.

**************************************** *********

# Restart NetworkManager and network services:

[Root @ kvm network-scripts] # systemctl restart NetworkManager

# After you manually modify the NIC file, restart the NetworkManager service to take over the network configuration again.

# Solution when the NIC configuration file conflicts with the NetworkManager configuration: {1. Restart NetworkManager; 2. Disable NetworkManager}

[Root @ kvm network-scripts] # systemctl restart network

[Root @ kvm network-scripts] # ip a # ip command used to view and manage ip information

1: lo: <LOOPBACK, UP, LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

Link/loopback 00: 00: 00: 00: 00: 00 brd 00: 00: 00: 00: 00: 00

Inet 127.0.0.1/8 scope host lo

Valid_lft forever preferred_lft forever

Inet6: 1/128 scope host

Valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP qlen 1000

Link/ether 00: 0c: 29: 61: 5c: 1d brd ff: ff

3: virbr0: <NO-CARRIER, BROADCAST, MULTICAST, UP> mtu 1500 qdisc noqueue state DOWN

Link/ether 52: 54: 00: b6: 45: 5b brd ff: ff

Inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0

Valid_lft forever preferred_lft forever

4: virbr0-nic: <BROADCAST, MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500

Link/ether 52: 54: 00: b6: 45: 5b brd ff: ff

6: br0: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc noqueue state UP

Link/ether 00: 0c: 29: 61: 5c: 1d brd ff: ff

Inet 192.168.0.32/24 brd 192.168.0.255 scope global dynamic br0

Valid_lft 11979sec preferred_lft 11979sec

Inet6 fe80: 20c: 29ff: fe61: 5c1d/64 scope link

Valid_lft forever preferred_lft forever

7: vnet0: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN qlen 500

Link/ether fe: 54: 00: cb: 63: b2 brd ff: ff

Inet6 fe80: fc54: ff: fecb: 63b2/64 scope link

Valid_lft forever preferred_lft forever

# Viewing bridge connections

[Root @ kvm network-scripts] # brctl show # brctl is a bridge connection management command

Bridge name bridge id STP enabled interfaces # If no STP = yes is set above, no is displayed here

Br0 8000.000c29615c1d yes eno16777736

Vnet0

Virbr0 8000.525400b6455b yes virbr0-nic

CLOSE SELINUX

========================================================== ==================================

[Root @ kvm network-scripts] # setenforce 0

[Root @ kvm network-scripts] # getenforce

Permissive

[Root @ kvm network-scripts] # vi/etc/selinux/config

**************************************** **

SELINUX = permissive # modify the configuration file to make it permanently effective

**************************************** **

CREATE A VM

========================================================== ==================================

[Root @ kvm ~] # Mkdir-p/var/kvm/images

[Root @ kvm ~] # Virt-install \

-- Network bridge: br0 \

-- Name vm1 \

-- Ram = 1024 \

-- Vcpus = 1 \

-- Disk path =/var/kvm/images/vm1.img, size = 10 \

-- Graphics none \

-- Location 'HTTP: // ftp.iij.ad.jp/pub/linux/centos/7/ OS /x86_64 /'\

-- Extra-args = "console = tty0 console = ttys0. 115200"

# For details about the meaning of each parameter, you can view the extended information.

# The installation process will allow you to choose textmode or vnc. Select textmode to continue installation.

# If the network is faulty, try to use -- cdrom/path/to/centos7.iso

# Virt-install -- name vm1 -- ram = 1024 -- vcpus = 1 -- network bridge: br0 -- disk path =/var/kvm/images/centos7.img, size = 10 -- graphics none -- location = http://ftp.iij.ad.jp/pub/linux/centos/7/ OS /x86_64/ -- extra-args = "console = tty0 console = ttyS0, 115200"

PS: Graphical Virtual Machine installation requires X-WINDOW and virt-manager, the operation before the installation of virtual machine is the same, the operation is very simple under the graphics

Extended Materials

========================================================== ==================================

Http://wiki.centos.org/zh/HowTos/KVM

Http://techlinux.net/2014/09/kvm-centos-7/

Http://www.server-world.info/en/note? OS = CentOS_7 & p = kvm & f = 2

This article from the "Three 0 demon" blog, please be sure to keep this source http://301ren.blog.51cto.com/8887653/1631133

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.