Install kvm in Ubuntu12.04

Source: Internet
Author: User


Install kvm in Ubuntu to virtualize multiple Ubuntu servers on one server for 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. Www.2cto.com first installs 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: [plain] root @ kvmhost :~ # Egrep '(vmx | svm)' -- color = always/proc/cpuinfo 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 flexprior Ity ept vpid www.2cto.com 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 is not 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. [Plain] apt-get install ubuntu-virt-server python-vm-builder kvm-ipxe Add the current user to kvm and libcmdd [plain] adduser 'id-un 'libcmdd adduser after 'id-UN' kvm www.2cto.com exits, log on again. Run the following command to check whether kvm is successfully installed. [Plain] root @ kvmhost :~ # Virsh-c qemu: // system list Id Name State -------------------------------------- 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. Run the command: [plain] apt-get install bridge-utils to edit the/etc/network/interface file. My files are as follows before editing: [plain] # This file describes the network interfaces available on your system # and how to activate them. for more information, see interfaces (5 ). www.2cto.com # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp is changed: [plain] # This file describes the network interfaces available on your system # and how to activate them. for more information, see interfaces (5 ). # The loopback network interface auto lo iface lo inet loopback # The primary network interface (disable) # auto eth0 # iface eth0 inet dhcp # The primary network interface for kvm auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address routing network 10.112.18.0 netmask limit 255.255.0 broadcast Protocol gateway subnet dns- nameservers 8.8.8.8 8.4.4 bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off restart the network service/etc/init. d/networking restart www.2cto.com and then check the network configuration [plain] root @ kvmhost:/etc/network # ifconfig br0 Link encap: Ethernet HWaddr d0: 67: e5: ef: 5a: 0a inet addr: Invalid Bcast: 10.112.18.255 Mask: 255.255.255.0 inet6 addr: fe80: d267: e5ff: feef: 5a0a/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 58 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 30 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 5961 (5.9 KB) TX bytes: 3662 (3.6 KB) eth0 Link encap: Ethernet HWaddr d0: 67: e5: ef: 5a: 0a up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 67318 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 33515 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 RX bytes: 91560174 (91.5 MB) TX bytes: 2626976 (2.6 MB) Interrupt: 17 lo Link encap: Local Loopback inet addr: 127.0.0.1 Mask: 255.0.0.0 inet6 addr ::: 1/128 Scope: Host up loopback running mtu: 16436 Metric: 1 RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B) www.2cto.com virbr0 Link encap: Ethernet HWaddr 56: 21: fd: 02: 02: 35 inet addr: 192.168.122.1 Bcast: 192.168.122.255 Mask: 255.255.255.0 up broadcast multicast mtu: 1500 Metric: 1 RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B) restart the computer. reboot

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.