Skip to content

Instantly share code, notes, and snippets.

@astachurski
Forked from smoser/gist:4756561
Created January 14, 2017 19:51
Show Gist options
  • Save astachurski/9e2f1b3018e86ef90fd1bc56f9d4946a to your computer and use it in GitHub Desktop.
Save astachurski/9e2f1b3018e86ef90fd1bc56f9d4946a to your computer and use it in GitHub Desktop.

Revisions

  1. @smoser smoser revised this gist May 2, 2013. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,6 @@ $ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
    ## download the image
    $ wget $img_url -O disk.img.dist


    ## Create a file with some user-data in it
    $ cat > my-user-data <<EOF
    #cloud-config
    @@ -26,5 +25,4 @@ $ cloud-localds my-seed.img my-user-data
    $ qemu-img create -f qcow2 -b disk.img.orig disk.img

    ## Boot a kvm
    $ kvm -net nic -net user -hda disk.img -hdb my-seed.img -m 512

    $ kvm -net nic -net user -hda disk.img -hdb my-seed.img -m 512
  2. @smoser smoser revised this gist Feb 11, 2013. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,23 @@
    ## Install a necessary packages
    sudo apt-get install kvm cloud-utils genisoimage
    $ sudo apt-get install kvm cloud-utils genisoimage

    ## URL to most recent cloud image of 12.04
    img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
    img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
    $ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
    $ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
    ## download the image
    wget $img_url -O disk.img.dist
    $ wget $img_url -O disk.img.dist


    ## Create a file with some user-data in it
    cat > my-user-data <<EOF
    $ cat > my-user-data <<EOF
    #cloud-config
    password: passw0rd
    chpasswd: { expire: False }
    ssh_pwauth: True
    EOF

    ## Convert the compressed qcow file downloaded to a uncompressed qcow2
    qemu-img convert -O qcow2 disk.img.dist disk.img.orig
    $ qemu-img convert -O qcow2 disk.img.dist disk.img.orig

    ## create the disk with NoCloud data on it.
    $ cloud-localds my-seed.img my-user-data
  3. @smoser smoser revised this gist Feb 11, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@
    sudo apt-get install kvm cloud-utils genisoimage

    ## URL to most recent cloud image of 12.04
    img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
    img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
    img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
    ## download the image
    wget $img_url -O disk.img.dist

  4. @smoser smoser created this gist Feb 11, 2013.
    29 changes: 29 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    ## Install a necessary packages
    sudo apt-get install kvm cloud-utils genisoimage

    ## URL to most recent cloud image of 12.04
    img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
    ## download the image
    wget $img_url -O disk.img.dist


    ## Create a file with some user-data in it
    cat > my-user-data <<EOF
    #cloud-config
    password: passw0rd
    chpasswd: { expire: False }
    ssh_pwauth: True
    EOF

    ## Convert the compressed qcow file downloaded to a uncompressed qcow2
    qemu-img convert -O qcow2 disk.img.dist disk.img.orig

    ## create the disk with NoCloud data on it.
    $ cloud-localds my-seed.img my-user-data

    ## Create a delta disk to keep our .orig file pristine
    $ qemu-img create -f qcow2 -b disk.img.orig disk.img

    ## Boot a kvm
    $ kvm -net nic -net user -hda disk.img -hdb my-seed.img -m 512