Linux virtualization configuration-virtual machine

Installation conditions and virtualization related information

  1. Installation conditions
    -inter cpu ------------> vmx file
    -amd cpu ------------> svm file
    2. Related information
    -service name: libvirtd
    -virtualization Core: qemu/kvm
    -virtualization storage directory (virtual machine hard disk) /var/lib/libvirt/images/westos.qcow2-virtualization
    hardware information: /etc/libvirt/qemu/westos.xml

Virtualization installation process

Manual installation

  1. Install the components required for virtualization

     Virtualization Client            ##虚拟机客户端
     Virtualization Tools             ##虚拟化工具
     Virtualization Hypervisor        ##虚拟化核心套件
    

    Find the software group and install it to see if the installation is successful.
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here

  2. Turn on virtualization services
    Insert picture description here

  3. Create a virtual machine and make related settings (images can be downloaded in advance)
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    If the final installation is not successful, you can check if your memory is not enough, mine is because of insufficient memory, adjusted to 1024, and the installation is successful.
    Insert picture description here

Insert picture description here
Insert picture description here

Red Hat system internal installation

Insert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Wait for the progress bar to finish and restart.
Insert picture description here

Virtual machine snapshot

  1. Set virtual machine snapshot
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
  2. Use the snapshot to install the virtual machine
    Insert picture description here
    Insert picture description here
    and then all the next step, you can find that it will directly enter the system without repeating the installation.
    Insert picture description here

Script installation

  1. Install via hard disk script
    Insert picture description here
    Insert picture description here

  2. Install via snapshot script
    Insert picture description here
    Insert picture description here

Virtual machine management commands

	virt-manager                     ##打开虚拟机管理界面
	virsh list                       ##列出所有正在运行的虚拟机
	virsh list --all                 ##列出所有虚拟机,包括关机的
	virsh start xxx                  ##启动名字为xxx的虚拟机
	virsh shutdown  xxx              ##正常关机
	virsh destroy                    ##强制关机
	virt-viewer xxx                  ##显示虚拟机界面

Insert picture description here
Insert picture description here

Transmission and Recovery of Virtual Machine in Linux

Virtual machine transfer command

There are two important files for transmission: one is the master disk file, located in /var/lib/libvirt/images/xxx.qcow2, and the other is the file ending in .xml under /etc/libvirt/qemu/ (the name is the master disk Name), which is the .xml file corresponding to the master disk

Command:
Copy someone else’s virtual machine master disk and corresponding files

	scp [email protected]:/var/lib/libvirt/images/母盘名称.qcow2 /var/lib/libvirt/images/
	scp [email protected]:/etc/libvirt/qemu/母盘名称.xml /etc/libvirt/qemu/

Recovery commands for virtual machines

	virsh define  westos.xml      ##通过硬件信息文件恢复虚拟机
	virsh create  westos.xml      ##通过硬件信息文件打开虚拟机,虚拟机关闭后消失
	virsh undefine westos         ##删除虚拟机硬件信息

Guess you like

Origin blog.csdn.net/qwerty1372431588/article/details/109265443