How to create a new guest (virtual machine) by CLI on Xen
How to use command lines to create a new guest (virtual machine) on XEN
The command is “virt-install”. The sample executing command as below
$virt-install -p -n vs2 -r 512 -f /home/vs2.img -s 8 -l http://repo.cloudhosting.com.hk/centos/6/os/x86_64/ -w bridge:xenbr0 --vcpus=1
Description: to create a new VM named “vs2” with 512MB RAM, image-file at /home/vs2.img, image-size as 8GB, install via http at http://repo.cloudhosting.com.hk/centos/6/os/x86_64/images/, ethernet with bridge:xenbr0, and cpu with 1.
All detailed description as below
virt-install -help
usage: virt-install [options]
options:
-h, --help show this help message and exit
-n NAME, --name=NAME Name of the guest instance
-r MEMORY, --ram=MEMORY
Memory to allocate for guest instance in megabytes
-u UUID, --uuid=UUID UUID for the guest; if none is given a random UUID
will be generated. If you specify UUID, you should use
a 32-digit hexadecimal number.
--vcpus=VCPUS Number of vcpus to configure for your guest
--check-cpu Check that vcpus do not exceed physical CPUs and warn
if they do.
--cpuset=CPUSET Set which physical CPUs Domain can use.
-f DISKFILE, --file=DISKFILE
File to use as the disk image
-s DISKSIZE, --file-size=DISKSIZE
Size of the disk image (if it doesn't exist) in
gigabytes
--nonsparse Don't use sparse files for disks. Note that this will
be significantly slower for guest creation
--nodisks Don't set up any disks for the guest.
-m MAC, --mac=MAC Fixed MAC address for the guest; if none or RANDOM is
given a random address will be used
-b BRIDGE, --bridge=BRIDGE
Bridge to connect guest NIC to; if none given, will
try to determine the default
-w NETWORK, --network=NETWORK
Connect the guest to a virtual network, forwarding to
the physical network with NAT
--vnc Use VNC for graphics support
--vncport=VNCPORT Port to use for VNC
--sdl Use SDL for graphics support
--nographics Don't set up a graphical console for the guest.
--noautoconsole Don't automatically try to connect to the guest
console
-k KEYMAP, --keymap=KEYMAP
set up keymap for a graphical console
--accelerat
--accelerate Use kernel acceleration capabilities
--connect=CONNECT Connect to hypervisor with URI
--livecd Specify the CDROM media is a LiveCD
-v, --hvm This guest should be a fully virtualized guest
-c CDROM, --cdrom=CDROM
File to use a virtual CD-ROM device for fully
virtualized guests
--pxe Boot an installer from the network using the PXE boot
protocol
--os-type=OS_TYPE The OS type for fully virtualized guests, e.g.
'linux', 'unix', 'windows'
--os-variant=OS_VARIANT
The OS variant for fully virtualized guests, e.g.
'fedora6', 'rhel5', 'solaris10', 'win2k', 'vista'
--noapic Disables APIC for fully virtualized guest (overrides
value in os-type/os-variant db)
--noacpi Disables ACPI for fully virtualized guest (overrides
value in os-type/os-variant db)
--arch=ARCH The CPU architecture to simulate
-p, --paravirt This guest should be a paravirtualized guest
-l LOCATION, --location=LOCATION
Installation source for paravirtualized guest (eg,
nfs:host:/path, http://host/path, ftp://host/path)
-x EXTRA, --extra-args=EXTRA
Additional arguments to pass to the installer with
paravirt guests
-d, --debug Print debugging information
--noreboot Disables the automatic rebooting when the installation
is complete.
--force Do not prompt for input. Answers yes where applicable,

Latest Comments