Hyper-Vの有効化
1.Powershellを管理者として起動する
2.notepadを使ってHyper-V化するためのコマンドを記述する
notepad hyperv.bat
---
pushd "%~dp0"
dir /b %SystemRorot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
---
3.作成したコマンドを実行し、再起動を求められるので再起動する
hyperv.bat
4.起動したら、Win+ R キーを押して「optionalfeatures.exe」と入力して、システム コンポーネントを開き、Hyper-V のチェックボックスを「■」にし、[OK] をクリックします。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/34.png)
ubuntuのインストールイメージをダウンロードしておく
https://jp.ubuntu.com/download/thank-you?version=22.04.2&architecture=amd64&platform=live-server
今回は ubuntu22.04 server のイメージを利用します。
Hyper-Vマネージャーの起動
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/01.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/02.png)
仮想スイッチの作成
Hyper-Vマネージャーの仮想スイッチマネージャーを選択し、ホストマシンと同じネットワークに接続させる。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/00.png)
仮想マシンを作成する
「操作」の「新規」から「仮想マシン」を選択
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/03-1024x648.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/04.png)
仮想マシンの名前とそのイメージデータの保存場所を設定
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/05.png)
UEFIは操作が面倒なのでここは第1世代を選択しました
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/06.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/07.png)
事前に作って置いた「プライベート」のネットワークを使用します。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/7.5.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/08.png)
事前にダウンロードしておいたubuntuのインストールメディアを選択します。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/09.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/10.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/11.png)
起動します。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/12.png)
接続を押してubuntuの画面を確認します
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/13-1024x757.png)
ubuntuをインストールする
日本語が選べなかったのでEnglishにしました…
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/14.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/15.png)
キーボードのレイアウトはJapaneseを選択しました
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/16.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/17.png)
今回は最小でのインストールとします。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/18.png)
今回はサーバなのでIPアドレスを固定で設定しています。ブロードバンドルータなどからDHCPでアドレスを割り当ててもらうでも良ければDHCPを選択してください。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/19.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/20.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/21.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/22.png)
Proxyはありませんので空白にしています。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/23.png)
以下画面ではエラーが出ていますが本来はエラー無しですんなりpassします。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/24.png)
LVMを使ってボリューム管理します。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/25.png)
パーティション構成は提案通り特に触っていません。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/26.png)
作ったばかりのディスクボリュームなので消えるものはないのでそのまま続けて大丈夫です。(既存ボリュームを使って構築されている場合は注意です)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/27.png)
アカウントとパスワードを設定します。記載した内容を忘れないようにしましょう。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/28.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/29.png)
opensshはここでインストールしますが鍵を使った方式はここでは設定していません。必要があれば登録しておいてください。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/30.png)
追加パッケージはここでは選択しません。インストール後 apt update -y した後で必要なものをインストールします。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/31.png)
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/32.png)
再起動をする前に、メディアを取出しておきます。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/35-1024x109.png)
インストールが無事終了したのでRestart Nowします。
![](https://yosshi.snowdrop.asia/wp-content/uploads/2023/05/33.png)
再起動後はsshのホストキー作成などでログインプロンプトが隠れてしまっていますが、Enterキーを押すと現れます。
以上でubuntuのインストール完了です!