From Fedora Project Wiki
This guide shows how to test Fedora Cloud images using virt-install
(which is a part of virt-manager).
Setup
- Install
virt-install
:sudo dnf install virt-install
- If you just installed the whole libvirt virtualization stack (you didn't have it before), it's recommended that you reboot your machine.
- Download the preferred Fedora Cloud image that you want to test. It's recommended to pick the qcow2 image (raw.xz works too, if you prefer it, just make sure you don't forget to decompress it).
Create the virtual machine
- Create the VM using the following command:
virt-install --name localcloud1 --memory 2000 --disk=size=10,backing_store="/path/to/Cloud.qcow2" --cloud-init --noreboot --os-variant detect=on,name=fedora-unknown
You can of course adjust all the values. Be sure to replace
/path/to/Cloud.qcow2
with an absolute path to your downloaded Fedora Cloud image. - A root password for the first login is printed out in terminal, note it down or put it into the clipboard
- In a login prompt, log in as
root
with the password printed out earlier. You'll probably be forced to immediately change the password. - Do whatever is needed in the VM.
- You can either power the machine down using
poweroff
, or just disconnect from the serial console using Ctrl+].
Connect to the virtual machine later
- If you want to connect to an existing
localcloud1
VM later, first make sure it is started:virsh start localcloud1
and then connect to the serial console:
virsh console localcloud1
(hit ↵ Enter to see the command/login prompt)
- You can also control and connect to the VM from
virt-manager
.
Clean up the virtual machine
- You can easily remove your VM together with the overlay disk drive. Fist make sure the VM is shut down:
virsh destroy localcloud1
and then remove the VM and its disk:
virsh undefine --remove-all-storage localcloud1
- You can also remove your VM from
virt-manager
.