Install virtual machines in one line

To install a VM from command line, you can use the following command. Change the required parameters as need but you need to change at-least CDROM iso image and disk-path.

virt-install \
    -n myVM \
    --description "Test VM" \
    --os-type=Linux \
        --os-variant=centos7 \
        --ram=2048 \
        --vcpus=2 \
        --disk path=./myVM.img,bus=virtio,size=10 \
        --graphics none \
        --cdrom  <Image installtion CDROM>.iso \
        --net user

Most simple and fast lightweight container with Fedora systemd

If you need to have a quick bash shell in sandbox with not network as well, then the most simple command I could find so far is:

sudo virt-sandbox -c lxc:/// /bin/bash

For this you will need to have libvirt-sandbox installed which you can do with the following command:

sudo yum install libvirt-sandbox

virsh – show ip address of all running VMs

If you are using the libvirt and associated tools, then you must be aware about virt-manager. However this being a GUI tools, it is not possible to always use this. “virsh” is a good option for this.

To start with, if you need to know all the VMs all the running VMs, then you can use (to only view the names):

virsh list --name

Extending this to make it more useful is the case if you need to know the IP address for the running VMs. Here is a simple code that you can put in alias or function that can be used to get the IP address of the running VM’s.

virsh list --name | \
while read line 
do
      [[ ! -z $line ]] && virsh domifaddr $line
done

Bonus note:
If you want to start the VM, then you can use

virsh start