Create Virtual Machine

Install GuestOS and create a Virtual Machine. This example shows to install Future OS 1.

[1] Install GuestOS to text mode over the network, connect remotely with the console or other applications. In addition, the images of the virtual machine are placed as a storage pool by default in [/var/lib/libvirt/images], but this example shows creating and using a new storage pool.

# create a Storage Pool directory
[[email protected] ~]# mkdir -p /var/kvm/images
[[email protected] ~]# curl https://pkgs.futurelinux.org/future/1/images/cloud/Future-1-x64.qcow2 -o /var/kvm/images/Future-1-x64.qcow2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2393M  100 2393M    0     0  1562k      0  0:26:08  0:26:08 --:--:-- 1264k

[[email protected] ~]# virt-install \
    --disk path=/var/kvm/images/Future-1-x64.qcow2,size=10,bus=virtio \
    --network network=default,model=virtio \
    --console pty,target_type=virtio \
    --connect qemu:///system \
    --os-variant generic \
    --name future-1-x64 \
    --virt-type kvm \
    --os-type linux \
    --graphics none \
    --ram 1024 \
    --vcpus 1 \
    --boot hd \
    --import

Starting install...
Connected to domain future-1-x64
Escape character is ^]

Future OS 1 (Tesla)
Kernel 5.10.39-300.fx1.x86_64 on an x86_64 (hvc0)

futurelinux login: root
Password:
Last login: Wed Sep 15 16:30:36 from 192.168.122.1
[[email protected] ~]#     # Guest's console

[2] Move to GuestOS to HostOS with Ctrl + AltGR + ] key. Move to HostOS to GuestOS with a command [virsh --connect qemu:///system console (name of virtual machine)].

[[email protected] ~]#     # Ctrl + AltGR + ] key
[[email protected] ~]#       # Host's console
[[email protected] ~]# virsh --connect qemu:///system console future-1-x64

# move to Guest

Connected to domain future-1-x64
Escape character is ^]    # Enter key
[[email protected] ~]#     # Guest's console

[3] It's easy to create another VM to copy from current VM with a command below.

[[email protected] ~]# virt-clone --connect qemu:///system --original future-1-x64 --name template --file /var/kvm/images/template.img
Allocating 'template.img'                                           |  20 GB  00:00:06

Clone 'template' created successfully.

# disk image
[[email protected] ~]# ll /var/kvm/images/template.img
-rw-------. 1 root root 4182376448 Oct  2 16:41 /var/kvm/images/template.img

# configuration file
[[email protected] ~]# ll /etc/libvirt/qemu/template.xml
-rw-------. 1 root root 2834 Oct  2 16:41 /etc/libvirt/qemu/template.xml