admin管理员组文章数量:1568419
KVM
安装KVM
查看cpu是否支持虚拟化,#如果输出结果中包含vmx,则表示采用Intel虚拟化技术;如果包含svm,则表示采用AMD虚拟化技术;如果没有任何输出,表示当前的CPU不支持KVM虚拟化技术。
cat /proc/cpuinfo | egrep '(svm|vmx)'
安装kvm平台及kvm管理工具
dnf install qemu-kvm libvirt virt-*
命令
virt-install
[root@localhost ~]# virt-install --help
usage: virt-install --name NAME --memory MB STORAGE INSTALL [options]
从指定安装源创建新虚拟机。
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--connect URI 通过 libvirt URI 连接到虚拟机管理程序
通用选项:
-n NAME, --name NAME 客户机实例名称
--memory MEMORY Configure guest memory allocation. Ex:
--memory 1024 (in MiB)
--memory memory=1024,currentMemory=512
--vcpus VCPUS Number of vcpus to configure for your guest. Ex:
--vcpus 5
--vcpus 5,maxvcpus=10,cpuset=1-4,6,8
--vcpus sockets=2,cores=4,threads=2
--cpu CPU CPU model and features. Ex:
--cpu coreduo,+x2apic
--cpu host-passthrough
--cpu host
--metadata METADATA 配置客户机元数据。例如:
--metadata name=foo,title="My pretty title",uuid=...
--metadata description="My nice long description"
安装方法选项:
--cdrom CDROM 光驱安装介质
-l LOCATION, --location LOCATION
Distro install URL, eg. https://host/path. See man
page for specific distro examples.
--pxe 使用 PXE 协议从网络引导
--import 在已有的磁盘镜像中构建客户机
-x EXTRA_ARGS, --extra-args EXTRA_ARGS
将附加参数添加到由 --location 引导的内核中
--initrd-inject INITRD_INJECT
添加指定文件到由 --location 指定的 initrd 根中
--unattended [UNATTENDED]
Perform an unattended installation
--install INSTALL Specify fine grained install options
--boot BOOT 配置客户机引导设置。例如:
--boot hd,cdrom,menu=on
--boot init=/sbin/init (针对容器)
--idmap IDMAP Enable user namespace for LXC container. Ex:
--idmap uid.start=0,uid.target=1000,uid.count=10
OS options:
--os-variant OS_VARIANT
The OS being installed in the guest.
This is used for deciding optimal defaults like virtio.
Example values: fedora29, rhel7.0, win10, ...
See 'osinfo-query os' for a full list.
设备选项:
--disk DISK 指定存储的各种选项。例如:
--disk size=10 (在默认位置创建 10GiB 镜像)
--disk /my/existing/disk,cache=none
--disk device=cdrom,bus=scsi
--disk=?
-w NETWORK, --network NETWORK
配置客户机网络接口。例如:
--network bridge=mybr0
--network network=my_libvirt_virtual_net
--network network=mynet,model=virtio,mac=00:11...
--network none
--network help
--graphics GRAPHICS Configure guest display settings. Ex:
--graphics spice
--graphics vnc,port=5901,listen=0.0.0.0
--graphics none
--controller CONTROLLER
Configure a guest controller device. Ex:
--controller type=usb,model=qemu-xhci
--controller virtio-scsi
--input INPUT 配置客户机输入设备。例如:
--input tablet
--input keyboard,bus=usb
--serial SERIAL 配置客户机串口设备
--parallel PARALLEL 配置客户机并口设备
--channel CHANNEL 配置客户机通信通道
--console CONSOLE 配置文本控制台连接主机与客户机
--hostdev HOSTDEV 配置物理 USB/PCI 等主机设备与客户机共享
--filesystem FILESYSTEM
传递主机目录到客户机。例如:
--filesystem /my/source/dir,/dir/in/guest
--filesystem template_name,/,type=template
--sound [SOUND] 配置客户机声音设备仿真
--watchdog WATCHDOG 配置客户机 watchdog 设备
--video VIDEO 配置客户机视频硬件。
--smartcard SMARTCARD
配置客户机智能卡设备。例如:
--smartcard mode=passthrough
--redirdev REDIRDEV 配置客户机重定向设备。例如:
--redirdev usb,type=tcp,server=192.168.1.1:4000
--memballoon MEMBALLOON
配置客户机 memballoon 设备。例如:
--memballoon model=virtio
--tpm TPM 配置客户机 TPM 设备。例如:
--tpm /dev/tpm
--rng RNG Configure a guest RNG device. Ex:
--rng /dev/urandom
--panic PANIC 配置客户机 panic 设备。例如:
--panic default
--memdev MEMDEV Configure a guest memory device. Ex:
--memdev dimm,target.size=1024
--vsock VSOCK Configure guest vsock sockets. Ex:
--vsock cid.auto=yes
--vsock cid.address=7
客户机配置选项:
--iothreads IOTHREADS
Set domain <iothreads> and <iothreadids>
configuration.
--seclabel SECLABEL, --security SECLABEL
Set domain seclabel configuration.
--cputune CPUTUNE Tune CPU parameters for the domain process.
--numatune NUMATUNE 为域进程调整 NUMA 策略。
--memtune MEMTUNE 为域进程调整内存策略。
--blkiotune BLKIOTUNE
为域进程调整 blkio 策略。
--memorybacking MEMORYBACKING
为域进程设置内存后备策略。例如:
--memorybacking hugepages=on
--features FEATURES Set domain <features> XML. Ex:
--features acpi=off
--features apic=on,apic.eoi=on
--clock CLOCK 设置域 <clock> XML。例如:
--clock offset=localtime,rtc_tickpolicy=catchup
--pm PM 配置 VM 电源管理功能
--events EVENTS 配置 VM 生命周期管理策略
--resource RESOURCE 配置 VM 资源分
本文标签: kvm
版权声明:本文标题:KVM 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1727200215a1102038.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论