当前位置:网站首页>小笔记-简单但够用系列_KVM快速入门
小笔记-简单但够用系列_KVM快速入门
2022-06-26 09:45:00 【NYTWTYN】
kvm简介
KVM 全称是 Kernel-Based Virtual Machine。也就是说 KVM 是基于 Linux 内核实现的。
KVM有一个内核模块叫 kvm.ko,只用于管理虚拟 CPU 和内存。
IO 的虚拟化,比如存储和网络设备的实现由 Linux 内核和Qemu来实现。
说白了,作为一个 Hypervisor,KVM 本身只关注虚拟机调度和内存管理这两个方面。IO 外设的任务交给 Linux 内核和 Qemu
kvm安装
- 查看cpu是否支持虚拟化
[[email protected] ~]# grep -E '(vmx|svm)' /proc/cpuinfo **
- 安装qemu-kvm(用户态管理工具),libvirt(命令行管理工具),virt-install(安装kvm工具),bridge-utils(桥接设备管理工具)
[[email protected] ~]# yum install -y qemu-kvm libvirt virt-install bridge-utils
- 确保加载kvm模块
[[email protected] ~]# lsmod |grep kvm
kvm_intel 174841 0
kvm 578518 1 kvm_intel
irqbypass 13503 1 kvm
####如果没有加载,运行一下命令
[[email protected] ~]# modprobe kvm
[[email protected] ~]# modprobe kvm-intel
- 启动libvirtd服务
[[email protected] ~]# systemctl enable libvirtd
[[email protected] ~]# systemctl start libvirtd
[[email protected] ~]# systemctl status libvirtd
- 配置kvm桥接模式
[[email protected] ~]# cd /etc/sysconfig/network-scripts/
[[email protected] network-scripts]# cp ifcfg-ens32 ifcfg-br0
[[email protected] network-scripts]# vim ifcfg-br0
NAME=br0
DEVICE=br0
ONBOOT=yes
NETBOOT=yes
IPV6INIT=no
BOOTPROTO=static
NM_CONTROLLED=no
TYPE=Bridge
IPADDR=192.168.0.127
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=8.8.8.8
[[email protected] network-scripts]# vim ifcfg-ens32
NAME=ens32
DEVICE=ens32
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
BRIDGE=br0
- 查看网桥
[[email protected] ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000c29d1267b no ens32
virbr0 8000.52540063d8f4 yes virbr0-nic
- 删除virbr0
[[email protected] ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000c29d1267b no ens32
virbr0 8000.52540063d8f4 yes virbr0-nic
[[email protected] ~]# virsh net-list
Name State Autostart Persistent
----------------------------------------------------------
default active yes yes
[[email protected] ~]# virsh net-destroy default
Network default destroyed
[[email protected] ~]# virsh net-undefine default
Network default has been undefined
[[email protected] ~]# systemctl restart libvirtd.service
[[email protected] ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000c29d1267b no ens32
使用virt-manager管理kvm
若要用virt-manager图形化安装虚拟机,所以还需要安装桌面
- 安装桌面软件
[[email protected] ~]# yum grouplist
[[email protected] ~]# yum groupinstall "GNOME Desktop" -y
- 配置中文桌面
grep -E "^[ \t]*export[ \t]+LANG[ \t]*=" /etc/profile&& y="yes" || y="no"
if [[ "$y" = "yes" ]]; then
sed -r -i -e '/^[ \t]*export[ \t]+LANG[ \t]*=/c\export LANG="zh_CN.UTF-8"' /etc/profile
else
echo 'export LANG="zh_CN.UTF-8"' >>/etc/profile
fi
source /etc/profile
- 安装virt-manager
[[email protected] ~]# yum -y install virt-manager
边栏推荐
- 1. 两数之和(LeetCode题目)
- Poj3682 king arthur's birthday celebration (probability)
- SwiftUI 开发经验之为离线优先的应用程序设计数据层
- Using foreach to loop two-dimensional array
- Développeur, quelle est l'architecture des microservices?
- DBSCAN
- June training (the 26th day) - collective search
- Introduction to libmagic
- Small example of SSM project, detailed tutorial of SSM integration
- Global and Chinese market of contemporary lampshade 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

P1296 whispers of cows (quick row + binary search)

String constant pool, class constant pool, and runtime constant pool

904. fruit baskets

Full introduction to flexboxlayout (Google official flexible implementation of flow layout control)

Based on Zeng Shen's explanation, the line segment tree is studied again one

36 qtextedit control input multiline text

The fourteenth MySQL operation - e-mall project

Renesas electronics launched a complete intelligent sensor solution for Internet of things applications

微软 Edge 浏览器 IE 模式标签页出现卡死情况,已通过回滚更新修复

Reshape a two-dimensional array with 3 rows and 3 columns to find the sum of the diagonals
随机推荐
Openxcap usage
Développeur, quelle est l'architecture des microservices?
libmagic 介绍
118. 杨辉三角
How do technicians send notifications?
MySQL第十一作業-視圖的應用
Develop current learning objectives and methods
How QT uses quazip to compress and decompress files
US President signs community safety act to deal with gun issue
2. merge two ordered arrays
String类intern()方法和字符串常量池
Mysql database operation commands (constantly updated)
Flutter与原生通信(上)
Global and Chinese market of contemporary lampshade 2022-2028: Research Report on technology, participants, trends, market size and share
Call API interface to generate QR code of wechat applet with different colors
二叉树常见面试题
C中字符串基本操作
首批12家企业入驻!广州首个集中展销老字号产品专柜开张
JVM的符号引用和直接引用是什么
Constraintlayout control uses full Raiders