Last active
March 14, 2024 02:10
Revisions
-
danktec revised this gist
Mar 14, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,13 +17,13 @@ sudo qemu-img convert -f qcow2 noble-server-cloudimg-amd64.img /var/lib/libvirt/ (from inside the VM: lsblk /dev/vda) # Create a cloud-config file named cloud.txt echo " #cloud-config password: password1 chpasswd: { expire: False } ssh_pwauth: True hostname: test1 " > cloud.txt # Convert the cloud config file to a bootable iso image sudo cloud-localds /var/lib/libvirt/images/test1.iso cloud.txt -
danktec revised this gist
Mar 14, 2024 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,13 @@ sudo qemu-img convert -f qcow2 noble-server-cloudimg-amd64.img /var/lib/libvirt/ (from inside the VM: lsblk /dev/vda) # Create a cloud-config file named cloud.txt ``` #cloud-config password: password1 chpasswd: { expire: False } ssh_pwauth: True hostname: test1 ``` # Convert the cloud config file to a bootable iso image sudo cloud-localds /var/lib/libvirt/images/test1.iso cloud.txt -
danktec revised this gist
Mar 14, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ ref: https://www.theurbanpenguin.com/using-cloud-images-in-kvm/ sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm virt-manager cloud-image-utils kvm-ok # Install an OS from an ISO file interactively # sudo virt-install --name ubuntu-guest --os-variant ubuntu20.04 --vcpus 2 --ram 2048 --location http://ftp.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/ --network bridge=virbr0,model=virtio --graphics none --extra-args='console=ttyS0,115200n8 serial' # Get a cloud image wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img -
danktec revised this gist
Mar 14, 2024 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,12 +4,10 @@ ref: https://www.theurbanpenguin.com/using-cloud-images-in-kvm/ sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm virt-manager cloud-image-utils kvm-ok # Install OS from iso sudo virt-install --name ubuntu-guest --os-variant ubuntu20.04 --vcpus 2 --ram 2048 --location http://ftp.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/ --network bridge=virbr0,model=virtio --graphics none --extra-args='console=ttyS0,115200n8 serial' # Get a cloud image wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img qemu-img info noble-server-cloudimg-amd64.img -
danktec revised this gist
Mar 14, 2024 . 1 changed file with 8 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,41 +1,31 @@ ref: https://www.theurbanpenguin.com/using-cloud-images-in-kvm/ # Install KVM Deps sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm virt-manager cloud-image-utils kvm-ok # Install OS from iso sudo virt-install --name ubuntu-guest --os-variant ubuntu20.04 --vcpus 2 --ram 2048 --location http://ftp.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/ --network bridge=virbr0,model=virtio --graphics none --extra-args='console=ttyS0,115200n8 serial' # Get cloud image wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img qemu-img info noble-server-cloudimg-amd64.img # Resize cloud image qemu-img resize thing.img 10G sudo qemu-img convert -f qcow2 noble-server-cloudimg-amd64.img /var/lib/libvirt/images/noble.img (from inside the VM: lsblk /dev/vda) # Create a cloud-config file named cloud.txt # Convert the cloud config file to a bootable iso image sudo cloud-localds /var/lib/libvirt/images/test1.iso cloud.txt # Start up the System sudo virt-install --name test1 --memory 2096 --disk /var/lib/libvirt/images/noble.img,device=disk,bus=virtio --disk /var/lib/libvirt/images/test1.iso,device=cdrom --os-variant=ubuntu16.04 --virt-type=kvm --graphics=none --network network=default,model=virtio --import # View volumes in the default pool virsh list --all vol-list --pool default -
danktec created this gist
Mar 14, 2024 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ ref: https://www.theurbanpenguin.com/using-cloud-images-in-kvm/ Install KVM Deps: sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm virt-manager cloud-image-utils kvm-ok Install OS from iso ```bash sudo virt-install --name ubuntu-guest --os-variant ubuntu20.04 --vcpus 2 --ram 2048 --location http://ftp.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/ --network bridge=virbr0,model=virtio --graphics none --extra-args='console=ttyS0,115200n8 serial' ``` Get cloud image ```bash wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img qemu-img info noble-server-cloudimg-amd64.img ``` Resize cloud image ```bash qemu-img resize thing.img 10G sudo qemu-img convert -f qcow2 noble-server-cloudimg-amd64.img /var/lib/libvirt/images/noble.img (from inside the VM: lsblk /dev/vda) ``` Create a cloud-config file named cloud.txt Convert the cloud config file to a bootable iso image ```bash sudo cloud-localds /var/lib/libvirt/images/test1.iso cloud.txt ``` Start up the System ```bash sudo virt-install --name test1 --memory 2096 --disk /var/lib/libvirt/images/noble.img,device=disk,bus=virtio --disk /var/lib/libvirt/images/test1.iso,device=cdrom --os-variant=ubuntu16.04 --virt-type=kvm --graphics=none --network network=default,model=virtio --import # View volumes in the default pool virsh list --all vol-list --pool default # Destroy the vm virsh destroy _domain_id virsh underfine _domain_id virsh vol-delete --pool default /var/lib/libvirt/images/noble.img