CENTOS7-KVM Installation

Source: Internet
Author: User

CentOS 7.0 Install KVM


Pre-install

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

KVM-related installation packages and their role

QEMU-KVM Main KVM Package

Python-virtinst command-line tools and libraries required to create a virtual machine

Virt-managergui Virtual Machine Management tools

Virt-top Virtual Machine Statistics command

Virt-viewergui connector, connecting to a configured virtual machine

LIBVIRTC Language Toolkit, providing libvirt services

Libvirt-client A C language toolkit for virtual clients

Virt-install Virtual machine creation commands based on the Libvirt service

Bridge-utils tools for creating and managing bridging devices


INSTALL

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

[Email protected]~]# yum install QEMU-KVM libvirt virt-install bridge-utils

#查看是否加载kvm模块

[[Email protected]~]# lsmod|grep KVM

Kvm_intel 138567 0

KVM 441119 1 Kvm_intel

#如果没有这两条, can be loaded with "modprobe KVM";

#相关命令 "Insmod;rmmod;modinfo"

#启动libvirtd

[[Email protected]~]# systemctl start Libvirtd;systemctl enable LIBVIRTD

[Email protected]~]# systemctl list-unit-files|grep LIBVIRTD

Libvirtd.service enabled

NETWORK CONFIGURATION

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

#修改网卡文件eno16777736

[[Email protected]~]# cd/etc/sysconfig/network-scripts/

[[email protected] network-scripts]# echo "bridge=br0" >>ifcfg-eno16777736 Add "-e**" to #在ifcfg bridge=br0 original Nic file

#新建网桥文件ifcfg-br0 (bridge name), add the following

[Email protected] network-scripts]# VI ifcfg-br0

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

Device=br0

Type= "Bridge" #大小写敏感, so it must be bridge.

Bootproto= "DHCP"

onboot= "Yes"

delay= "0"

stp= "Yes" #这一行是来启动STP, related to the results of the BRCTL command line

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

#重启NetworkManager及network服务:

[Email protected]network-scripts]# systemctl Restart NetworkManager

#当你手动修改了网卡文件后, you need to restart the NetworkManager service to re-take over the network configuration

#网卡配置文件和NetworkManager配置冲突时, Solution: {1, restart Networkmanager;2, close NetworkManager}

[Email protected]network-scripts]# systemctl Restart Network

[Email protected] network-scripts]# IP a #ip命令用来查看和管理ip信息

1:lo:<loopback,up,lower_up> MTU 65536 qdisc noqueue State UNKNOWN

Link/loopback 00:00:00:00:00:00 brd00: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 Qdisc pfifo_fastmaster br0 State up Qlen 1000

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

3:VIRBR0: <NO-CARRIER,BROADCAST,MULTICAST,UP> MTU Qdisc Noqueue Statedown

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

inet 192.168.122.1/24 BRD 192.168.122.255scope Global virbr0

Valid_lft Forever Preferred_lft Forever

4:virbr0-nic: <BROADCAST,MULTICAST> MTU qdisc pfifo_fast master virbr0state down Qlen 500

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

6:br0:<broadcast,multicast,up,lower_up> MTU Qdisc Noqueue State up

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

inet 192.168.0.32/24 BRD 192.168.0.255scope Global Dynamic Br0

Valid_lft 11979sec preferred_lft11979sec

Inet6 FE80::20C:29FF:FE61:5C1D/64 Scopelink

Valid_lft Forever Preferred_lft Forever

7:vnet0:<broadcast,multicast,up,lower_up> MTU Qdisc pfifo_fast master br0state UNKNOWN Qlen 500

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

Inet6 FE80::FC54:FF:FECB:63B2/64 Scope link

Valid_lft Forever Preferred_lft Forever

#查看网桥连接

[Email protected] network-scripts]# Brctl show #brctl是一个网桥连接管理命令

Bridge name Bridge ID STP enabled interfaces #如果上面不设置STP =yes, this will show no

Br0 8000.000c29615c1d Yes eno16777736

Vnet0

Virbr0 8000.525400b6455b Yes Virbr0-nic

CLOSE SELINUX

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

[[Email protected]network-scripts]# setenforce 0

[[Email protected]network-scripts]# Getenforce

Permissive

[Email protected]network-scripts] #vi/etc/selinux/config

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

Selinux=permissive #修改配置文件使其永久生效

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

CREATE A VM

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

[Email protected]~]# mkdir-p/var/kvm/images

[Email protected]~]# virt-install \

--NETWORKBRIDGE:BR0 \

--NAMEVM1 \

--ram=1024\

--vcpus=1\

--DISKPATH=/VAR/KVM/IMAGES/VM1.IMG,SIZE=10 \

--graphicsnone \

--location ' http://ftp.iij.ad.jp/pub/linux/centos/7/os/x86_64/' \

--extra-args= "console=tty0console=ttys0,115200"

#详细每个参数的意义可以查看扩展资料

#安装过程会让你选择textmode or VNC, choose TextMode to continue the installation.

#如果网络会有问题的话, try to choose--cdrom/path/to/centos7.iso

#virt-install--name vm1--ram=1024--vcpus=1--network bridge:br0--diskpath=/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 installation of virtual machines requires X-window and Virt-manager, before the installation of virtual machines are the same, the operation of the graphics is very simple

Extended Data

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

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 is from the "30 Demon People" blog, please make sure to keep this source http://301ren.blog.51cto.com/8887653/1631133

CENTOS7-KVM Installation

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.