Ubuntu 18.04 Desktopを入れた、Sandy Bridge世代のIntel i7-2600搭載のLenovo ThinkCentre Edge91へ、 KVM / QEMU 仮想マシンホストをセットアップし、その中のUbuntu 20.04サーバを入れた仮想マシンに、 XAMPP を使って簡単に自分専用 Web開発環境 を構築してみました。
ハードウェア確認
これまでにも何度かHDD交換しながら使い続けているLenovo ThinkCentre Edge 91 (1855G3B)を次のCPUとRAM構成で使用しています。
- CPU: Intel Core i7-2600 @3.4GHz
- RAM: 12GB
Ubuntuはアップグレードしようしようと思いつつも先延ばしで、未だに18.04 LTS Desktopです。
1 2 3 4 5 6 |
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic |
先ずはCPUがハードウェア仮想化に対応しているか、既にVMware Workstationが入っているので今更ですが、あらためて確認してみます(戻り値が0より大きければ有効)。
1 2 |
$ grep -Eoc '(vmx|svm)' /proc/cpuinfo 8 |
続いてBIOSの仮想化関連項目が有効になっているかどうか確認するために、 cpu-checker パッケージをインストールします。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$ sudo apt install cpu-checker パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: msr-tools 以下のパッケージが新たにインストールされます: cpu-checker msr-tools アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 2 個。 16.6 kB のアーカイブを取得する必要があります。 この操作後に追加で 62.5 kB のディスク容量が消費されます。 続行しますか? [Y/n] y 取得:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 msr-tools amd64 1.3-2build1 [9,760 B] 取得:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 cpu-checker amd64 0.7-0ubuntu7 [6,862 B] 16.6 kB を 1秒 で取得しました (12.1 kB/s) 以前に未選択のパッケージ msr-tools を選択しています。 (データベースを読み込んでいます ... 現在 570779 個のファイルとディレクトリがインストールされています。) .../msr-tools_1.3-2build1_amd64.deb を展開する準備をしています ... msr-tools (1.3-2build1) を展開しています... 以前に未選択のパッケージ cpu-checker を選択しています。 .../cpu-checker_0.7-0ubuntu7_amd64.deb を展開する準備をしています ... cpu-checker (0.7-0ubuntu7) を展開しています... msr-tools (1.3-2build1) を設定しています ...cpu-checker (0.7-0ubuntu7) を設定しています ... man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ... |
パッケージに含まれる kvm-ok ツールを使っての検証は、次の結果を得て問題無いことが確認されました。
1 2 3 |
$ kvm-ok INFO: /dev/kvm exists KVM acceleration can be used |
KVMのインストール
必要なパッケージを apt でインストールします。付随パッケージが多いのですが、エラーなくインストールは終わりました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
user@WS-0300u:~$ sudo apt install qemu-kvm libvirt-bin bridge-utils virtinst virt-manager パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: augeas-lenses dmeventd ebtables gir1.2-gtk-vnc-2.0 gir1.2-libosinfo-1.0 gir1.2-libvirt-glib-1.0 gir1.2-spiceclientglib-2.0 gir1.2-spiceclientgtk-3.0 ipxe-qemu ipxe-qemu-256k-compat-efi-roms libaugeas0 libdevmapper-event1.02.1 libfdt1 libgovirt-common libgovirt2 libiscsi7 liblvm2app2.2 liblvm2cmd2.02 libnetcf1 libosinfo-1.0-0 libreadline5 libspice-server1 libvirt-clients libvirt-daemon libvirt-daemon-driver-storage-rbd libvirt-daemon-system libvirt-glib-1.0-0 libvirt0 libxen-4.9 libxenstore3.0 libxml2-utils lvm2 osinfo-db python-certifi python-chardet python-ipaddr python-libvirt python-libxml2 python-openssl python-requests python-urllib3 qemu-block-extra qemu-system-common qemu-system-x86 qemu-utils seabios sharutils virt-viewer 提案パッケージ: augeas-doc augeas-tools libosinfo-l10n libvirt-daemon-driver-storage-gluster libvirt-daemon-driver-storage-sheepdog libvirt-daemon-driver-storage-zfs numad radvd auditd systemtap nfs-common zfsutils thin-provisioning-tools python-openssl-doc python-openssl-dbg python-socks python-ntlm vde2 sgabios ovmf debootstrap sharutils-doc ssh-askpass python-guestfs以下のパッケージが新たにインストールされます: augeas-lenses bridge-utils dmeventd ebtables gir1.2-gtk-vnc-2.0 gir1.2-libosinfo-1.0 gir1.2-libvirt-glib-1.0 gir1.2-spiceclientglib-2.0 gir1.2-spiceclientgtk-3.0 ipxe-qemu ipxe-qemu-256k-compat-efi-roms libaugeas0 libdevmapper-event1.02.1 libfdt1 libgovirt-common libgovirt2 libiscsi7 liblvm2app2.2 liblvm2cmd2.02 libnetcf1 libosinfo-1.0-0 libreadline5 libspice-server1 libvirt-bin libvirt-clients libvirt-daemon libvirt-daemon-driver-storage-rbd libvirt-daemon-system libvirt-glib-1.0-0 libvirt0 libxen-4.9 libxenstore3.0 libxml2-utils lvm2 osinfo-db python-certifi python-chardet python-ipaddr python-libvirt python-libxml2 python-openssl python-requests python-urllib3 qemu-block-extra qemu-kvm qemu-system-common qemu-system-x86 qemu-utils seabios sharutils virt-manager virt-viewer virtinst アップグレード: 0 個、新規インストール: 53 個、削除: 0 個、保留: 2 個。 18.7 MB のアーカイブを取得する必要があります。 この操作後に追加で 85.7 MB のディスク容量が消費されます。 続行しますか? [Y/n] y 取得:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvirt0 amd64 4.0.0-1ubuntu8.19 [1,249 kB] 取得:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvirt-clients amd64 4.0.0-1ubuntu8.19 [595 kB] 取得:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 augeas-lenses all 1.10.1-2 [300 kB] 取得:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaugeas0 amd64 1.10.1-2 [159 kB] 取得:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnetcf1 amd64 1:0.2.8-1ubuntu2 [46.4 kB] 取得:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxenstore3.0 amd64 4.9.2-0ubuntu1 [19.7 kB] 取得:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxen-4.9 amd64 4.9.2-0ubuntu1 [399 kB] 取得:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvirt-daemon amd64 4.0.0-1ubuntu8.19 [2,175 kB] 取得:9 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvirt-daemon-system amd64 4.0.0-1ubuntu8.19 [80.8 kB] 取得:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 libiscsi7 amd64 1.17.0-1.1 [55.4 kB] 取得:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 qemu-block-extra amd64 1:2.11+dfsg-1ubuntu7.36 [40.5 kB] 取得:12 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 qemu-system-common amd64 1:2.11+dfsg-1ubuntu7.36 [672 kB] 取得:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 bridge-utils amd64 1.5-15ubuntu1 [30.1 kB] 取得:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdevmapper-event1.02.1 amd64 2:1.02.145-4.1ubuntu3.18.04.3 [10.9 kB] 取得:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 liblvm2cmd2.02 amd64 2.02.176-4.1ubuntu3.18.04.3 [584 kB] 取得:16 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 dmeventd amd64 2:1.02.145-4.1ubuntu3.18.04.3 [30.4 kB] 取得:18 http://archive.ubuntu.com/ubuntu bionic/universe amd64 gir1.2-gtk-vnc-2.0 amd64 0.7.2-1 [10.3 kB] 取得:19 http://archive.ubuntu.com/ubuntu bionic/universe amd64 gir1.2-spiceclientglib-2.0 amd64 0.34-1.1build1 [11.9 kB] 取得:20 http://archive.ubuntu.com/ubuntu bionic/universe amd64 gir1.2-spiceclientgtk-3.0 amd64 0.34-1.1build1 [5,548 B] 取得:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 ipxe-qemu all 1.0.0+git-20180124.fbe8c52d-0ubuntu2.2 [912 kB] 取得:22 http://archive.ubuntu.com/ubuntu bionic/main amd64 ipxe-qemu-256k-compat-efi-roms all 1.0.0+git-20150424.a25a16d-0ubuntu2 [545 kB] 取得:23 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgovirt-common all 0.3.4-2 [14.1 kB] 取得:24 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgovirt2 amd64 0.3.4-2 [35.0 kB] 取得:25 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 liblvm2app2.2 amd64 2.02.176-4.1ubuntu3.18.04.3 [432 kB] 取得:26 http://archive.ubuntu.com/ubuntu bionic/main amd64 libreadline5 amd64 5.2+dfsg-3build1 [99.5 kB] 取得:27 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libspice-server1 amd64 0.14.0-1ubuntu2.5 [345 kB] 取得:28 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvirt-bin amd64 4.0.0-1ubuntu8.19 [5,808 B] 取得:29 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libvirt-daemon-driver-storage-rbd amd64 4.0.0-1ubuntu8.19 [15.4 kB] 取得:30 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxml2-utils amd64 2.9.4+dfsg1-6.1ubuntu1.4 [35.8 kB] 取得:31 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 lvm2 amd64 2.02.176-4.1ubuntu3.18.04.3 [929 kB] 取得:32 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 osinfo-db all 0.20180929-1ubuntu0.1 [76.7 kB] 取得:33 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-certifi all 2018.1.18-2 [144 kB] 取得:34 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-chardet all 3.0.4-1 [80.3 kB] 取得:35 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-ipaddr all 2.2.0-1 [15.5 kB] 取得:36 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-libvirt amd64 4.0.0-1 [120 kB] 取得:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python-libxml2 amd64 2.9.4+dfsg1-6.1ubuntu1.4 [141 kB] 取得:38 http://archive.ubuntu.com/ubuntu bionic/main amd64 python-openssl all 17.5.0-1ubuntu1 [41.3 kB] 取得:39 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python-urllib3 all 1.22-1ubuntu0.18.04.2 [86.0 kB] 取得:40 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 python-requests all 2.18.4-2ubuntu0.1 [58.5 kB] 取得:41 http://archive.ubuntu.com/ubuntu bionic/main amd64 libfdt1 amd64 1.4.5-3 [15.7 kB] 取得:42 http://archive.ubuntu.com/ubuntu bionic/main amd64 seabios all 1.10.2-1ubuntu1 [128 kB] 取得:43 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 qemu-system-x86 amd64 1:2.11+dfsg-1ubuntu7.36 [5,176 kB] 取得:44 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 qemu-kvm amd64 1:2.11+dfsg-1ubuntu7.36 [13.2 kB] 取得:45 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 qemu-utils amd64 1:2.11+dfsg-1ubuntu7.36 [870 kB] 85% [45 qemu-utils 1,281 B/870 kB 0%] 1,019 kB/s 2\E7\A7 取得:47 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libvirt-glib-1.0-0 amd64 1.0.0-1 [111 kB] 取得:48 http://archive.ubuntu.com/ubuntu bionic/universe amd64 gir1.2-libvirt-glib-1.0 amd64 1.0.0-1 [26.9 kB] 取得:49 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libosinfo-1.0-0 amd64 1.1.0-1 [68.5 kB] 取得:50 http://archive.ubuntu.com/ubuntu bionic/universe amd64 gir1.2-libosinfo-1.0 amd64 1.1.0-1 [14.2 kB] 取得:51 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 virtinst all 1:1.5.1-0ubuntu1.2 [177 kB] 取得:52 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 virt-manager all 1:1.5.1-0ubuntu1.2 [1,005 kB] 取得:53 http://archive.ubuntu.com/ubuntu bionic/universe amd64 virt-viewer amd64 6.0-2 [256 kB] 18.7 MB を 23秒 で取得しました (799 kB/s) パッケージからテンプレートを展開しています: 100% パッケージを事前設定しています ... 以前に未選択のパッケージ libvirt0:amd64 を選択しています。 (データベースを読み込んでいます ... 現在 570793 個のファイルとディレクトリがインストールされています。) .../00-libvirt0_4.0.0-1ubuntu8.19_amd64.deb を展開する準備をしています ... libvirt0:amd64 (4.0.0-1ubuntu8.19) を展開しています... 以前に未選択のパッケージ libvirt-clients を選択しています。 .../01-libvirt-clients_4.0.0-1ubuntu8.19_amd64.deb を展開する準備をしています ... libvirt-clients (4.0.0-1ubuntu8.19) を展開しています... 以前に未選択のパッケージ augeas-lenses を選択しています。 .../02-augeas-lenses_1.10.1-2_all.deb を展開する準備をしています ... augeas-lenses (1.10.1-2) を展開しています... 以前に未選択のパッケージ libaugeas0:amd64 を選択しています。 .../03-libaugeas0_1.10.1-2_amd64.deb を展開する準備をしています ... libaugeas0:amd64 (1.10.1-2) を展開しています... 以前に未選択のパッケージ libnetcf1:amd64 を選択しています。 .../04-libnetcf1_1%3a0.2.8-1ubuntu2_amd64.deb を展開する準備をしています ... libnetcf1:amd64 (1:0.2.8-1ubuntu2) を展開しています... 以前に未選択のパッケージ libxenstore3.0:amd64 を選択しています。 .../05-libxenstore3.0_4.9.2-0ubuntu1_amd64.deb を展開する準備をしています ... libxenstore3.0:amd64 (4.9.2-0ubuntu1) を展開しています... 以前に未選択のパッケージ libxen-4.9:amd64 を選択しています。 .../06-libxen-4.9_4.9.2-0ubuntu1_amd64.deb を展開する準備をしています ...libxen-4.9:amd64 (4.9.2-0ubuntu1) を展開しています... 以前に未選択のパッケージ libvirt-daemon を選択しています。 .../07-libvirt-daemon_4.0.0-1ubuntu8.19_amd64.deb を展開する準備をしています ... libvirt-daemon (4.0.0-1ubuntu8.19) を展開しています... 以前に未選択のパッケージ libvirt-daemon-system を選択しています。 .../08-libvirt-daemon-system_4.0.0-1ubuntu8.19_amd64.deb を展開する準備をしています ... libvirt-daemon-system (4.0.0-1ubuntu8.19) を展開しています... 以前に未選択のパッケージ libiscsi7:amd64 を選択しています。 .../09-libiscsi7_1.17.0-1.1_amd64.deb を展開する準備をしています ... libiscsi7:amd64 (1.17.0-1.1) を展開しています... 以前に未選択のパッケージ qemu-block-extra:amd64 を選択しています。 .../10-qemu-block-extra_1%3a2.11+dfsg-1ubuntu7.36_amd64.deb を展開する準備をしています ... qemu-block-extra:amd64 (1:2.11+dfsg-1ubuntu7.36) を展開しています... 以前に未選択のパッケージ qemu-system-common を選択しています。 .../11-qemu-system-common_1%3a2.11+dfsg-1ubuntu7.36_amd64.deb を展開する準備をしています ... qemu-system-common (1:2.11+dfsg-1ubuntu7.36) を展開しています... 以前に未選択のパッケージ bridge-utils を選択しています。 .../12-bridge-utils_1.5-15ubuntu1_amd64.deb を展開する準備をしています ... bridge-utils (1.5-15ubuntu1) を展開しています... 以前に未選択のパッケージ libdevmapper-event1.02.1:amd64 を選択しています。 .../13-libdevmapper-event1.02.1_2%3a1.02.145-4.1ubuntu3.18.04.3_amd64.deb を展開する準備をしています ... libdevmapper-event1.02.1:amd64 (2:1.02.145-4.1ubuntu3.18.04.3) を展開しています... 以前に未選択のパッケージ liblvm2cmd2.02:amd64 を選択しています。 .../14-liblvm2cmd2.02_2.02.176-4.1ubuntu3.18.04.3_amd64.deb を展開する準備をしています ... liblvm2cmd2.02:amd64 (2.02.176-4.1ubuntu3.18.04.3) を展開しています... 以前に未選択のパッケージ dmeventd を選択しています。 .../15-dmeventd_2%3a1.02.145-4.1ubuntu3.18.04.3_amd64.deb を展開する準備をしています ... dmeventd (2:1.02.145-4.1ubuntu3.18.04.3) を展開しています... 以前に未選択のパッケージ ebtables を選択しています。 .../16-ebtables_2.0.10.4-3.5ubuntu2.18.04.3_amd64.deb を展開する準備をしています ... ebtables (2.0.10.4-3.5ubuntu2.18.04.3) を展開しています... 以前に未選択のパッケージ gir1.2-gtk-vnc-2.0:amd64 を選択しています。.../17-gir1.2-gtk-vnc-2.0_0.7.2-1_amd64.deb を展開する準備をしています ... gir1.2-gtk-vnc-2.0:amd64 (0.7.2-1) を展開しています... 以前に未選択のパッケージ gir1.2-spiceclientglib-2.0:amd64 を選択しています。 .../18-gir1.2-spiceclientglib-2.0_0.34-1.1build1_amd64.deb を展開する準備をしています ... gir1.2-spiceclientglib-2.0:amd64 (0.34-1.1build1) を展開しています... 以前に未選択のパッケージ gir1.2-spiceclientgtk-3.0:amd64 を選択しています。 .../19-gir1.2-spiceclientgtk-3.0_0.34-1.1build1_amd64.deb を展開する準備をしています ... gir1.2-spiceclientgtk-3.0:amd64 (0.34-1.1build1) を展開しています... 以前に未選択のパッケージ ipxe-qemu を選択しています。 .../20-ipxe-qemu_1.0.0+git-20180124.fbe8c52d-0ubuntu2.2_all.deb を展開する準備をしています ... ipxe-qemu (1.0.0+git-20180124.fbe8c52d-0ubuntu2.2) を展開しています... 以前に未選択のパッケージ ipxe-qemu-256k-compat-efi-roms を選択しています。 .../21-ipxe-qemu-256k-compat-efi-roms_1.0.0+git-20150424.a25a16d-0ubuntu2_all.deb を展開する準備をしています ... ipxe-qemu-256k-compat-efi-roms (1.0.0+git-20150424.a25a16d-0ubuntu2) を展開しています... 以前に未選択のパッケージ libgovirt-common を選択しています。 .../22-libgovirt-common_0.3.4-2_all.deb を展開する準備をしています ... libgovirt-common (0.3.4-2) を展開しています... 以前に未選択のパッケージ libgovirt2:amd64 を選択しています。 .../23-libgovirt2_0.3.4-2_amd64.deb を展開する準備をしています ... libgovirt2:amd64 (0.3.4-2) を展開しています... 以前に未選択のパッケージ liblvm2app2.2:amd64 を選択しています。 .../24-liblvm2app2.2_2.02.176-4.1ubuntu3.18.04.3_amd64.deb を展開する準備をしています ... liblvm2app2.2:amd64 (2.02.176-4.1ubuntu3.18.04.3) を展開しています... 以前に未選択のパッケージ libreadline5:amd64 を選択しています。 .../25-libreadline5_5.2+dfsg-3build1_amd64.deb を展開する準備をしています ... libreadline5:amd64 (5.2+dfsg-3build1) を展開しています... 以前に未選択のパッケージ libspice-server1:amd64 を選択しています。 .../26-libspice-server1_0.14.0-1ubuntu2.5_amd64.deb を展開する準備をしています ... libspice-server1:amd64 (0.14.0-1ubuntu2.5) を展開しています... 以前に未選択のパッケージ libvirt-bin を選択しています。 .../27-libvirt-bin_4.0.0-1ubuntu8.19_amd64.deb を展開する準備をしています ... libvirt-bin (4.0.0-1ubuntu8.19) を展開しています...以前に未選択のパッケージ libvirt-daemon-driver-storage-rbd を選択しています。 .../28-libvirt-daemon-driver-storage-rbd_4.0.0-1ubuntu8.19_amd64.deb を展開する準備をしています ... libvirt-daemon-driver-storage-rbd (4.0.0-1ubuntu8.19) を展開しています... 以前に未選択のパッケージ libxml2-utils を選択しています。 .../29-libxml2-utils_2.9.4+dfsg1-6.1ubuntu1.4_amd64.deb を展開する準備をしています ... libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.4) を展開しています... 以前に未選択のパッケージ lvm2 を選択しています。 .../30-lvm2_2.02.176-4.1ubuntu3.18.04.3_amd64.deb を展開する準備をしています ... lvm2 (2.02.176-4.1ubuntu3.18.04.3) を展開しています... 以前に未選択のパッケージ osinfo-db を選択しています。 .../31-osinfo-db_0.20180929-1ubuntu0.1_all.deb を展開する準備をしています ... osinfo-db (0.20180929-1ubuntu0.1) を展開しています... 以前に未選択のパッケージ python-certifi を選択しています。 .../32-python-certifi_2018.1.18-2_all.deb を展開する準備をしています ... python-certifi (2018.1.18-2) を展開しています... 以前に未選択のパッケージ python-chardet を選択しています。 .../33-python-chardet_3.0.4-1_all.deb を展開する準備をしています ... python-chardet (3.0.4-1) を展開しています... 以前に未選択のパッケージ python-ipaddr を選択しています。 .../34-python-ipaddr_2.2.0-1_all.deb を展開する準備をしています ... python-ipaddr (2.2.0-1) を展開しています... 以前に未選択のパッケージ python-libvirt を選択しています。 .../35-python-libvirt_4.0.0-1_amd64.deb を展開する準備をしています ... python-libvirt (4.0.0-1) を展開しています... 以前に未選択のパッケージ python-libxml2 を選択しています。 .../36-python-libxml2_2.9.4+dfsg1-6.1ubuntu1.4_amd64.deb を展開する準備をしています ... python-libxml2 (2.9.4+dfsg1-6.1ubuntu1.4) を展開しています... 以前に未選択のパッケージ python-openssl を選択しています。 .../37-python-openssl_17.5.0-1ubuntu1_all.deb を展開する準備をしています ... python-openssl (17.5.0-1ubuntu1) を展開しています... 以前に未選択のパッケージ python-urllib3 を選択しています。 .../38-python-urllib3_1.22-1ubuntu0.18.04.2_all.deb を展開する準備をしています ...python-urllib3 (1.22-1ubuntu0.18.04.2) を展開しています... 以前に未選択のパッケージ python-requests を選択しています。 .../39-python-requests_2.18.4-2ubuntu0.1_all.deb を展開する準備をしています ... python-requests (2.18.4-2ubuntu0.1) を展開しています... 以前に未選択のパッケージ libfdt1:amd64 を選択しています。 .../40-libfdt1_1.4.5-3_amd64.deb を展開する準備をしています ... libfdt1:amd64 (1.4.5-3) を展開しています... 以前に未選択のパッケージ seabios を選択しています。 .../41-seabios_1.10.2-1ubuntu1_all.deb を展開する準備をしています ... seabios (1.10.2-1ubuntu1) を展開しています... 以前に未選択のパッケージ qemu-system-x86 を選択しています。 .../42-qemu-system-x86_1%3a2.11+dfsg-1ubuntu7.36_amd64.deb を展開する準備をしています ... qemu-system-x86 (1:2.11+dfsg-1ubuntu7.36) を展開しています... 以前に未選択のパッケージ qemu-kvm を選択しています。 .../43-qemu-kvm_1%3a2.11+dfsg-1ubuntu7.36_amd64.deb を展開する準備をしています ... qemu-kvm (1:2.11+dfsg-1ubuntu7.36) を展開しています... 以前に未選択のパッケージ qemu-utils を選択しています。 .../44-qemu-utils_1%3a2.11+dfsg-1ubuntu7.36_amd64.deb を展開する準備をしています ... qemu-utils (1:2.11+dfsg-1ubuntu7.36) を展開しています... 以前に未選択のパッケージ sharutils を選択しています。 .../45-sharutils_1%3a4.15.2-3_amd64.deb を展開する準備をしています ... sharutils (1:4.15.2-3) を展開しています... 以前に未選択のパッケージ libvirt-glib-1.0-0:amd64 を選択しています。 .../46-libvirt-glib-1.0-0_1.0.0-1_amd64.deb を展開する準備をしています ... libvirt-glib-1.0-0:amd64 (1.0.0-1) を展開しています... 以前に未選択のパッケージ gir1.2-libvirt-glib-1.0:amd64 を選択しています。 .../47-gir1.2-libvirt-glib-1.0_1.0.0-1_amd64.deb を展開する準備をしています ... gir1.2-libvirt-glib-1.0:amd64 (1.0.0-1) を展開しています... 以前に未選択のパッケージ libosinfo-1.0-0:amd64 を選択しています。 .../48-libosinfo-1.0-0_1.1.0-1_amd64.deb を展開する準備をしています ... libosinfo-1.0-0:amd64 (1.1.0-1) を展開しています... 以前に未選択のパッケージ gir1.2-libosinfo-1.0:amd64 を選択しています。.../49-gir1.2-libosinfo-1.0_1.1.0-1_amd64.deb を展開する準備をしています ... gir1.2-libosinfo-1.0:amd64 (1.1.0-1) を展開しています... 以前に未選択のパッケージ virtinst を選択しています。 .../50-virtinst_1%3a1.5.1-0ubuntu1.2_all.deb を展開する準備をしています ... virtinst (1:1.5.1-0ubuntu1.2) を展開しています... 以前に未選択のパッケージ virt-manager を選択しています。 .../51-virt-manager_1%3a1.5.1-0ubuntu1.2_all.deb を展開する準備をしています ... virt-manager (1:1.5.1-0ubuntu1.2) を展開しています... 以前に未選択のパッケージ virt-viewer を選択しています。 .../52-virt-viewer_6.0-2_amd64.deb を展開する準備をしています ... virt-viewer (6.0-2) を展開しています... seabios (1.10.2-1ubuntu1) を設定しています ... gir1.2-spiceclientglib-2.0:amd64 (0.34-1.1build1) を設定しています ... ipxe-qemu-256k-compat-efi-roms (1.0.0+git-20150424.a25a16d-0ubuntu2) を設定しています ... python-urllib3 (1.22-1ubuntu0.18.04.2) を設定しています ... libspice-server1:amd64 (0.14.0-1ubuntu2.5) を設定しています ... python-chardet (3.0.4-1) を設定しています ... python-openssl (17.5.0-1ubuntu1) を設定しています ... python-ipaddr (2.2.0-1) を設定しています ... libgovirt-common (0.3.4-2) を設定しています ... libvirt0:amd64 (4.0.0-1ubuntu8.19) を設定しています ... sharutils (1:4.15.2-3) を設定しています ... libiscsi7:amd64 (1.17.0-1.1) を設定しています ... python-certifi (2018.1.18-2) を設定しています ... libxml2-utils (2.9.4+dfsg1-6.1ubuntu1.4) を設定しています ... libxenstore3.0:amd64 (4.9.2-0ubuntu1) を設定しています ... qemu-block-extra:amd64 (1:2.11+dfsg-1ubuntu7.36) を設定しています ... qemu-utils (1:2.11+dfsg-1ubuntu7.36) を設定しています ... bridge-utils (1.5-15ubuntu1) を設定しています ... libdevmapper-event1.02.1:amd64 (2:1.02.145-4.1ubuntu3.18.04.3) を設定しています ... osinfo-db (0.20180929-1ubuntu0.1) を設定しています ... gir1.2-spiceclientgtk-3.0:amd64 (0.34-1.1build1) を設定しています ...libvirt-glib-1.0-0:amd64 (1.0.0-1) を設定しています ... augeas-lenses (1.10.1-2) を設定しています ... ebtables (2.0.10.4-3.5ubuntu2.18.04.3) を設定しています ... Created symlink /etc/systemd/system/multi-user.target.wants/ebtables.service → /lib/systemd/system/ebtables.service. update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults python-libxml2 (2.9.4+dfsg1-6.1ubuntu1.4) を設定しています ... gir1.2-gtk-vnc-2.0:amd64 (0.7.2-1) を設定しています ... python-requests (2.18.4-2ubuntu0.1) を設定しています ... liblvm2app2.2:amd64 (2.02.176-4.1ubuntu3.18.04.3) を設定しています ... libxen-4.9:amd64 (4.9.2-0ubuntu1) を設定しています ... libreadline5:amd64 (5.2+dfsg-3build1) を設定しています ... libvirt-clients (4.0.0-1ubuntu8.19) を設定しています ... libgovirt2:amd64 (0.3.4-2) を設定しています ... ipxe-qemu (1.0.0+git-20180124.fbe8c52d-0ubuntu2.2) を設定しています ... libfdt1:amd64 (1.4.5-3) を設定しています ... qemu-system-common (1:2.11+dfsg-1ubuntu7.36) を設定しています ... Created symlink /etc/systemd/system/multi-user.target.wants/qemu-kvm.service → /lib/systemd/system/qemu-kvm.service. gir1.2-libvirt-glib-1.0:amd64 (1.0.0-1) を設定しています ... libosinfo-1.0-0:amd64 (1.1.0-1) を設定しています ... virt-viewer (6.0-2) を設定しています ... update-alternatives: /usr/bin/spice-xpi-client (spice-xpi-client) を提供するために自動モードで /usr/bin/spice-xpi-client-remote-viewer を使います gir1.2-libosinfo-1.0:amd64 (1.1.0-1) を設定しています ... python-libvirt (4.0.0-1) を設定しています ... libaugeas0:amd64 (1.10.1-2) を設定しています ... qemu-system-x86 (1:2.11+dfsg-1ubuntu7.36) を設定しています ... virtinst (1:1.5.1-0ubuntu1.2) を設定しています ... libnetcf1:amd64 (1:0.2.8-1ubuntu2) を設定しています ... qemu-kvm (1:2.11+dfsg-1ubuntu7.36) を設定しています ... libvirt-daemon (4.0.0-1ubuntu8.19) を設定しています ... virt-manager (1:1.5.1-0ubuntu1.2) を設定しています ... libvirt-daemon-system (4.0.0-1ubuntu8.19) を設定しています ...ユーザ libvirt-qemu をグループ libvirt-qemu に追加 Enabling libvirt default network Created symlink /etc/systemd/system/multi-user.target.wants/libvirt-guests.service → /lib/systemd/system/libvirt-guests.service. Created symlink /etc/systemd/system/libvirt-bin.service → /lib/systemd/system/libvirtd.service. Created symlink /etc/systemd/system/multi-user.target.wants/libvirtd.service → /lib/systemd/system/libvirtd.service. Created symlink /etc/systemd/system/sockets.target.wants/virtlockd.socket → /lib/systemd/system/virtlockd.socket. Created symlink /etc/systemd/system/sockets.target.wants/virtlogd.socket → /lib/systemd/system/virtlogd.socket. virtlockd.service is a disabled or a static unit, not starting it. Setting up libvirt-daemon dnsmasq configuration. libvirt-daemon-driver-storage-rbd (4.0.0-1ubuntu8.19) を設定しています ... libvirt-bin (4.0.0-1ubuntu8.19) を設定しています ... liblvm2cmd2.02:amd64 (2.02.176-4.1ubuntu3.18.04.3) を設定しています ... dmeventd (2:1.02.145-4.1ubuntu3.18.04.3) を設定しています ... Created symlink /etc/systemd/system/sockets.target.wants/dm-event.socket → /lib/systemd/system/dm-event.socket. dm-event.service is a disabled or a static unit, not starting it. lvm2 (2.02.176-4.1ubuntu3.18.04.3) を設定しています ... update-initramfs: deferring update (trigger activated) Created symlink /etc/systemd/system/sysinit.target.wants/blk-availability.service → /lib/systemd/system/blk-availability.service. Created symlink /etc/systemd/system/sysinit.target.wants/lvm2-monitor.service → /lib/systemd/system/lvm2-monitor.service. Created symlink /etc/systemd/system/sysinit.target.wants/lvm2-lvmetad.socket → /lib/systemd/system/lvm2-lvmetad.socket. Created symlink /etc/systemd/system/sysinit.target.wants/lvm2-lvmpolld.socket → /lib/systemd/system/lvm2-lvmpolld.socket. libglib2.0-0:amd64 (2.56.4-0ubuntu0.18.04.8) のトリガを処理しています ... libglib2.0-0:i386 (2.56.4-0ubuntu0.18.04.8) のトリガを処理しています ... bamfdaemon (0.5.3+18.04.20180207.2-0ubuntu1) のトリガを処理しています ... Rebuilding /usr/share/applications/bamf-2.index... libc-bin (2.27-3ubuntu1.4) のトリガを処理しています ... doc-base (0.10.8) のトリガを処理しています ... doc-base ファイルを 1 個追加 を処理中... scrollkeeper をドキュメントとして登録しています... systemd (237-3ubuntu10.48) のトリガを処理しています ...man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ... shared-mime-info (1.9-2) のトリガを処理しています ... gnome-menus (3.13.3-11ubuntu1.1) のトリガを処理しています ... hicolor-icon-theme (0.17-2) のトリガを処理しています ... gconf2 (3.2.6-4ubuntu1) のトリガを処理しています ... mime-support (3.60ubuntu1) のトリガを処理しています ... ureadahead (0.100.0-21) のトリガを処理しています ... ureadahead will be reprofiled on next reboot desktop-file-utils (0.23-1ubuntu3.18.04.2) のトリガを処理しています ... install-info (6.5.0.dfsg.1-2) のトリガを処理しています ... initramfs-tools (0.130ubuntu3.12) のトリガを処理しています ... update-initramfs: Generating /boot/initrd.img-4.15.0-52-generic |
インストール後、 libvirtd が稼働しているか、 systemctl コマンドで確認してみます。
1 2 3 4 5 6 7 8 9 10 11 12 |
$ sudo systemctl status libvirtd ● libvirtd.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-07-05 23:01:17 HKT; 4min 54s ago Docs: man:libvirtd(8) https://libvirt.org Main PID: 7360 (libvirtd) Tasks: 19 (limit: 32768) CGroup: /system.slice/libvirtd.service ├─7360 /usr/sbin/libvirtd ├─8543 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib └─8545 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib |
ネットワーク面では、インストール時に virbr0 と言うブリッジインターフェイスが追加され、仮想マシンはNATを介してこのインターフェイスから通信することになります。
1 2 3 |
$ brctl show bridge name bridge id STP enabled interfaces virbr0 8000.52540045b64b yes virbr0-nic |
しかしこの状態で、アプリケーションの一覧から仮想マシンマネージャvirt-managerを開いても、サービスが見つからないエラーになります。
ユーザグループに起因するこの問題を解決するために、現在使用中のユーザを関連する次の2つのグループに追加します。
- kvm
- libvirt
1 2 3 4 5 6 7 8 9 10 11 12 |
$ cat /etc/group -略- kvm:x:136: libvirt:x:137: $ sudo usermod -aG libvirt $USER $ sudo usermod -aG kvm $USER $ cat /etc/group -略- kvm:x:136:user libvirt:x:137:user |
追加後はPCを再起動するか、一旦ログアウトしてログインし直す必要があります。
Ubuntu 20.04 Server VM構築
それでは仮想マシンマネージャ上の「+」ボタンを押して、新規仮想マシン作成ウィザードを開きます。OSは予めダウンロードしておいた、Ubuntu 20.04.2 Server のメディアISOファイルをインストールに使うので、まず「ローカルのインストールメディア」を選び、次の遷移でISOイメージファイルのパスを指定します。
サーバ用途なのでRAMやCPUは最小限を割り当て、仮想ストレージも20GBもあれば十分でしょう。
最後に認識しやすい適当な名前を付ければ完成です。ここでネットワークデバイスの種類やインターフェイスを指定することも出来ますが、まだよく使いこなせていないので、今回はデフォルトです。
出来上がった仮想マシンの設定情報は次のように確認出来ます。思っていた以上に多項目なので、様々なOSで試してみたくなります。
仮想マシンを起動して、Ubuntuインストーラによるインストールを始めます。その過程は特に特筆すべきこともないので割愛しますが、仮想ネットワークインターフェイスや仮想ディスク内のパーティション構成も、問題無く構成されました。
仮想マシンマネージャの設定でシステムトレイアイコンを有効にすると、アイコンからプルダウンで仮想マシンを操作出来るようになります。以前、macOSに入れたVMware Fusionにも同様の機能があって、なかなか便利でした。