network:īefore you create the clone, change the "template" VM to remove the match line and the two below it to become: network: If you later decide to clone the VM you just spun up, in order to create a new guest, be aware that the /etc/netplan/50-cloud-init.yaml file will have a hardcoded mac address in there to match. However, it will not add the entry to the /etc/hosts file, so you may wish to do this quickly to prevent your machine taking unnecessarily long when performing some operations.Īlternatively, you may figure out how to update the cloud-init.cfg file to update the hosts file correctly using the Etc hosts module. It appears that setting the hostname in the cloud-init config will set the hostname that the machine will boot as. & sudo rm /var/lib/libvirt/images/$VM_NAME/cloud-init.cfg sudo rm /var/lib/libvirt/images/$VM_NAME/cloud-init.iso \ CleanupĪfter that, it's probably a good idea to cleanup so raw passwords aren't lying around. If you need to get out of the console just press ctrl + ]. (which I could only run after installing the libosinfo-bin package).Īfter running the previous command, you will be taken to the login screen in the console, which you can log in with using the username and password you specified at the start of this tutorial. The -os-variant is listed as ubuntu19.04 because Debain 10 does not have ubuntu20.04 in the list outputted from running sudo osinfo-query os disk /var/lib/libvirt/images/$VM_NAME/cloud-init.iso,device=cdrom \ disk /var/lib/libvirt/images/$VM_NAME/root-disk.qcow2,device=disk,bus=virtio \ var/lib/libvirt/images/$VM_NAME/cloud-init.iso \ If you need to further customize your VM on first setup, there are plenty of online cloud config examples.Ĭreate the ISO file from the cloud config file we just created: sudo cloud-localds \ I tried and failed many times to set the default user name to something else. The default user to log in with will be ubuntu. " | sudo tee /var/lib/libvirt/images/$VM_NAME/cloud-init.cfg # configure sshd to allow users logging in using password var/lib/libvirt/images/$VM_NAME/root-disk.qcow2 \Ĭreate a cloud-init configuration so we can set the password and the hostname etc. Increase the disk size to whatever you want for the VM, in this case I'm setting 20 GB sudo qemu-img resize \ var/lib/libvirt/images/$VM_NAME/root-disk.qcow2 var/lib/libvirt/images/templates/ubuntu-20-server.qcow2 \ sudo mkdir /var/lib/libvirt/images/$VM_NAME \ Stepsįirst, pick a name for your new VPS, and what you would want the username/password combo to be for the default user that will be set up: VM_NAME="ubuntu-20-cloud-image"Ĭreate an area for our new VM and copy the template cloud image into it, which will be used by the new VM. Your distro may have a different name for the required packages. The cloud-utils package is required for Debian 10 to be able to run the cloud-localds command, and the whois package is required for us to be able to run mkpasswd later. sudo apt update & sudo apt install cloud-utils whois -y We need to ensure we have cloud-utils and whois packages for later. var/lib/libvirt/images/templates/ubuntu-20-server.qcow2 Sudo mv -i focal-server-cloudimg-amd64.img \ sudo mkdir /var/lib/libvirt/images/templates Create Debian 11 (Bullseye) KVM Guest From Cloud Imageĭownload the Ubuntu 20.04 server cloud Image and rename to qcow2 to save confusion.Create Ubuntu 22.04 KVM Guest From Cloud Image.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |