El comando virt-install permite la creación de máquinas virtuales para Xen de forma sencilla, ya sea a través de un asistente desde la línea de comandos o del paso de parámetros con las distintas opciones al comando. El comando utiliza la librería «libvirt».
A través de esta herramienta, podemos realizar tanto instalaciones en modo texto como gráficas, y las imagenes del sistema operativo pueden ser cargadas desde FTP, HTTP, NFS o local.
El paquete a instalar es python-virtinst.noarch:
yum install python-virtinst.noarch
No obstante, personalmente al instalar xen instalo los siguientes paquetes y automáticamente por dependencias los coge todos:
yum install xen.i386 xen-devel.i386 virt-manager.i386
Una vez instalado, el modo de utilización es sencillo, vamos a ver como crear una máquina virtual con 2GB de disco, 256 MB de RAM, sistema operativo CentOS, etc:
# virt-install What is the name of your virtual machine? test01 How much RAM should be allocated (in megabytes)? 256 What would you like to use as the disk (file path)? /home/virtual/test01.img How large would you like the disk (/home/virtual/test01.img) to be (in gigabytes)? 2 Would you like to enable graphics support? (yes or no) no What is the install location? http://ftp.udl.es/pub/centos/5.3/os/i386/ Starting install... Retrieving file CentOS... Retrieving file vmlinuz... Retrieving file initrd.img... Creating storage file ...
Y ya comenzará la instalación interactiva del sistema:
Welcome to CentOS
+---------+ Choose a Language +---------+
| |
| What language would you like to use |
| during the installation process? |
| |
| Catalan ^ |
| Chinese(Simplified) : |
| Chinese(Traditional) # |
| Croatian : |
| Czech : |
| Danish : |
| Dutch : |
| English v |
| |
| +----+ |
| | OK | |
| +----+ |
| |
| |
+---------------------------------------+
/ between elements | selects | next screen
Si en vez de utilizar el asistente queremos pasar manualmente los parámetros a virt-install no hay ningún problema, revisamos la ayuda y nos informan de todas las posibilidades:
# virt-install --help
Ejemplo:
# virt-install \
--paravirt \
--name test01 \
--ram 256 \
--file /home/virtual/test01.img \
--file-size 2 \
--nographics \
--location http://ftp.udl.es/pub/centos/5.3/os/i386/