![]() ![]() ![]() ![]() Ubuntu KVM/QEMU Virtualization. Webmodelling Home> Ubuntu KVM Virtualization - how to.
Updated Jul 2. 01. This tutorial is a step- by- step guide how to get KVM virtualization to work on Ubuntu server. If you do not yet have an installed Ubuntu server, please see How to install Ubuntu. From now on I assume you already have an installed Ubuntu server and are ready to start virtualization. Install virtualization relevant packages. Configure networking for virtual machines. Install a virtual machine - not as easy as Virtual. Box or Hyper- V role. Appendixes : Relevant links : 1 : Install virtualization relevant packages Reboot your machine and enter the BIOS and find the virtualization parameter and be sure virtualization is enabled. Then your Ubuntu starts up either login as root or switch user to root (shell> su root). CPU supports KVM. If KVM is not supported you can still create virtual machines, but they will run slower, allegedly too slow for production purposes. To expose the VM for the outer world so it gives mening to host eg. ![]() Here is the server result schema : Server. Machine. VM name. Domain. IPFunction. Install method. Ubuntu server 1. VM hostalready installed. Windows 2. 00. 8r. Ubuntu server 1. 1. Virtual Shared 1)1. Run 'virt-viewer --help' to see a full list of available command line options Domain installation still in progress. You can reconnect to the console to complete the installation process. KVM: A full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V). Domain installation still in progress. Waiting for installation to complete. At this point, you are going to need to connect to the server via VNC I. Virtual Machines can be created using either . Ubuntu guest OS'es. Likely the best tool if you want only Ubuntu guest OS'es. OS'es - the tool I am going to demonstrate here. Lets get started . Create an appropriate directory structure . VMs; mkdir /var/VMs/ISOs; mkdir /var/VMs/VHDs : create a suitable folder structure. VMs : change directory to /var/VMs. Copy your guest OS isos to /var/VMs/ISOs (eg. That ISO installer is graphical and unless you install x- windows and a windows manager on your Ubuntu host server, eg. While it is possible to execute virt- install from a local console and then use a graphical remote console (eg. No need to install, Putty starts right away from the executable. Download Xming and install it (since the Ubuntu installer is graphical, you need a way to display X graphics on Windows - Xming is an X server for Windows). Start Xming and you should be able to see Xming in the windows taskbar notification area. Start Putty by double clicking the executable. Save and exit (ctrl+x and then y)shell> ./vminstall. Both the VM (Virtual Machine) and the VHD (Virtual Hard Drive) have been created and virt- install automatically boot on the specified iso file and loads virt- viewer to connect to the VM console, so you can interact with the installer. The new VM have booted on the Windows 2. Use Alt+Tab to activate another window and then again right click the Xming icon and this time select . If you had problems interacting with virt- viewer, it should be solved now. Since windows installer needs to restart but cannot, virt- install will report an error ERROR operation failed: could not query memory balloon allocation. This error is therefore expected, not really an error and can also be ignored. Virsh and confirm that the win. VM exists and then leave Virsh. Windows installer was restarted and is now completing and will reboot the VM. Since the windows OS is now installed, the boot process will not close virt- viewer and windows server 2. You need to specify an Administrator password. After you specified the Administrator password, windows desktop will load for the first time. We now need to confirm that network is working and also we want to enable Remote Desktop. Set a static IP address. Click on . Press Ok and Ok again and close down . Remote Desktop will be added to your firewall. Click Ok and Ok. Notice that Remote Desktop have been enabled. On your dev box click on Start > All Programs > Accessories > . The Administrator password you specified before then you first logged on to the server. Confirm that you want to connect by pressing the Yes button. Congratulation - you are in. Also notice that in your virt- viewer window that you are now logged out because only 1 Administrator can be logged on at the same time. Execute virt- install remote from an Ubuntu desktop. Open an Ubuntu desktop and start a terminal (here I use Ubuntu 1. Ubuntu host server (here on IP 1. You will be asked for the root password and if valid you will be logged on as root and get a prompt on the server. VMs : change directory to /var/VMs and check the content with ls - l. Save and exit (ctrl+x and then y)shell> ./vminstall. After installing the VM, virt- install will boot the VM on the specified iso file. The iso file contains the ubuntu installer which is graphical and virt- install therefore loads virt- viewer to connect to the VMs console, but we are on the ubuntu host server and there is no graphics there, so we get the error Cannot open display. This error is expected. Virsh to confirm that the php. VM is created. virsh> list - -all : list all virtual machines. You should see that php. Finish the installation off. You are back on your local terminal prompt. The VM may also have turned off, so you need to be sure that your new VM is turned on . Ubuntu host servershell> virsh : connect to virsh on the Ubuntu host server. VM was powered off. VMvirsh> list - -all : ok, php. Virsh and return to the Ubuntu host server prompt. Ubuntu host server prompt and return to the Ubuntu desktop prompt. Ubuntu desktop to the console of php. VM on the Ubuntu server. If your virt- viewer is unresponsive . F4. You should now have this. Login with the user you created then you installed the Ubuntu guest OS. You will be asked for your own password and then for the new password for the root user twice. Setting up network on the new Ubuntu guest OS . Ubuntu guest OS. default network configurationthe configuration we needshell> ifdown eth. Ubuntu version 1. Close virt- viewer. Ubuntu desktop terminal ssh into the php. VM. Congratulation - you are in. VM using Putty on a Windows desktop. Login as root and you will get a prompt on the virtual machine vs. Congratulation - you are in. Manage your virtual machines. The main tools for managing QEMU virtual machines are. Virsh command reference : a CLI tool for various operations, you cannot properly handle your VMs without virsh. Virtual Machine Manager GUI, but sadly inferior to Hyper- V and Virtual. Box GUI managers. Virsh. Here are the most important Virsh commands, however you can also consult the full Virsh command reference. VMTest : turns on the power of the virtual machine called VMTest. VMTest : sends the ACPI signal to the VMTest operating system - this will only turn off the VM if there is an OS installed (it seems somewhat buggy though). VMTest : turns off the power to the virtual machine - this will turn the VM off whether or not an OS is installed. VMTest : reboot the virtual machine. VMTest : deletes the /etc/libvirt/qemu/VMTest. VM before you can undefine it)virsh #> define /var/My. Xml. Definitions/VMText. VMTest. xml file. I think a new xml file will be created in /etc/libvirt/qemu named after the domain within the VMText. I need to test to be sure). VMTest : connect to the virtual machines console (since the console command will load virt- viewer, you need to run this from a remote ssh connection with graphics, eg from Putty/Xming or from an Ubuntu desktop terminal). VMTest : outputs the /etc/libvirt/qemu/VMTest. VM. virsh #> dumpxml VMTest > /var/VMs/VMTest. VMTest. xml file to another file /var/VMs/VMTest. VMTest : loads /etc/libvirt/qemu/VMTest. Vim - I use this only then I have copied the VM xml file, this typically means you have to edit the hardware address of the virtual network card as well as the source file of the virtual hard drive. VMTest : some info about the guest. VMTest : info about the virtual CPU of the guest. VMTest : VMTest will now automatically turn on then the host server boots up (you can see all autostarts in /etc/libvirt/qemu/autostart). VMTest : VMTest will now NOT automatically turn on the host server boots up. How to rename a virtual machine - some virsh commands in action. A virtual machine including it's name is defined in an xml file. We can define a brand new VM using just virsh define some. VMDefinition. xml, so our procedure will be to edit the VM xml file and reload the virtual machine based on that edited xml file. VMs/VHDs : navigate to the folder containing the virtual harddrives (your folder path may be different). VMOld. Name > VMNew. Name. xml : dump the xml defintion file and call it VMNew. Name. xml (since we are going to edit the . VMOld. Nameshell> virsh undefine VMOld. Name : delete the VM (any virtual harddrive(s) are NOT deleted). VMOld. Name VMNew. Name : change the name of your virtual harddrive file to reflect the new name of the virtual machine to which the harddrive belong. VMNew. Name. xml : load the VM xml definition file in the nano editor and edit the following . Number'>. < name> VMNew. Name< /name> : change the name.< devices>. VMs/VHDs/VMNew. Name'/> : change the virtual harddrive file name (if you changed it also). VMNew. Name. xml : make a brand new VM based on the VM defintion file, VMNew. Name. xml, just edited. VMNew. Name : start the new VMshell> virsh autostart VMNew. Name : if you want VMNew. Name to startup automatically then the host server starts. Appendix : How to clone a virtual machine. While installing a new VM is very fast it is often even faster to clone a VM. Imagine you have a well configured Ubuntu on a VM with many specialized packages and you want to have a new one nearly identical - then it could take a long time to install and configure, but cloning would just take a moment. Here I am cloning the u. Ubuntu- 4) virtual machine calling the new cloned virtual machine for u. Start Xming. Make a remote Putty connection to the host server with X1. Login as root. On the host OS use Virsh to power off the VM you want to clone - here u. VMs/VHDs/u. 5 : clone u. VM for u. 5. - -connect : specify the hypervisor to connect to - here qemu: ///system.- o : original VM - here u. Virtualization With KVM On A Cent. OS 6. 4 Server. Version 1. Author: Falko Timme Follow me on Twitter. This guide explains how you can install and use KVM for creating and running virtual machines on a Cent. OS 6. 4 server. I will show how to create image- based virtual machines and also virtual machines that use a logical volume (LVM). KVM is short for Kernel- based Virtual Machine and makes use of hardware virtualization, i. CPU that supports hardware virtualization, e. I do not issue any guarantee that this will work for you! Preliminary Note. I'm using a Cent. OS 6. 4 server with the hostname server. IP address 1. 92. KVM host. I had SELinux disabled on my Cent. OS 6. 4 system. I didn't test with SELinux on; it might work, but if not, you better switch off SELinux as well: vi /etc/selinux/config. Set SELINUX=disabled..# This file controls the state of SELinux on the system. I'm using a Fedora 1. Installing KVMCent. OS 6. 4 KVM Host: First check if your CPU supports hardware virtualization - if this is the case, the commandegrep '(vmx. Create the file /etc/sysconfig/network- scripts/ifcfg- br. IPADDR, PREFIX, GATEWAY, DNS1 and DNS2 values from the /etc/sysconfig/network- scripts/ifcfg- eth. TYPE=Bridge, not TYPE=Ethernet: vi /etc/sysconfig/network- scripts/ifcfg- br. DEVICE=. I'm assuming that you're using a Fedora 1. Take a look atman virt- installto learn how to use virt- install. We will create our image- based virtual machines in the directory /var/lib/libvirt/images/ which was created automatically when we installed KVM in chapter two. To create a Debian Squeeze guest (in bridging mode) with the name vm. MB of RAM, two virtual CPUs, and the disk image /var/lib/libvirt/images/vm. GB), insert the Debian Squeeze Netinstall CD into the CD drive and runvirt- install - -connect qemu: ///system - n vm. Of course, you can also create an ISO image of the Debian Squeeze Netinstall CD (please create it in the /var/lib/libvirt/images/ directory because later on I will show how to create virtual machines through virt- manager from your Fedora desktop, and virt- manager will look for ISO images in the /var/lib/libvirt/images/ directory).. You can reconnect tothe console to complete the installation process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
October 2016
Categories |