linux:kvm_install
文書の過去の版を表示しています。
目次
KVMのインストール
Tecmintの記事を参考にubuntuサーバにKVMをセットアップする。
Step 1: Check Virtualization Support in Ubuntu
$ egrep -c '(vmx|svm)' /proc/cpuinfo 12 $ sudo apt install cpu-checker $ sudo kvm-ok INFO: /dev/kvm exists KVM acceleration can be used $
Step 2: Install KVM on Ubuntu 20.04 LTS
$ sudo apt install libvirt-clients
$ virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # quit
$
$ sudo apt install qemu-utils
$ qemu-img
qemu-img: Not enough arguments
Try 'qemu-img --help' for more information
$
$ sudo apt install qemu-kvm
$ kvm
Unable to init server: Could not connect: Connection refused
Could not access KVM kernel module: Permission denied
qemu-system-x86_64: failed to initialize KVM: Permission denied
$
$ sudo apt install virtinst
$ sudo virsh list
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
$ sudo apt install libvirt-bin
$ sudo apt install qemu
$ sudo apt install qemu-kvm
$ sudo apt install libvirt-bin
$ sudo apt install virt-manager
$ sudo virsh list
Id Name State
--------------------
$ sudo apt install bridge-utils
$
$ sudo systemctl status libvirtd
[sudo] password for kimi:
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor pres>
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor pres>
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor pres>
Active: active (running) since Tue 2021-02-23 07:16:19 UTC; 2min 36s ago
TriggeredBy: ● libvirtd-ro.socket
● libvirtd-admin.socket
● libvirtd.socket
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 982 (libvirtd)
Tasks: 19 (limit: 32768)
Memory: 41.8M
CGroup: /system.slice/libvirtd.service
├─ 982 /usr/sbin/libvirtd
├─1099 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa>
└─1100 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa>
Feb 23 07:16:20 sstw dnsmasq[1099]: compile time options: IPv6 GNU-getopt DBus >
Feb 23 07:16:20 sstw dnsmasq-dhcp[1099]: DHCP, IP range 192.168.122.2 -- 192.16>
Feb 23 07:16:20 sstw dnsmasq-dhcp[1099]: DHCP, sockets bound exclusively to int>
Feb 23 07:16:20 sstw dnsmasq[1099]: reading /etc/resolv.conf
Feb 23 07:16:20 sstw dnsmasq[1099]: using nameserver 127.0.0.53#53
Feb 23 07:16:20 sstw dnsmasq[1099]: read /etc/hosts - 7 addresses
Feb 23 07:16:20 sstw dnsmasq[1099]: read /var/lib/libvirt/dnsmasq/default.addnh>
Feb 23 07:16:20 sstw dnsmasq-dhcp[1099]: read /var/lib/libvirt/dnsmasq/default.>
Feb 23 07:16:20 sstw dnsmasq[1099]: reading /etc/resolv.conf
Feb 23 07:16:20 sstw dnsmasq[1099]: using nameserver 127.0.0.53#53
$
$ lsmod | grep -i kvm
kvm_intel 282624 0
kvm 663552 1 kvm_intel
$
Step 3: Creating a Virtual Machine in Ubuntu
$ qemu-img create -f qcow2 ssp0.qcow2 150G Formatting 'ssp0.qcow2', fmt=qcow2 size=161061273600 cluster_size=65536 lazy_refcounts=off refcount_bits=16 $
~$ virt-install -n ssp0 -r 8192 --disk=ssp0.qcow2,bus=virtio --graphics vnc,password=vnc,listen=0.0.0.0,keymap=ja --noautoconsole -v --boot hd --cdrom ubuntu-20.04.2-live-server-amd64.iso Starting install... Domain installation still in progress. You can reconnect to the console to complete the installation process. $
- Finderから「サーバへ接続」
- vnc:/ / <サーバのIPアドレス>/
linux/kvm_install.1614131993.txt.gz · 最終更新: (外部編集)