个人工具
119.28.94.63
该IP地址的讨论
登录
查看“UbuntuHelp:KVM/Installation”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:KVM/Installation”的源代码
来自Ubuntu中文
←
UbuntuHelp:KVM/Installation
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/KVM/Installation}} {{Languages|UbuntuHelp:KVM/Installation}} #title KVM Installation <<Include(KVM/Header)>> == Preflight check == === How to check if your CPU supports hardware virtualisation === To run KVM, you need a processor that supports virtualisation; Intel and AMD both have developed extensions for their processors, respectively INTEL-VT and AMD-V. To see if your processor supports one of these, you can run the following command: <pre><nowiki> egrep '(vmx|svm)' --color=always /proc/cpuinfo </nowiki></pre> If nothing is printed, it means that your CPU doesn't support hardware virtualisation. Otherwise, it does - but you still need to make sure that virtualisation is enabled in the BIOS. === Use a 64 bit kernel if you need more than 2GB RAM for your VMs === To serve more than 2047 MB of RAM for your VMs, you '''must''' use a 64 bit kernel (see [[UbuntuHelp:32bit_and_64bit|32bit_and_64bit]]). On a 32 bit kernel install, you'll be limited to 2GB RAM at maximum for a given VM. To see if your processor is 64 bit, you can run the following command: <pre><nowiki> grep ' lm ' /proc/cpuinfo </nowiki></pre> If nothing is printed, it means that your CPU is not 64 bit. ''lm'' stands for Long Mode, so 64 bit CPU. To see if your running kernel is 64 bit, just issue the following command: <pre><nowiki> uname -m </nowiki></pre> '''x86_64''' indicates a 64-bit kernel running. If you use see i386, i486, i586 or i686, you're running a 32 bit kernel. == Installation of KVM == For the following setup, we will assume that you are deploying KVM on a server, and therefore do not have any X server on the machine. You need to install a few packages first: <pre><nowiki> $ sudo apt-get install kvm libvirt-bin ubuntu-vm-builder qemu bridge-utils </nowiki></pre> * libvirt-bin provides libvirtd which you need to administer qemu and kvm instances using libvirt * kvm is the backend * ubuntu-vm-builder powerful command line tool for building virtual machines * bridge-utils provides a bridge from your network to the virtual machines You might also want to install ''virt-viewer'', for viewing instances '''8.10 (intrepid) Notes''': * Two meta packages have been added: <code><nowiki>ubuntu-virt-server</nowiki></code> and <code><nowiki>ubuntu-virt-mgmt</nowiki></code>. <code><nowiki>Ubuntu-virt-server</nowiki></code> installs the packages needed to setup a base virtulization host (kvm, libvirt-bin and openssh-server) and <code><nowiki>ubuntu-virt-mgmt</nowiki></code> installs what you need to administer it from a management station (virt-manager, python-vm-builder and virt-viewer). * <code><nowiki>ubuntu-vm-builder</nowiki></code> has been replaced by <code><nowiki>python-vm-builder</nowiki></code> ([[UbuntuHelp:JeOSVMBuilder|tutorial]]). '''Note:''' libdevmapper does not load its module when it is installed ([https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/277648 bug 277648]) , so you will either need to do a <code><nowiki> $ sudo modprobe dm-loop </nowiki></code> or reboot your system before being able to use it. === Adding Users === Add yourself to the ''libvirtd'' group (note that there is no need to add yourself to the ''kvm'' group): <pre><nowiki> $ sudo usermod -aG libvirtd `id -un` </nowiki></pre> This will give you access to the system-wide libvirtd instance. This is preferable for you because it gives you access to the advanced networking options rather than simply the "userspace networking" option as you may know it from QEmu. '''Note: You need to log out and log back in for the new group membership to take effect.''' Note: The `id -un` command will return the current username, for example if your username is ''joe'' you will be effectively be running ''sudo usermod -aG libvirtd joe''. You can test if your install has been successful with the following command: <pre><nowiki> $ virsh -c qemu:///system list Id Name State ---------------------------------- $ </nowiki></pre> If on the other hand you get something like this: <pre><nowiki> $ virsh -c qemu:///system list libvir: Remote error : Permission denied error: failed to connect to the hypervisor $ </nowiki></pre> Something is wrong and you probably want to fix this before you move on. The critical point here is whether or not you have write access to ''/var/run/libvirt/libvirt-sock''. '''Note: You should also run the kvm command as root, which should give you the help message of kvm. If you get an error message complaining about the lack of Hardware Acceleration, it is probably disabled at the bios level. You should be able to confirm that by reading the last line of dmesg which should say kvm: disabled at bios level.''' This is what it looks like when it works: <pre><nowiki> $ sudo kvm QEMU PC emulator version 0.9.1 (kvm-62), Copyright (c) 2003-2008 Fabrice Bellard usage: qemu [options] [disk_image] ... $ </nowiki></pre> You will get something like this when hardware acceleration is not supported by your CPU or disabled at bios level: <pre><nowiki> $ sudo kvm Could not initialize KVM, will disable KVM support Ubuntu does not support running KVM without hardware acceleration. Sorry. $ </nowiki></pre> == Removing KVM == Removing kvm is pretty easy:<pre><nowiki> $ sudo apt-get purge kvm </nowiki></pre> This will unload the kvm modules, remove the kvm and purge its configuration (for example, files in /etc). If kvm was already removed, the following will finally purge it:<pre><nowiki> $ sudo dpkg -P kvm </nowiki></pre> <<Include(KVM/Header)>> --- [[category:CategoryVirtualization]] [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:KVM/Installation
。