Ubuntu12.04 install KVM

Source: Internet
Author: User
To virtualize multiple external tuservers on a server, it is used for the cluster. Several solutions have been taken into consideration. Because of the exclusion of the price, VirtualBox is good, but KVM is a Linux kernel layer and delivers better performance. Use is preferred. First, install Ubuntu12.04amd64server on an experimental machine. Upgrade the system patch and kernel. The hostname is kvmhost. The IP address is 10.112.18.177. The virtualization function is enabled on the motherboard.

To virtualize multiple Ubuntu servers on one server, it is used for clusters. Several solutions have been taken into consideration. Because of the exclusion of the price, VirtualBox is good, but KVM is a Linux kernel layer and delivers better performance. Use is preferred.

First, install Ubuntu 12.04 amd64 server on an experimental machine. Upgrade the system patch and kernel. The hostname is kvmhost. The IP address is 10.112.18.177. The virtualization function is enabled on the motherboard.

Okay. Install kvm now.

Switch sudo-s to the root permission.

Run the following command to check whether the cpu supports Virtualization:

  1. Root @ kvmhost :~ # Egrep '(vmx | svm)' -- color = always/proc/cpuinfo
  2. Flags: fpu vme de pse tsc msr pae mce cx8 apic sep limit pge mca cmov pat limit 36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm limit pebs bts rep_good nopl limit aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm dts tpr_shadow vnmi flexpriority ept vpid
  3. Flags: fpu vme de pse tsc msr pae mce cx8 apic sep limit pge mca cmov pat limit 36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm limit pebs bts rep_good nopl limit aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm dts tpr_shadow vnmi flexpriority ept vpid
If nothing is displayed, you cannot play. Okay. I can continue.

Install the kvm and kvmbuilder scripts. This script is used to create a Ubuntu-based virtual machine.

  1. Apt-get install ubuntu-virt-server python-vm-builder kvm-ipxe

Add the current user to the kvm and libmongod groups

  1. Adduser 'id-UN' libmongod
  2. Adduser 'id-UN' kvm
Log out and log on again.

Run the following command to check whether kvm is successfully installed.

  1. Root @ kvmhost :~ # Virsh-c qemu: // system list
  2. Id Name State
  3. ----------------------------------
No error message. Installation is complete.

The following sets up the network to ensure that other hosts in the network can access the VM managed by kvm.

You may need to install bridge-utils, which is already available when I have installed the operating system on the experimental machine. No running command:

  1. Apt-get install bridge-utils

Edit the/etc/network/interface file. Before editing, my file is as follows:

  1. # This file describes the network interfaces available on your system
  2. # And how to activate them. For more information, see interfaces (5 ).
  3. # The loopback network interface
  4. Auto lo
  5. Iface lo inet loopback
  6. # The primary network interface
  7. Auto eth0
  8. Iface eth0 inet dhcp
To:
  1. # This file describes the network interfaces available on your system
  2. # And how to activate them. For more information, see interfaces (5 ).
  3. # The loopback network interface
  4. Auto lo
  5. Iface lo inet loopback
  6. # The primary network interface (disable)
  7. # Auto eth0
  8. # Iface eth0 inet dhcp
  9. # The primary network interface for kvm
  10. Auto eth0
  11. Iface eth0 inet manual
  12. Auto br0
  13. Iface br0 inet static
  14. Address 10.112.18.177
  15. Network 10.112.18.0
  16. Netmask 255.255.255.0
  17. Broadcast 10.112.18.255
  18. Gateway 10.112.18.1
  19. Dns-nameservers 8.8.8.8 8.8.4.4
  20. Bridge_ports eth0
  21. Bridge_fd 9
  22. Bridge_hello 2
  23. Bridge_maxage 12
  24. Bridge_stp off
Restart the network service

/Etc/init. d/networking restart


Check the network configuration.

  1. Root @ kvmhost:/etc/network # ifconfig
  2. Br0 Link encap: Ethernet HWaddr d0: 67: e5: ef: 5a: 0a
  3. Inet addr: 10.112.18.177 Bcast: 10.112.18.255 Mask: 255.255.255.0
  4. Inet6 addr: fe80: d267: e5ff: feef: 5a0a/64 Scope: Link
  5. Up broadcast running multicast mtu: 1500 Metric: 1
  6. RX packets: 58 errors: 0 dropped: 0 overruns: 0 frame: 0
  7. TX packets: 30 errors: 0 dropped: 0 overruns: 0 carrier: 0
  8. Collisions: 0 txqueuelen: 0
  9. RX bytes: 5961 (5.9 KB) TX bytes: 3662 (3.6 KB)
  10. Eth0 Link encap: Ethernet HWaddr d0: 67: e5: ef: 5a: 0a
  11. Up broadcast running multicast mtu: 1500 Metric: 1
  12. RX packets: 67318 errors: 0 dropped: 0 overruns: 0 frame: 0
  13. TX packets: 33515 errors: 0 dropped: 0 overruns: 0 carrier: 0
  14. Collisions: 0 FIG: 1000
  15. RX bytes: 91560174 (91.5 MB) TX bytes: 2626976 (2.6 MB)
  16. Interrupt: 17
  17. Lo Link encap: Local Loopback
  18. Inet addr: 127.0.0.1 Mask: 255.0.0.0
  19. Inet6 addr: 1/128 Scope: Host
  20. Up loopback running mtu: 16436 Metric: 1
  21. RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
  22. TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0
  23. Collisions: 0 txqueuelen: 0
  24. RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B)
  25. Virbr0 Link encap: Ethernet HWaddr 56: 21: fd: 02: 02: 35
  26. Inet addr: 192.168.122.1 Bcast: 192.168.122.255 Mask: 255.255.255.0
  27. Up broadcast multicast mtu: 1500 Metric: 1
  28. RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
  29. TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0
  30. Collisions: 0 txqueuelen: 0
  31. RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B)
Restart the computer.

Reboot

Log on again. The first part ends.

Related Article

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.