Skip to content

Instantly share code, notes, and snippets.

@fjctp
Last active October 24, 2021 19:04
Show Gist options
  • Save fjctp/40fab8d7324428822010fd31e09382be to your computer and use it in GitHub Desktop.
Save fjctp/40fab8d7324428822010fd31e09382be to your computer and use it in GitHub Desktop.

Revisions

  1. fjctp renamed this gist Oct 24, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. fjctp revised this gist Oct 24, 2021. 3 changed files with 17 additions and 24 deletions.
    4 changes: 0 additions & 4 deletions cleanup.bash
    Original file line number Diff line number Diff line change
    @@ -1,4 +0,0 @@
    #!/bin/bash

    virsh destroy archlinux \
    && virsh undefine --nvram archlinux
    15 changes: 0 additions & 15 deletions create.bash
    Original file line number Diff line number Diff line change
    @@ -1,15 +0,0 @@
    #!/bin/bash
    #
    # Having some problem with UEFI. still testing

    virt-install \
    --name archlinux \
    --vcpu 4 \
    --memory 2048 \
    --machine pc-q35-2.5 \
    --cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    --disk size=20 \
    --network=default,model=virtio \
    --boot uefi \
    --boot loader=/usr/share/qemu/ovmf-x86_64-code.bin

    22 changes: 17 additions & 5 deletions qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,20 @@
    #
    # based on https://gist.github.com/Manouchehri/2b1b523eed834f295915

    # create the disk
    qemu-img create -f qcow2 archlinux.qcow2 16G
    set -e

    ISO_FILE=~/Downloads/archlinux-2021.10.01-x86_64.iso
    DISK_FILE=archlinux.qcow2

    if [[ ! -f ${ISO_FILE} ]]; then
    echo "ISO does not exist!"
    exit 1
    fi

    # create the disk if it does not exist
    if [[ ! -f ${DISK_FILE} ]]; then
    qemu-img create -f qcow2 archlinux.qcow2 16G
    fi

    # start the machine
    # to access, ssh -p 10022 localhost
    @@ -12,8 +24,8 @@ qemu-system-x86_64 \
    -enable-kvm \
    -smp cpus=4 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -cdrom ${ISO_FILE} \
    -drive file=${DISK_FILE},media=disk,if=virtio \
    -net user,hostfwd=tcp::10022-:22 \
    -net nic \
    -vga qxl
    -vga qxl
  3. fjctp revised this gist Oct 22, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -6,13 +6,14 @@
    qemu-img create -f qcow2 archlinux.qcow2 16G

    # start the machine
    # to access, ssh -p 10022 localhost
    qemu-system-x86_64 \
    -bios /usr/share/qemu/ovmf-x86_64-code.bin \
    -enable-kvm \
    -smp cpus=4 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -net user,hostfwd=tcp::10022-:22 \ # to access, ssh -p 10022 localhost
    -net user,hostfwd=tcp::10022-:22 \
    -net nic \
    -vga qxl
  4. fjctp revised this gist Oct 22, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,6 @@ qemu-system-x86_64 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -net user,hostfwd=tcp::10022-:22 \
    -net user,hostfwd=tcp::10022-:22 \ # to access, ssh -p 10022 localhost
    -net nic \
    -vga qxl
  5. fjctp revised this gist Oct 22, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -13,5 +13,6 @@ qemu-system-x86_64 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -net user,hostfwd=tcp::60022-:22 \
    -net user,hostfwd=tcp::10022-:22 \
    -net nic \
    -vga qxl
  6. fjctp revised this gist Oct 22, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -13,5 +13,5 @@ qemu-system-x86_64 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -net user,hostfwd=tcp::60022-:22,model=virtio \
    -net user,hostfwd=tcp::60022-:22 \
    -vga qxl
  7. fjctp revised this gist Oct 22, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -13,5 +13,5 @@ qemu-system-x86_64 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -nic user,model=virtio \
    -net user,hostfwd=tcp::60022-:22,model=virtio \
    -vga qxl
  8. fjctp revised this gist Oct 20, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,11 @@
    #!/bin/bash
    #
    # based on https://gist.github.com/Manouchehri/2b1b523eed834f295915
    # Not working yet. still testing

    # create the disk
    qemu-img create -f qcow2 archlinux.qcow2 16G

    # start the machine
    qemu-system-x86_64 \
    -bios /usr/share/qemu/ovmf-x86_64-code.bin \
    -enable-kvm \
  9. fjctp revised this gist Oct 20, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,5 @@ qemu-system-x86_64 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -net default,model=virtio \
    -nic user,model=virtio \
    -vga qxl
  10. fjctp revised this gist Oct 20, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -3,14 +3,14 @@
    # based on https://gist.github.com/Manouchehri/2b1b523eed834f295915
    # Not working yet. still testing

    qemu-img create -f qcow2 archlinux.qcow2 16G

    # Installing
    qemu-system-x86_64 \
    -bios /usr/share/qemu/ovmf-x86_64-code.bin \
    -enable-kvm \
    -smp cpus=4 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=archlinux.qcow2,if=virtio \
    -drive file=archlinux.qcow2,media=disk,if=virtio \
    -net default,model=virtio \
    -vga qxl
  11. fjctp revised this gist Oct 20, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions create.bash
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    #!/bin/bash
    #
    # Having some problem with UEFI. still testing

    virt-install \
    --name archlinux \
  12. fjctp revised this gist Oct 20, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,6 @@ qemu-system-x86_64 \
    -smp cpus=4 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=fedoraraw.qcow2,if=virtio \
    -drive file=archlinux.qcow2,if=virtio \
    -net default,model=virtio \
    -vga qxl
  13. fjctp revised this gist Oct 20, 2021. 2 changed files with 18 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion create.bash
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,5 @@ virt-install \
    --disk size=20 \
    --network=default,model=virtio \
    --boot uefi \
    --boot loader=/usr/share/qemu/ovmf-x86_64-code.bin
    --boot loader=/usr/share/qemu/ovmf-x86_64-code.bin

    16 changes: 16 additions & 0 deletions qemu_test.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/bin/bash
    #
    # based on https://gist.github.com/Manouchehri/2b1b523eed834f295915
    # Not working yet. still testing


    # Installing
    qemu-system-x86_64 \
    -bios /usr/share/qemu/ovmf-x86_64-code.bin \
    -enable-kvm \
    -smp cpus=4 \
    -m size=2048 \
    -cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    -drive file=fedoraraw.qcow2,if=virtio \
    -net default,model=virtio \
    -vga qxl
  14. fjctp created this gist Oct 20, 2021.
    4 changes: 4 additions & 0 deletions cleanup.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    #!/bin/bash

    virsh destroy archlinux \
    && virsh undefine --nvram archlinux
    12 changes: 12 additions & 0 deletions create.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash

    virt-install \
    --name archlinux \
    --vcpu 4 \
    --memory 2048 \
    --machine pc-q35-2.5 \
    --cdrom ~/Downloads/archlinux-2021.10.01-x86_64.iso \
    --disk size=20 \
    --network=default,model=virtio \
    --boot uefi \
    --boot loader=/usr/share/qemu/ovmf-x86_64-code.bin