KVM installation

Install KVM

1. Confirm whether the hardware supports

# grep -Ei --color = auto ' vmx | svm ' / proc / cpuinfo

2. Install kvm and related tools

# yum install -y qemu-kvm qemu-kvm-tools libvirt virt-manager virt-viewer python-virtinst tigervnc-server tigervnc

# ln -sv /usr/libexec/qemu-kvm /usr/sbin/

3. Load the module

# modprobe sqm
# modprobe kvm_intel
# lsmod | grep sqm

4. Create the first virtual machine

1) Create a thin comb format disk
# dd if=/dev/zero of=/root/centos6.img bs=1M oflag=direct seek=4095 count=1

2) Create a virtual machine and use the CD to install the centos6 operating system

# qemu-kvm -m 768 \
    -smp 2 \
    --boot order=cd \
    --hda /root/centos6.img \
    --cdrom /root/CentOS-6.9-x86_64-minimal.iso

3) Start the virtual machine and use vncview to view

# qemu-kvm -m 1024 -smp 2 -hda /root/centos6.img -daemonize
# vncview :5900

 

When executing vncviewer :5900, an error is reported: vncviewer: unable to open display "", because xshell does not have the forwarding function enabled.

Solution:
When using XShell to establish a connection, set the connection properties and check Forward X11 connections to: Xmanager under the SSH --> tunneling option.

After the setting is successful, log in to the remote Linux host and execute gtk-demo to test whether the interface can be displayed in the local window.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324986733&siteId=291194637