1,Create virtual hard disk
代码语言:javascript复制qemu-img create -f qcow2 docker01.img 50G
2,Create virtual machine ubuntu 20.04
virt-install --name dcoker01 --memory 2048 --vcpus 2 --disk /kvm/img/docker01.img,format=qcow2,bus=virtio --accelerate --cdrom /kvm/iso/ubuntu-20.04.3-live-server-amd64.iso --network bridge=br0,model=virtio --graphics vnc,listen=0.0.0.0,port=5950 --noautoconsole
3,Enable console on ubuntu20.04 (vnc connection virtual machine)
代码语言:javascript复制sudo systemctl start serial-getty@ttyS0
sudo systemctl enable serial-getty@ttyS0
Created symlink /etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service → /lib/systemd/system/serial-getty@.service.
4, virtual machine ubuntu 20.04 console
代码语言:javascript复制[root@kvm-node2 ~]# virsh console docker01
Connected to domain docker01
Escape character is ^]
docker-node01 login:
5,System version
代码语言:javascript复制docker@docker-node01:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
6,virtual machine snapshot
(1)Command format
代码语言:javascript复制virsh snapshot-create-as 【vm name】 【Snapshot name】
(2)View the version of the virtual machine snapshot
代码语言:javascript复制[root@kvm-node2 /]# virsh snapshot-list docker01
(3)View the version of the current virtual machine mirror snapshot
代码语言:javascript复制[root@kvm-node2 /]# virsh snapshot-current docker01
7,ubuntu 20.04 sudo command password free
代码语言:javascript复制sudo vim /etc/sudoers
docker ALL=(ALL:ALL) NOPASSWD: ALL
Importing a virtual machine image
virt-install --name guest-rhel7 --memory 2048 --vcpus 2 --disk /kvm/img/node01.img,format=qcow2,bus=virtio --accelerate --import --network bridge=br0,model=virtio --os-variant rhel7 --graphics vnc,listen=0.0.0.0 --noautoconsole
View VNC Port
代码语言:javascript复制virsh vncdisplay guest-rhel7