HostOnNet Blog

virt-install

Looking for Linux Server Admin or WordPress Expert? We can help.

virst-install allow you to create KVM or Xen virtual servers.

To install virt-install on CentOS, run

yum install python-virtinst

To create a KVM Virtual Machine from command line, run

virt-install \
--name testVM \
--ram 4096 \
--disk path=/home/solusvm/kvm/images/testVM.img,size=30 \
--vcpus 2 \
--os-type linux \
--os-variant rhel7 \
--network bridge=br0 \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--cdrom '/home/solusvm/kvm/iso/ubuntu-16.04.2-server-amd64.iso'

Now you need to find the VNC port. This can be done with command

virsh vncdisplay VMID

Example

[root@et-03-01-srv-001 ~]# virsh vncdisplay testVM
:1

[root@et-03-01-srv-001 ~]# 

Now you will be able to connect to the Virtual machine and do the installation using any VNC Viewer by connecting to HOST-IP:1

Or you can connect to Node/Host using virt-manager, then open console

Create VM on LVM Disk

# virt-install --connect qemu:///system -n debian-squeeze \
>        -r 1024 --vcpus=1 --disk path=/dev/mapper/vg1-boby_lv \
>        -c /home/solusvm/xen/iso/debian-9.1.0-amd64-netinst.iso  \
>        --graphics vnc,listen=0.0.0.0 --noautoconsole \
>        --os-type linux --os-variant debiansqueeze \
>        --network=bridge:br0 --hvm

Starting install...
Creating domain...                                                                                                                                                                   |    0 B     00:00
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
#

See kvm

Posted in Virtualization

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.