ubuntu下安装kvm虚拟机

译者: royaso 原作者:howtogeek

发表时间:2013-02-03浏览量:5421评论数:0挑错数:0

ubuntu下安装kvm虚拟机,kvm是基于内核的虚拟机,可以安装windows系统哦。 ----------------------------- 快过年了,译者很惨没钱很难过,希望得到支持。本人喜欢折腾,玩过linux,ipad,网页制作,网站建设,翻译水平就这样了,看技术文没问题。可以提供博客空间,wordpress博客及建站,简单的网站扒皮换肤,期待有意者联系我,我的博客是 royaso.com 邮箱:zhang.royaso # gmail .com (#换成@),迫切等待中!!!

How to Install KVM and Create Virtual Machines on Ubuntu
ubuntu下安装kvm虚拟机
                                                                                                                                               p_w_picpath383.jpg
------------------------------

(译注:图片就不搬了,可以在源地址上看,也可以在我论坛上看

ubuntu下安装kvm虚拟机

http://bbs.royaso.com/forum.php?mod=viewthread&tid=108&fromuid=1
)
-------------------------------
If you’re using Linux, you don’t need VirtualBox or VMware to create virtual machines. You can use KVM – the kernel-based virtual machine – to run both Windows and Linux in virtual machines.

ubuntu下除了常见的虚拟机软件virtualbox和vmware外,还有基于内核的虚拟机kvm,可以安装windows和linux系统哦。


You can use KVM directly or with other command-line tools, but the graphical Virtual Machine Manager (Virt-Manager) application will feel most familiar to people that have used other virtual machine programs.

可以直接用命令行也就是终端来创建管理虚拟机,但如果你用过其他的虚拟机软件的话,有图形界面用得会更舒服点。


Installing KVM(安装)KVM only works if your CPU has hardware virtualization support – either Intel VT-x or AMD-V. To determine whether your CPU includes these features, run the following command:

egrep -c ‘(svm|vmx)’ /proc/cpuinfo

A 0 indicates that your CPU doesn’t support hardware virtualization, while a 1 or more indicates that it does. You may still have to enable hardware virtualization support in your computer’s BIOS, even if this command returns a 1 or more.

KVM要求电脑支持cpu虚拟化,Intel的VT-x或者AMD-V都可以。用下面的命令查看
egrep -c '(svm|vmx)' /proc/cpuinfo
如果返回的不是A或者0而是其他的就说明你的电脑是支持cpu虚拟化的,也就是可以安装kvm。当然,你需要在主板BIOS开启相关的设置。


p_w_picpath384.jpg


Use the following command to install KVM and supporting packages. Virt-Manager is a graphical application for managing your virtual machines — you can use the kvm command directly, but libvirt and Virt-Manager simplify the process.

下面的命令是安装kvm的


sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager



Only the root user and users in the libvirtd group have permission to use KVM virtual machines. Run the following command to add your user account to the libvirtd group:

只有root用户和libvirtd用户组才有权限使用kvm虚拟机,所以用下面的命令添加用户到libvirtd用户组。

sudo adduser name libvirtd


p_w_picpath385.jpg



After running this command, log out and log back in. Run this command after logging back in and you should see an empty list of virtual machines. This indicates that everything is working correctly.

添加完成后,推出登录然后再登录,运行下面命令,没问题的话就说明没问题了。(笑)

virsh -c qemu:///system list


p_w_picpath386.jpg


Creating Virtual Machines(建立虚拟机)Once you’ve got KVM installed, the easiest way to use it is with the Virtual Machine Manager application. You’ll find it in your Dash.

在dash里打开kvm虚拟机准备安装系统吧


p_w_picpath387.jpg



Click the Create New Virtual Machine button on the toolbar and the Virtual Machine Manager will walk you through selecting an installation method, configuring your virtual machine’s virtual hardware, and installing your guest operating system of choice.

点新建,然后跟着指示一步步走:选择安装方式(译注:一般是iso文件安装),设置系统硬件,安装所选系统。

p_w_picpath388.jpg



The process will by familiar if you’ve ever used VirtualBox, VMware, or another virtual machine application. You can install from a disc, ISO p_w_picpath, or even a network location.

用过vb或vm的都很熟悉这个过程了。可以选择用那个iso镜像文件安装,甚至网络安装!!(译注:你很牛哦)

p_w_picpath389.jpg


To assign more than 2GB of memory to a virtual machine, you’ll need a 64-bit Linux kernel. Systems running 32-bit kernels can assign a maximum of 2 GB of RAM to a virtual machine.

32位系统只能分配最多2g内存,只有64位才可以分配更多。


p_w_picpath390.jpg


By default, KVM gives you NAT-like bridged networking – your virtual machine won’t appear on the network as its own device, but it will have network access through the host operating system. If you’re running server software in your virtual machine and want it accessible from other devices on the network, you’ll have to tweak the networking settings.

一般kvm是用nat方式联网的,这种联网方式好处是几乎不用怎么设置就可以上网了,不足就是此虚拟机对外是不可见的,(译注:不过一般够我们用的了),其他的联网方式各有各的好处,自己google吧。


p_w_picpath391.jpg


After selecting your installation method, Virt-Manager will boot the guest operating system in a window. Install the guest operating system as you would on a physical machine.

接下来的安装就跟安装新系统一模一样了。


p_w_picpath392.jpg

Managing Virtual Machines(管理虚拟机)

The Virtual Machine Manager window displays a list of your installed virtual machines. Right-click virtual machines in the window to perform actions, including starting, shutting down, cloning, or migrating them.

在列出的虚拟机上右键可以看到各种命令:开启,关闭,克隆,迁移



p_w_picpath393.jpg


You can view information about the virtual machine and configure its virtual hardware by clicking the i-shaped toolbar icon in the virtual machine’s window.

向下图所示的I图标点击可以设置虚拟机的硬件配置


p_w_picpath394.jpg

------------------