备忘录:在alpine上安装kvm

本文介绍了如何在 Alpine Linux 上安装和配置 KVM 虚拟化解决方案,包括安装必备软件包、启动服务、设置网络以及用户权限管理等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文:  https://wiki.alpinelinux.org/wiki/KVM

 
 

KVM is an open source virtualization solution in a kernel module. KVM can virtualize x86, PowerPC, and S390 guests.

Installing KVM

It is possible to install just qemu and libvirt for local management

sudo apk add qemu-system-x86_64 libvirt

but most users will probably want to manage it via a GUI with virt-manager (remotely or not).

sudo apk add libvirt-daemon dbus polkit

If you want to use other disk image formats than raw, you need qemu-img

sudo apk add qemu-img

Enable the KVM kernel module

sudo modprobe kvm-intel

or

sudo modprobe kvm-amd

Service start on boot

Set libvirtd and dbus to start on startup

sudo rc-update add libvirtd sudo rc-update add dbus

Networking

by defaults kvm use bridge to nat vm, if you want network with the default configuration, you need to load the tun module

sudo modprobe tun

but if you prefer bridging kvm over your ethernet interface, you need to make a bridge

Groups and user

Add your user to the follwing groups so you can mange the vms

sudo addgroup user libvirt

PolicyKit for Remote User

In order to use libvirtd to remotely control KVM over ssh PolicyKit needs a .pkla informing it that this is allowed. Write the following file to /etc/polkit-1/localauthority/50-local.d/50-libvirt-ssh-remote-access-policy.pkla

[Remote libvirt SSH access] Identity=unix-group:libvirt Action=org.libvirt.unix.manage ResultAny=yes ResultInactive=yes ResultActive=yes

转载于:https://www.cnblogs.com/jinzhenshui/p/9339617.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值