libvirt- Create virtual machine with text console only interface

2019-05-27 1 min read Linux Vurtualization

virt-install is an amazing tool to create VMs. If you have created a config file (Kickstart file – ks.cfg), then its only one line un-attended install. If you are using this on remote host with ssh and unluckily cannot export display – what do you do. Do a non-graphical install. There are only minor changes in the command to tell the installer that there is no graphics available and it is amazing, is it not 🙂

virt-install --name test --os-variant=centos7 \
--description "CentOS 7.5 VM" --extra-args \
"ks=ks7.5.cfg console=ttyS0,115200n8 serial" --graphics none --console pty,target_type=serial \
--ram 60240  --vcpus 23 --disk path=/tmp/vm.qcow2,bus=virtio,size=20 \
--location /centos.iso --os-type=linux --hvm --accelerate \
--noautoconsole --wait=-1

 

Especifically for the no-graphical installation, I have added the following:

console=ttyS0,115200n8 serial — in extra-args

–graphics none

–console pty,target_type=serial

 

These options will enable installing the VM in a Text install mode and thus saving your day.

comments powered by Disqus