Skip to content

Commit

Permalink
ubuntu-18.04-server-cloudimg-amd64.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Nov 17, 2018
1 parent cd3f4a4 commit 603cfbb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
1. [Virtualization](virtualization.md)
1. [Docker](docker/)
1. [QEMU](qemu.md)
1. [debootstrap-ubuntu-qemu.sh](debootstrap-ubuntu-qemu.sh)
1. [debootstrap-ubuntu-qemu-arm.sh](debootstrap-ubuntu-qemu-arm.sh)
1. [debootstrap-debian-qemu.sh](debootstrap-debian-qemu.sh)
1. [debootstrap-ubuntu-qemu.sh](debootstrap-ubuntu-qemu.sh)
1. [debootstrap-ubuntu-qemu-arm.sh](debootstrap-ubuntu-qemu-arm.sh)
1. [debootstrap-debian-qemu.sh](debootstrap-debian-qemu.sh)
1. [ubuntu-18.04-server-cloudimg-amd64.sh](ubuntu-18.04-server-cloudimg-amd64.sh)
1. [Xen](xen.md)
1. [Vagrant](vagrang/)
1. [Intel SDE](intel-sde.md)
Expand Down
4 changes: 2 additions & 2 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Node:

- `u`: parent node
- `t`: top node
- `[,`, `]:` next previous node. May change node level
- `[,`, `]:` next previous node. May change node level
- `n`, `p`: same as `[` and `]`, but cannot change node level
- `l`: go to last viewed node. can be used several times
- `l`: go to last viewed node. Can be used several times.
- `g`: like m, but search all nodes

Search:
Expand Down
39 changes: 39 additions & 0 deletions ubuntu-18.04-server-cloudimg-amd64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

sudo apt-get install cloud-image-utils qemu

# This is already in qcow2 format.
img=ubuntu-18.04-server-cloudimg-amd64.img
if [ ! -f "$img" ]; then
wget "https://cloud-images.ubuntu.com/releases/18.04/release/${img}"

# sparse resize: does not use any extra space, just allows the resize to happen later on.
# https://superuser.com/questions/1022019/how-to-increase-size-of-an-ubuntu-cloud-image
qemu-img resize "$img" +128G
fi

user_data=user-data.img
if [ ! -f "$user_data" ]; then
# For the password.
# https://serverfault.com/questions/920117/how-do-i-set-a-password-on-an-ubuntu-cloud-image
# https://askubuntu.com/questions/507345/how-to-set-a-password-for-ubuntu-cloud-images-ie-not-use-ssh
cat >user-data <<EOF
#cloud-config
password: asdfqwer
chpasswd: { expire: False }
ssh_pwauth: True
EOF
cloud-localds "$user_data" user-data
fi

qemu-system-x86_64 \
-drive "file=${img},format=qcow2" \
-drive "file=${user_data},format=raw" \
-device rtl8139,netdev=net0 \
-enable-kvm \
-m 2G \
-netdev user,id=net0 \
-serial mon:stdio \
-smp 2 \
-vga virtio \
;

0 comments on commit 603cfbb

Please sign in to comment.