CLI: Enabling Virtualization in the CLI
You can use the virt
command to create or edit virtual machines.
[no] virt {enable|interface|vm|vnet|volume}
To enable the virtualization feature:
virt enable
To assign an interface to use as a VM access port:
virt interface <interface>
To configure a virtual machine:
virt vm <name> {arch|boot|comment|console|copy|feature|install|interface|memory|power|rename|storage|vcpus}
arch {i386|x86_64}
- Set CPU architecture.boot {auto-power|device}
- Configure boot options.
auto-power {on|off|last}
- Specify power state for VM to have after host boot.
auto-power on
- Always power VM on. If VM was running at last shutdown, restore its state.auto-power off
- Always leave VM powered off. If VM was running at last shutdown, its state is lost.auto-power last
- Power VM on only if it was running at last shutdown. In this case, also restore its state.
device order {cdrom|hd}
- Specify order to try devices during boot.
- E.g. device order cdrom hd
- E.g. device order hd cdrom
comment <comment>
- Set a comment describing this virtual machine.console {connect|graphics|text}
- Configure or connect to the text or graphicacopy <new_name> [storage copy-type {shallow|none}]
- Make a duplicate copy of this virtual machine.
storage copy-type {shallow|none}
- Make a duplicate copy of this VM's storage.
shallow
- Use the same volumes as the source VM.none
- New VM will have no attached storage
feature {pae|acpi|apic} enable
- Enable/disable certain virtualization features.
pae
- Physical Address Extensionacpi
- Advanced Configuration and Power Interfaceapic
- Advanced Programmable Interrupt Controller
install {cancel|cdrom}
- Install an operating system onto this virtual machine (temporarily attach a CD and boot from it).
cancel
- Cancel an install already in progresscdrom file <volume-name> {connect-console|disk-overwrite|timeout|verify}
- Install an operation system from a CD-ROM (ISO) image
connect-console
- Connect to the console during installationdisk-overwrite
- Install even if primary target volume is not emptytimeout {<minutes>|none}
- Specify a timeout for installation (default is no timeout)verify
- Options for verifying OS installation
interface <name> {bridge|macaddr|model|name|order|type|vnet}
- Configure virtual interfaces.memory <MB>
- Set memory allowance.power {cycle|off|on}
- Turn this virtual machine on or off, plus other related options.rename <new_name>
- Rename this virtual machine.storage {create|device}
- Configure storage for this virtual machine.
create disk {bus|drive-number|file|mode|size-max}
- Create new storage device for the VM, with an automatically assigned name.device {bus|drive-number|move|swap}
- Modify existing storage device, or crate a new one with a specific name.
vcpus {count|vcpu}
- Specify number of virtual CPUs.
vcpus count <count>
- Specify number of virtual CPUsvcpu <vcpu>
- Specify options for a particular virtual CPU
To configure or manage virtual networks:
virt vnet <name> {dhcp|forward|ip|vbridge}
dhcp range <low_ip> <high_ip>
- Configure a DHCPDynamic Host Configuration Protocol range to assign to this vnet.forward {none|nat|route} interface <name>
- Configure the type of forwarding.ip address <ip> <netmask>
- Configure the IPInternet protocol address of this vnet.vbridge name <name>
- Create a virtual bridge.
To manage virtual storage volumes:
virt volume {create|fetch|file}
create disk file <name> size-max <MB>
- Create an empty virtual disk image.fetch <url>
- Fetch a virtual disk image (*.img) or a CD ROM image (*.iso) from the URL.file {create|copy|move|upload}
- Perform basic file operations.