当前位置:网站首页>小笔记-简单但够用系列_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
边栏推荐
- 35 qlineedit control synthesis example
- Pytest configuration file
- Jar version conflict resolution
- US President signs community safety act to deal with gun issue
- Under the double reduction, the amount of online education has plummeted. Share 12 interesting uses of webrtc
- MySQL第十三次作业-事务管理
- The IE mode tab of Microsoft edge browser is stuck, which has been fixed by rolling back the update
- Yarn package management tool
- MySQL Chapter 5 Summary
- Global and Chinese market of amateur football helmets 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
Record the handling of oom problems caused by too many threads at one time
SSH, SCP command appears permission denied, please try again solution
Establishment of smart dialogue platform for wechat official account
Standard implementation of streaming layout: a guide to flexboxlayout
String constant pool, class constant pool, and runtime constant pool
Little red book - Notes inspiration - project summary
Hcia-dhcp experiment
Based on Zeng Shen's explanation, the line segment tree is studied again one
Using foreach to loop two-dimensional array
MySQL 11th job - view application
随机推荐
Under the double reduction, the amount of online education has plummeted. Share 12 interesting uses of webrtc
Constraintlayout control uses full Raiders
[sans titre]
Redis中执行Lua脚本
What should the preview do?
Basic string operations in C
Cmake / set command
MySQL第八次作业
Openxcap usage
Recyclerview implements flow layout (LinearLayout with line wrap) (flexboxlayoutmanager)
exec系列函数(execl、execlp、execle、execv、execvp)使用
SSH, SCP command appears permission denied, please try again solution
动态库连接 - 符号冲突 - 全局符号介入
SwiftUI 开发经验之为离线优先的应用程序设计数据层
Jar version conflict resolution
How to change the QR code material color of wechat applet
Global and Chinese markets in hair conditioner 2022-2028: Research Report on technology, participants, trends, market size and share
Retrofit common request methods and comments, post, get heard file upload
1. 两数之和(LeetCode题目)
2. 合并两个有序数组