Last active
October 4, 2018 20:30
-
-
Save rcj4747/aaea3b1b5fbc285acf6d9ba366e65cd3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat <<EOF > meta-data | |
instance-id: iid-local01 | |
local-hostname: cloudimg | |
EOF | |
cat <<EOF > user-data | |
#cloud-config | |
ssh_import_id: [ yourlaunchpadid ] | |
system_info: | |
default_user: | |
lock_passwd: false | |
plain_text_passwd: passw0rd | |
ssh_pwauth: true | |
users: | |
- default | |
EOF | |
genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data | |
rm user-data meta-data | |
echo " | |
Create a disk backed by the image: | |
qemu-img create -f qcow2 -b <orig-disk>.img boot-disk.img | |
Launch the instance with: | |
kvm -m 256 -net nic -net user,hostfwd=tcp::2222-:22 \ | |
-drive file=boot-disk.img,if=virtio \ | |
-drive file=seed.iso,if=virtio,media=cdrom -nographic" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Once you're done you can
ssh -o port=2222 ubuntu@localhost