This time, create it in the following environment. Please read the contents according to the environment.
-Create a VM image directly in C: \ VM \ testvm01 on Windows 10 using WSL (Ubuntu).
-The hypervisor uses Hyper-V.
-The Hyper-V network uses a bridge.
- The IP address, default gateway, and referenced DNS of the virtual machine to be created must be issued by some DHCP.
・ For the time being, the purpose is to move it, so loosen the security
$ sudo apt install genisoimage unzip
$ mkdir -p /mnt/c/VM/testvm01
$ cd /mnt/c/VM/testvm01
This time, create seed.iso with the following settings
Setting items | Set value |
---|---|
hostname | testvm01 |
Login with SSH password authentication | Effectiveness |
Initial user(ec2-user)Login password | amazon |
$ cat << EOF > meta-data
local-hostname: testvm01
EOF
$ cat << EOF > user-data
cloud-config
ssh_pwauth: True
chpasswd:
list: |
ec2-user:amazon
EOF
* The comment [# cloud-config] on the first line of user-data cannot be omitted
$ genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
$ rm -i meta-data user-data
$ curl -LO https://cdn.amazonlinux.com/os-images/2.0.20201111.0/hyperv/amzn2-hyperv-2.0.20201111.0-x86_64.xfs.gpt.vhdx.zip
$ unzip amzn2-hyperv-2.0.20201111.0-x86_64.xfs.gpt.vhdx.zip
$ rm -i amzn2-hyperv-2.0.20201111.0-x86_64.xfs.gpt.vhdx.zip
This time, create a new virtual machine with the following settings in Hyper-V Manager. Please read the contents as necessary.
After creating the virtual machine, attach seed.iso and set the boot device (startup) order to HDD priority.
-Start the virtual machine and log in
・ Confirmation of IP address
・ Login with SSH
Seed.iso may be detached when the virtual machine is stopped or restarted by the hypervisor. Follow the steps for each hypervisor to make the seed.iso attachment permanent.
Run Amazon Linux 2 as a virtual machine on-premises https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html
Recommended Posts