KVM Virtual Technology Configuration installation method

Source: Internet
Author: User
Tags svm

1. Installing the KVM
    • GREP-E-o ' vmx|svm '/proc/cpuinfo #检查服务器是否支持虚拟化 (VMX is Interl platform, SVM is AMD platform)
    • #安装KVM所需软件包:
    • Yum Groupinstall KVM or yum install KVM KMOD-KVM qemu kvm-qemu-img virt-viewer virt-manager libvirt Libvirt-python python-v Irtinst bridge-utils
    • Lsmod |grep KVM #检查是否安装成功 indicates successful installation
2. Installing VNC
  • Rpm-qa | grep vnc-server #检查系统是否安装 ("package Vnc-server was not installed" stating that the VNC server was not installed)
  • Yum install tigervnc-server fontforge-y #安装tigervnc-server and font compilers (prevents remote garbled)
  • Vncserver
  • Yum Groupinstall desktop-y #安装桌面环境
  • VNCPASSWD #配置vncserver password, sometimes not worthy of the server
  • Vncserver #重新加载服务唤醒配置文件
  • VI ~/.vnc/xstartup# to its own installed desktop environment, TWM & Comments Off new plus gnome-session &
    • # TWM &

    • Gnome-session &

    Vi/etc/sysconfig/vncserver #更改默认登陆用户和远程分辨率 VNC configuration file
    • Vncservers= "1:root" # (Desktop Number: User), configure the boot number desktop
    • vncserverargs[2]= "-geometry 1024x768-nolisten tcp-localhost" #800x600表示桌面的分辨率
    Note: 1. Turn off SELinux
      • 2.iptables release 5901 port [Vi/etc/sysconfig/iptables (add as follows-A input-m state--state new-m tcp-p TCP--dport 5901-j ACCEPT)]
3. Add a bridge port configuration (mainly for the virtual machine installed in the KVM virtual machine, can be connected with the real machine and can go out) # (virtual machine when you choose to bridge the network, you need a host (real machine) to create a shared bridging network device, which is the network Bridge. If the host's physical NIC name is eth0, the virtual bridging device is created)
  • Cp/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-script/ifcfg-br0 #创建桥口br0
  • Vi/etc/sysconfig/network-scripts/ifcfg-br0
  • Device= "Br0"
  • bootproto= "Static"
  • #HWADDR = "....."---"." # before adding the pound sign to comment out the MAC address, because it is a copy of the eth0
  • onboot= "Yes"
  • Type= "Bridge"
  • ipaddr=x.x.x.x
  • netmask=x.x.x.x
  • gateway=x.x.x.x
  • Vi/etc/sysconfig/network-scripts/ifcfg-eth0
  • Device= "Eth0"
  • bootproto= "Static"
  • Hwaddr= "...... ......." # Default
  • onboot= "Yes"
  • Type= "Ethernet"
  • ipaddr=x.x.x.x
  • netmask=x.x.x.x
  • gateway=x.x.x.x
  • Bridge= "Br0"
  • Create bradd.sh #在该脚本中添加如下命令
      • Brctl Bradd br0 #添加网桥
      • Br0 brctl addif br0 eth0 #添加eth0 to Br0
      • Service Network Restart #重启网卡
      • Service LIBVIRTD Restart #重启libvirtd
  • chmod 755 addbr.sh #给bradd. SH gives execute permission
  • Nohup./bradd.sh & #在后台运行该脚本中上述指令

Close Networkmanager:service NetworkManager Stop
    • After the completion of the bradd.sh in the directory found in the Nohup.out log operation logs, can help to determine where the error

4. Access the host management virtual host through the Vncview tool

1. In the terminal input: Virt-manger Open the graphical management program,

2. Click on the "Create a new virtual machine" button to open the New VM Wizard and the virtual machine name and installation method, the installation method can choose ISO, CD, PEX, etc.

3. Install the media path, select the specific optical drive or ISO file path and operating system

4. Configuring CPU and Memory Parameters

5. Configure the storage parameters, you can choose to create a new virtual storage file, or you can choose to use the current existing storage device, the default virtual machine image file path is:/var/lib/libvirt/images

6. Configure network, architecture and other hardware parameters, network selection bridge bridging enables virtual machines to access external networks directly

6. Install and deploy the virtual machine system

5. Tips for using the Virtual Machine Manager command Tool

  • Virsh List--all #查看所有虚拟主机列表
  • Virsh autostart CentOS #设置centos虚拟主机开机自动启动
  • Virsh dumpxml CentOS > Centos.xml #备份centos虚拟主机的配置文件 and backed up in XML; Before you create a new virtual host with Centos.xml, you need to modify some information,<name> </name> define the name of the virtual host <uuid></uuid> define the virtual host unique sequence number <mac address/> defines the MAC address of the virtual host, which is the content that must be modified, Where UUID can be generated using Uuidgen.
  • Virsh Create Centos.xml #使用centos. XML creating a new virtual host
  • Virsh Dominfo # View basic information for a virtual host with ID 1
  • Virsh start CentOS #开启centos这台虚拟主机
  • Virsh setmaxmen CentOS 2097152--config # Set the maximum memory value of the CentOS virtual host
  • Virsh setmem CentOS 2097152--config #设置centos虚拟主机内存大小
  • Virsh Setcpus CentOS 2--config #设置centos虚拟主机cpu个数
  • Virsh net-list #查看default网络配置文件
  • Virsh net-dumpxml default > Bank-net.xml #备份default网络配置文件, and saved as Bank-net.xml

KVM Virtual Technology Configuration installation method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.