Virtualization analysis in Ubuntu

Source: Internet
Author: User
Tags virtual environment egrep
Virtualization analysis virtual machine (VM) in Ubuntu is a computer running on the virtual layer, usually called hypervisor. It does not really exist, but it can work like a real computer. The virtual layer running on the virtual machine determines the virtual interface of the virtual machine...
Virtualization analysis virtual machine (VM) in Ubuntu is a computer running on the virtual layer, usually called hypervisor. It does not really exist, but it can work like a real computer. The virtual layer of the virtual machine determines the virtual interface of the virtual machine. for operating systems running on the virtual machine, they are the corresponding Nic, memory, and hard disk. In a sense, virtual machines make the guest operating system mistakenly think that it is running on a specific physical device. these physical devices are actually simulated by virtual software, the virtual software is responsible for processing the interaction with the actual hardware. This is called hardware simulation. There is a compromise in www.2cto.com virtual technology. Some virtual software runs on the operating system layer. this virtualization features poor flexibility and high speed and performance on the local machine. In addition, some virtual software runs directly or almost equal to bare metal, that is, the virtual software is either part of the operating system kernel or runs as an operating system, there is no other software layer between virtual software and physical hardware resources. This method is faster. KVMKVM (Kernel-based Virtual Machine) is part of the Linux Kernel. KVM does not provide hardware simulation, but only provides underlying operations. To run KVM, the processor must support hardware virtualization. Both Intel and AMD have introduced processor extensions to support hardware virtualization, including IntelVT-x and AMD-V. Run the following command www.2cto.com to check whether the CPU supports hardware virtualization: egrep-c '(vmx | svm)'/proc/cpuinfo. the returned value is 0, indicating that the CPU does not support hardware virtualization; 1 or higher indicates CPU support. In general, hardware virtualization extensions are disabled by default and must be enabled by entering the BIOS settings. Take X200 as an example to modify the BIOS: boot F12-> BootMenu-> -> Config-> CPU-> select Intel (R) Virtualization Technology as EnabledIntel (R) run the following VT-d Feature command to check whether the processor is a 64-bit egrep-c 'LM '/proc/cpuinfo. the returned value is 0, indicating that the CPU is not a 64-bit CPU, if the returned value is 1 or higher, the return value is 64-bit. Check whether the installed Ubuntu kernel is 64-bit. the following command uname-mx86_64 indicates that the system is 64-bit kernel, i386, i38, i586 or i686 indicates that the Linux kernel is 32-bit. Www.2cto.com: cat/etc/lsb-release check Linux kernel version cat/proc/version install kvm-OK check kvm status sudo apt-get install cpu-checker enter sudo kvm-OK on the terminal to check CPU current status. If the CPU does not support hardware virtualization, return: INFO: Your CPU does NOT support KVM extensionsKVM acceleration can not be used.
When the CPU supports hardware Virtualization but is not enabled, the system returns: INFO: Your CPU supports KVM extensionsINFO: KVM (vmx) is disabled by your BIOSHINT: Enter your BIOS setup and enable Virtualization Technology (VT ), and then hard power off/power on your systemKVM acceleration can NOT be used
When the CPU supports hardware virtualization and is enabled normally, the system returns INFO:/dev/kvm does not existHINT: sudo modprobe kvm_intelINFO: your CPU supports KVM extensionsKVM acceleration can be used www.2cto.com install kvmsudo apt-get install qemu-kvm libvirt-bin guest Inst bridge-utils where qemu-kvm is a required KVM user space component libvirt-bin is a binary C toolbox that interacts with Linux virtual functions, supports not only KVM, but also XEN and VirtualBox. Virtinst is a series of command line tools used to create VMs. bridge-utils is a tool set used to configure Linux Ethernet links. In addition, virt-viewer can be installed to provide a GUI and VNC interface for VMs; virt-manager provides a GUI for managing VMs. After installation, you can find it on the Dash homepage. By default, network services can be used by the operating system installed with KVM, but are invisible to other computers on the network, that is, they cannot be accessed as servers by other systems. By default, the VMs IP address range is 10.0.2.0/24, and the customer's operating system can access the host through 10.0.2.2. If you want to change the network settings so that virtual machines can be accessed by the outside world, you need to establish a network connection to make them visible to other systems on the network. Note that you need to use the default network manager to control the hardware you have created. this method is feasible for wired networks and unavailable for wireless networks. First install libcap2-bin. Then you need to grant the QEMU permission to manage the network by setting cap_net_admin.
Run the following command to set a 64-bit system: sudo setcap cap_net_admin = ei/usr/bin/qemu-system-x86_6432-bit system: sudo setcap cap_net_admin = ei/usr/bin/qemu-system-i386 then add the following lines in/etc/network/interfaces and use DHCP to create a bridge interface br0: auto br0iface br0 inet dhcp Bridge_portseth 0 Bridge_stp off Bridge_fd 0 Bridge_maxwait 0: run the following command to restart the network: sudo/etc/init. d/networking restart. Finally, you need to create the customer VMs through the bridge network. Use this new br0 interface to manually define your customer operating system, which is the same as what you usually define in the operating system. There are several ways to create a VM through KVM at www.2cto.com. One of the methods is through vmbuilder. Run the sudo apt-get install python-vm-builder command to install the SDK. The two parameters required by Vmbuilder are the virtual software name and the operating system name to be used. Vmbuilder is very powerful. you can enter vmbuilder kvm ubuntu -- help in the command line. The example here is based on KVM and Ubuntu12.04 LTSsudo vmbuilder kvm ubuntu -- suite precise -- flavor virtual -- arch i386-o -- libvirt qemu: // system -- ip 192.168.0.100 -- hostname lovelace -- bridge br0 -- suite specifies the Ubuntu release version, -- flavor specifies that we want to use the virtual kernel (this is used to build the JeOS image ), -- arch indicates that we want to create a 32-bit machine.-o needs vmbuilder to overwrite the VM of the previous version. -- libvirt reports the local virtual environment, add the result VM to the valid machine list. Vmbuilder has powerful functions and is more suitable for basic users. In addition, we can use virtinst for KVM usage and configuration. Virtinst includes many tools. here we will briefly introduce virt-install and virt-clone. The former is used to create virtual machines, and the latter is used to copy existing virtual machines. We can use virt-install to implement the function of using vmbuilder just now. The difference is that the parameter options are different. In addition, virt-install allows you to create a desktop image containing the GUI, which can be accessed by VNC.
Sudo virt-install-n hopper-r 512 -- disk path =/var/lib/libvirt/images/hopper. img, size = 20-c/dev/cdrom -- accelerate -- connect = qemu: // system -- vnc -- noautoconsole-v-n hopper defines the virtual machine name; -r 512 specifies the memory allocated to the VM, in MB; -- disk path =... it is the path of a virtual hard disk. it can be a file, a partition, or a logical space. In the/var/lib/libvirt/images Directory, a 20 GB file named hopper is created. img;-c/dev/cdrom is the host's CD-ROM device path, or you can use an ISO file; -- accelerate enables kernel acceleration; -- connect defines the hypervisor used; -- Customers in vnc VNC virtual console are everywhere; -- noautoconsole prevents automatic links to the virtual machine console;-v creates a fully virtualized customer. To copy a virtual machine, you can use virt-clonesudo virt-clone-o hopper-n knuth-f/var/lib/libvirt/images/knuth. img -- connect = qemu: // system-o hopper defines the name of the source virtual machine;-n knuth defines the name of the target virtual machine; -f defines the path of the file/partition/logical space used by the new virtual machine; -- connect defines the hypervisor used. To open a virtual machine at www.2cto.com, run the virsh-c qemu: // system start hopper command to close a virtual machine and run the virsh-c qemu command: /// system shutdown hopper when the virtual machine is installed and running, you can connect it through the configured IP address. You can also use the GUI virt-view-c qemu: // system hopper. you can use the GUI to manage your virtual machine virt-manager-c qemu: /// other commonly used virtual software of system includes VirtualBox, VMware, and Xen. VirtualBox is easy to use. you can download it from the Ubuntu software library, or download the latest software from the www.virtualbox.org/wiki/downloadswebpage. VMware is a paid enterprise-level virtual platform. Ubuntu currently does not support Xen.
 
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.