SST Lab Dokuwiki Header header picture

ユーザ用ツール

サイト用ツール


linux:kvm_install

文書の過去の版を表示しています。


KVMのインストール

以下の記事を参考に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 -y qemu 
$ sudo apt install -y qemu-kvm 
$ sudo apt install -y libvirt-daemon 
$ sudo apt install -y libvirt-clients 
$ sudo apt install -y bridge-utils 
$ sudo apt install -y virt-manager
$ virsh list
 Id   Name   State
--------------------
 
$ qemu-img
qemu-img: Not enough arguments
Try 'qemu-img --help' for more information
$ 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 systemctl status libvirtd
● libvirtd.service - Virtualization daemon
     Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor pres>
     Active: active (running) since Wed 2021-02-24 02:09:55 UTC; 4min 5s ago
TriggeredBy: ● libvirtd.socket
             ● libvirtd-admin.socket
             ● libvirtd-ro.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
   Main PID: 7856 (libvirtd)
      Tasks: 19 (limit: 32768)
     Memory: 19.3M
     CGroup: /system.slice/libvirtd.service
             ├─7856 /usr/sbin/libvirtd
             ├─8267 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa>
             └─8268 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa>
 
Feb 24 02:09:56 sstw dnsmasq[8267]: compile time options: IPv6 GNU-getopt DBus >
Feb 24 02:09:56 sstw dnsmasq-dhcp[8267]: DHCP, IP range 192.168.122.2 -- 192.16>
Feb 24 02:09:56 sstw dnsmasq-dhcp[8267]: DHCP, sockets bound exclusively to int>
Feb 24 02:09:56 sstw dnsmasq[8267]: reading /etc/resolv.conf
Feb 24 02:09:56 sstw dnsmasq[8267]: using nameserver 127.0.0.53#53
Feb 24 02:09:56 sstw dnsmasq[8267]: read /etc/hosts - 7 addresses
Feb 24 02:09:56 sstw dnsmasq[8267]: read /var/lib/libvirt/dnsmasq/default.addnh>
Feb 24 02:09:56 sstw dnsmasq-dhcp[8267]: read /var/lib/libvirt/dnsmasq/default.>
Feb 24 02:09:56 sstw dnsmasq[8267]: reading /etc/resolv.conf
Feb 24 02:09:56 sstw dnsmasq[8267]: 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.
$
  1. Finderから「サーバへ接続」
  2. vnc:/ / <サーバのIPアドレス>/
linux/kvm_install.1614138293.txt.gz · 最終更新: 2022/08/23 13:34 (外部編集)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki