2020/07/22

Hyper-V and Ubuntu Desktop 20.04 LTS


あまりニーズはないと思いますが、Hyper-V 仮想マシンに Ubuntu Desktop 20.04 LTS をインストールする際の備忘録。



第 2 世代仮想マシンに Ubuntu Desktop 20.04 LTS をインストールする場合。セキュアブートを有効にする場合は「Microsoft UEFI証明機関」にすること。

1) 仮想マシンに Ubuntu Desktop 20.04 LTS を新規インストール。特に何も注意点はない。Hyper-V ドライバー(hv_vmbus、hv_storevsc、hv_netvsc、hv_utils、hid_hyperv、hyperv_keyboad、hhyperv_fb)は標準搭載されている。
2)  OSとアプリを更新する。カーネルを最新バージョンに更新するには...
~$ sudo apt-get update
~$ sudo apt-get update
~$ sudo reboot now

 Hyper-V VSS/KVP/FCOPY Daemon をインストールするには...

~$ sudo apt-get update
~$ sudo apt install linux-tools-generic linux-cloud-tools-generic
~$ sudo reboot now

動作確認
~$ systemctl status hv-kvp-daemon.service
~$ systemctl status hv-vss-daemon.service
~$ systemctl status hv-fcopy-daemon.service
(hv-fcopy-daemon を動かすには仮想マシンの設定の「統合サービス」で「ゲストサービス」のチェックを忘れずに)

画面解像度(既定は1152x864)を例えば 1024x768 に変更するには...

~$ sudo vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="・・・ video=hyperv_fb:1024x768"
~$ sudo update-grub
~$ sudo reboot now

拡張セッションモードを有効にするには(私にはできなかった)

Ubuntu 側で
~$ sudo apt install xrdp
~$ ip address show dev eth0 または hostname -I (IP アドレス確認)
~$ sudo ufw allow 3389
~$ gnome-session-quit --logout --no-prompt  (ログアウト)

Hyper-V ホストの mstsc で RDP 接続できることを確認(Session:Xorg、username:ユーザー名、password:パスワード、カラーマネジメント:キャンセル)、ログオフ。

また Ubuntu 側で
~$ sudo ufw deny 3389 (ネットワーク経由の RDP 接続が不要な場合、ポートを閉じる)
~$ sudo apt-get update
~$ sudo apt install git
~$ git clone https://github.com/Microsoft/linux-vm-tools.git ~/linux-vm-tools
~$ cd ~/linux-vm-tools/ubuntu/18.04/ (20.040 用はない)
~$ sudo chmod +x install.sh
~$ sudo ./install.sh
~$ sudo reboot


Hyper-V ホスト側では HvSocket を有効化し、仮想マシンに再接続(Session:Xorg、username:ユーザー名、password:パスワード、カラーマネジメント:キャンセル)。

PS C:\> Set-VM -VMName <仮想マシン名> -EnhancedSessionTransportType HvSocket


それ用のインストールスクリプト(install.sh)は 16.04 と 18.04 対応しかなく、18.04 にやつでやってみましたが、拡張セッションモードで接続することはできませんでした。

microsoft/linux-vm-tools
https://github.com/microsoft/linux-vm-tools


成功した人もいるらしいので、どうしてもって人は以下を参考にがんばってみて。
Enhanced Session for Ubuntu 20.04 LTS.#117
https://github.com/microsoft/linux-vm-tools/issues/117
How to install Ubuntu 20.04 on Hyper-V with enhanced session
https://medium.com/@francescotonini/how-to-install-ubuntu-20-04-on-hyper-v-with-enhanced-session-b20a269a5fa7

以前のバージョン:
Hyper-V and Ubuntu Desktop 19.04 w/ or w/o Enhanced Session Mode (2019/06/10)
Windows Server 2016/2019 Hyper-V and Ubuntu 18.10 (追記あり) (2019/03/06)
Windows 10 ver 1803 Hyper-V and Ubuntu 18.04 LTS with Enhanced Session Mode (2018/05/30)
Windows Server 2016 Hyper-V and Ubuntu 18.04 LTS (2018/05/29)
Windows Server 2012 R2 Hyper-V and Ubuntu 14.10 Guest (2015/02/06)
Windows Server 2012 R2 Hyper-V and Ubuntu 14.04 LTS Guest (2014/04/18)

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。