Create your first KVM virtual machine

1. Install Ubuntu in VmWare

  1. Download the Ubuntu image, 14.04, 16.04, 18.04 for learning. Download the iso image of each version, and then recommend the next one in the virtual machine. Note that, when you select a shared folder, you must select a single file.
  2. Install Ubuntu system, there are many other blogs, you can search by yourself, here is mainly to talk about some problems that may exist in the installation. (Take Ubuntu18.04 as an example here)

1. After the installation is complete, there will only be a small screen in the middle of VMWare WorkStation.

There is a problem

Insert picture description here

Solve the problem

  1. Problem description: Because of the reason that VMware Tools is not installed. When you right-click on your version 18 virtual machine, you will find the words Install VMware Tools. But the other virtual machines you install, such as CentOs, are the words to reinstall VMware Tools.

  2. Resolution steps

    1. Right-click the virtual machine and click InstallInsert picture description here
    2. Click on the VMware Tools icon on the desktop
      Insert picture description here
    3. Go to the Vmware Tools folder

    Unzip command tar -zxvf Compressed package name
    Move folder command mv File name Folder location

    Copy the tar.gz compressed file to the Home directory
    Insert picture description here

    1. Execute the tar -zxvf VMwareTools-10.2.5-8068393.tar.gz command to decompress. Note that the terminal should be opened in the Home directory at this time
      Insert picture description here
    2. After the decompression is complete, enter the decompressed directory cd vmware-tools-distrib, and execute the file command, ./vmware-install.pl
    此时应该提示请使用超级管理员操作。我们只需要使用sudo ./vmware-install.pl命令然后输入我们登录的普通用户的密码以具有超级管理员的权限。
    注意:提示输入密码时输入的密码在屏幕不会显示。
    
    1. When the file is successfully run, there will be the following prompt, and you will be asked if you want to install it. Just enter yes. Then press Enter all the way to install by default.
      Insert picture description here
    2. Execute reboot and restart the computer to complete.
      Insert picture description here

2. Install KVM in the virtual machine

1. Before that, let's modify the sshd_config file under /etc/ssh. Allow root to log in directly via ssh.
  1. First install vim, everyone knows that vi is not easy to use. . .
    sudo apt-get install vim
    input Y when prompted whether to continue, and then wait
  2. Install ssh,
    sudo apt-get install openssh-server
  3. Check the status occupied by ssh ps -e|grep ssh, there is sshd indicating that it is running
  4. Modify the sshd_config file under
    /etc/ssh vim /etc/ssh/sshd_config
  5. Enter i to enter the insert mode and just find a place to add PermitRootLogin yes, then save and exit. (Note: root privileges are required at this time)
  6. Enter service ssh restart ssh to restart ssh
2. Install the packages required by kvm
  1. Install the packages required by KVM
    sudo apt-get install qemu-kvm qemu-system libvirt-bin virt-manager bridge-utils vlan
    need to wait for a whileInsert picture description here
  • qemu-kvm and qemu-system are the core packages of KVM and QEMU, providing CPU, memory and IO virtualization functions.
  • libvirt-bin is libvirt, used to manage hypervisors such as KVM.
  • virt-manager is a KVM graphical management tool
  • Bridge-utils and VLAN are mainly required for network virtualization. The implementation of KVM network virtualization is based on linux-bridge and VLAN.
  1. Turn off the virtual machine, in the virtual machine settings, check the processor to run the virtualization function,
    Insert picture description here
    click OK, and then turn on the virtual machine. Use sudo -i to switch to the root user, enter the command egrep -o'(vmx|svm)' /proc/cpuinfo to display vmx. And enter service libvirt-bin status to confirm that the Libvirtd service has been started. The following status is displayed to indicate success.
    Insert picture description here
3. Start the first KVM virtual machine
  1. Open the Firefox browser with Ubuntu and download the mirror at http://download.cirros-cloud.net/0.3.3/
    Insert picture description here
    Insert picture description here
    Insert picture description here
  2. Move the file in the downloaded directory to the /var/lib/libvirt/images/ directory. At this time, KVM looks for the image file by default.
    Insert picture description here
  3. Enter virt-manager in the terminal to start the graphical interface
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    . That's it! ! , Our first KVM virtual machine is created!

Guess you like

Origin blog.csdn.net/CONSOLE___/article/details/114433926