文档章节

virtualization-with-kvm-on-a-centos-6.4

异类深呼吸
 异类深呼吸
发布于 2014/07/04 08:52
字数 650
阅读 66
收藏 3

<h2 style="margin: 1.5em 0px 1em; padding: 0.5em 0px 0px; -webkit-print-color-adjust: exact; border-width: 4px 0px 0px; border-top-style: solid; border-top-color: #e0e0e0; font-size: 20px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">1、Preliminary Note</h2> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px;">看了许多文章,觉得这篇比较通俗易懂,摘抄原文地址 <a style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; color: #4183c4; text-decoration: none;" href="http://www.howtoforge.com/virtualization-with-kvm-on-a-centos-6.4-server">virtualization-with-kvm-on-a-centos-6.4-server</a></p> <blockquote style="margin: 1em 0px; padding: 0px 0px 0px 0.6em; -webkit-print-color-adjust: exact; border-left-width: 5px; border-left-color: #dddddd; color: #555555; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;"> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em;">I'm using a CentOS 6.4 server with the hostname server1.example.com and the IP address 192.168.0.100 here as my KVM host.</p> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em;">I had SELinux disabled on my CentOS 6.4 system. I didn't test with SELinux on; it might work, but if not, you better switch off SELinux as well:</p> </blockquote> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">vi /etc/selinux/config <br />Set SELINUX=disabled... <br /><br /># enforcing - SELinux security policy is enforced. <br /># permissive - SELinux prints warnings instead of enforcing. <br /># disabled - No SELinux policy is loaded. </code></pre> <h2 style="margin: 1.5em 0px 1em; padding: 0.5em 0px 0px; -webkit-print-color-adjust: exact; border-width: 4px 0px 0px; border-top-style: solid; border-top-color: #e0e0e0; font-size: 20px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">2、Installing KVM</h2> <blockquote style="margin: 1em 0px; padding: 0px 0px 0px 0.6em; -webkit-print-color-adjust: exact; border-left-width: 5px; border-left-color: #dddddd; color: #555555; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;"> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em;">First check if your CPU supports hardware virtualization</p> </blockquote> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">egrep '(vmx|svm)' --color=always /proc/cpuinfo </code></pre> <blockquote style="margin: 1em 0px; padding: 0px 0px 0px 0.6em; -webkit-print-color-adjust: exact; border-left-width: 5px; border-left-color: #dddddd; color: #555555; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;"> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em;">If nothing is displayed, then your processor doesn't support hardware virtualization, and you must stop here.</p> </blockquote> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px;">To install KVM and virtinst (a tool to create virtual machines)</p> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">yum install kvm libvirt python-virtinst qemu-kvm </code></pre> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px;">Then start the libvirt daemon:</p> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">/etc/init.d/libvirtd start </code></pre> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px;">To check if KVM has successfully been installed, run</p> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">virsh -c qemu:///system list </code></pre> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">[root@server1 ~]# virsh -c qemu:///system list <br />Id Name State <br />---------------------------------- </code></pre> <h2 style="margin: 1.5em 0px 1em; padding: 0.5em 0px 0px; -webkit-print-color-adjust: exact; border-width: 4px 0px 0px; border-top-style: solid; border-top-color: #e0e0e0; font-size: 20px; font-family: helvetica, arial, freesans, clean, sans-serif; line-height: 18px;">3、Install bridge</h2> <blockquote style="margin: 1em 0px; padding: 0px 0px 0px 0.6em; -webkit-print-color-adjust: exact; border-left-width: 5px; border-left-color: #dddddd; color: #555555; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;"> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em;">Next we need to set up a network bridge on our server so that our virtual machines can be accessed from other hosts as if they were physical systems in the network.</p> </blockquote> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">yum install bridge-utils </code></pre> <blockquote style="margin: 1em 0px; padding: 0px 0px 0px 0.6em; -webkit-print-color-adjust: exact; border-left-width: 5px; border-left-color: #dddddd; color: #555555; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px;"> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em;">and configure a bridge. Create the file /etc/sysconfig/network-scripts/ifcfg-br0 (please use the IPADDR, PREFIX, GATEWAY, DNS1 and DNS2 values from the /etc/sysconfig/network-scripts/ifcfg-eth0 file); make sure you use TYPE=Bridge, not TYPE=Ethernet:</p> </blockquote> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">vi /etc/sysconfig/network-scripts/ifcfg-br0 <br /> DEVICE="br0" <br /> NM_CONTROLLED="yes" <br /> ONBOOT=yes <br /> TYPE=Bridge <br /> BOOTPROTO=none <br /> IPADDR=192.168.0.100 <br /> PREFIX=24 <br /> GATEWAY=192.168.0.1 <br /> DNS1=8.8.8.8 <br /> DNS2=8.8.4.4 <br /> DEFROUTE=yes <br /> IPV4_FAILURE_FATAL=yes <br /> IPV6INIT=no <br /> NAME="System br0" </code></pre> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">vi /etc/sysconfig/network-scripts/ifcfg-eth0<br /> DEVICE="eth0" <br /> #BOOTPROTO=none <br /> NM_CONTROLLED="yes" <br /> ONBOOT=yes <br /> TYPE="Ethernet" <br /> UUID="73cb0b12-1f42-49b0-ad69-731e888276ff" <br /> HWADDR=00:1E:90:F3:F0:02 <br /> #IPADDR=192.168.0.100 <br /> #PREFIX=24 <br /> #GATEWAY=192.168.0.1 <br /> #DNS1=8.8.8.8 <br /> #DNS2=8.8.4.4 <br /> DEFROUTE=yes <br /> IPV4_FAILURE_FATAL=yes <br /> IPV6INIT=no <br /> NAME="System eth0" <br /> BRIDGE=br0 #这里使用桥接模式 </code></pre> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">/etc/init.d/network restart </code></pre> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">[root@server1 ~]# ifconfig <br />br0 Link encap:Ethernet HWaddr 00:1E:90:F3:F0:02 <br /> inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0 <br /> inet6 addr: fe80::21e:90ff:fef3:f002/64 Scope:Link <br /> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 <br /> RX packets:8 errors:0 dropped:0 overruns:0 frame:0 <br /> TX packets:27 errors:0 dropped:0 overruns:0 carrier:0 <br /> collisions:0 txqueuelen:0 <br /> RX bytes:460 (460.0 b) TX bytes:2298 (2.2 KiB) <br /><br />eth0 <br /> Link encap:Ethernet HWaddr 00:1E:90:F3:F0:02 <br /> inet6 addr: fe80::21e:90ff:fef3:f002/64 Scope:Link <br /> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 <br /> RX packets:18455 errors:0 dropped:0 overruns:0 frame:0 <br /> TX packets:11861 errors:0 dropped:0 overruns:0 carrier:0 <br /> collisions:0 txqueuelen:1000 <br /> RX bytes:26163057 (24.9 MiB) TX bytes:1100370 (1.0 MiB) <br /> Interrupt:25 Base address:0xe000 <br /></code></pre> <p style="margin: 1em 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: 1.5em; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px;">如果能成功看到此,KVM基础环境安装就完成了,也就是这台机器上安装好了KVM套件,可以被一些虚拟化套件直接来管理这台机器,下面就应该安装一些KVM的管理工具,或者相关套件,比如virt-manager管理工具,或者convirture图形化管理等等,后期将结合covirture进行简单的一个虚拟化的生产环境的应用</p>

© 著作权归作者所有

共有 人打赏支持
异类深呼吸
粉丝 5
博文 46
码字总数 42368
作品 0
朝阳
系统管理员
[linux][KVM]

How to Create Virtual Machines in Linux Using KVM (Kernel-based Virtual Machine) – Part 1 by Mohammad Dosoukey | Published: January 12, 2015 | Last Updated: February 26, 2015 ......

active_health
2016/08/03
6
0
在 Centos7 的KVM上启用嵌套虚拟化

嵌套虚拟化意味着在虚拟机内配置虚拟化环境。换句话说,我们可以说嵌套虚拟化是虚拟机管理程序hypervisor的一个特性,它允许我们通过虚拟化管理程序(宿主机)的硬件加速在虚拟服务器内安装和...

linux-tao
01/13
0
0
在centos 7系统中制作kvm镜像

项目的需求,需要制作kvm虚拟机镜像。在网上查找了一些资料并经过实际的配置操作。下面简单说明一下步骤,以供参考。 准备iso镜像 目前制作镜像考虑不考虑从无到有,只是在已有镜像的基础上加...

Endzzz
2017/12/08
0
0
Linux中KVM虚拟机是什么

概念: Kernel-based Virtual Machine的简称,是一个开源的系统虚拟化模块,自Linux 2.6.20之后集成在Linux的各个主要发行版本中。它使用Linux自身的调度器进行管理,所以相对于Xen,其核心源...

easonjim
01/27
0
0
KVM(一) Centos 安装KVM

简介: Kernel-based Virtual Machine的简称,是一个开源的系统虚拟化模块,自Linux 2.6.20之后集成在Linux的各个主要发行版本中。它使用Linux自身的调度器进行管理,所以相对于Xen,其核心源...

vincent927
2016/03/10
138
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

Ubuntu18.04 显卡GF-940MX安装NVIDIA-390.77

解决办法: 下面就给大家一个正确的姿势在Ubuntu上安装Nvidia驱动: (a)首先去N卡官网下载自己显卡对应的驱动:www.geforce.cn/drivers (b)下载后好放在英文路径的目录下,怎么简单怎么来...

AI_SKI
今天
0
0
深夜胡思乱想

魔兽世界 最近魔兽世界出了新版本, 周末两天升到了满级,比之前的版本体验好很多,做任务不用抢怪了,不用组队打怪也是共享拾取的。技能简化了很多,哪个亮按哪个。 运维 服务器 产品 之间的...

Firxiao
今天
0
0
MySQL 8 在 Windows 下安装及使用

MySQL 8 带来了全新的体验,比如支持 NoSQL、JSON 等,拥有比 MySQL 5.7 两倍以上的性能提升。本文讲解如何在 Windows 下安装 MySQL 8,以及基本的 MySQL 用法。 下载 下载地址 https://dev....

waylau
今天
0
0
微信第三方平台 access_token is invalid or not latest

微信第三方开发平台code换session_key说的特别容易,但是我一使用就带来无穷无尽的烦恼,搞了一整天也无济于事. 现在记录一下解决问题的过程,方便后来人参考. 我遇到的这个问题搜索了整个网络也...

自由的开源
今天
2
0
openJDK之sun.misc.Unsafe类CAS底层实现

注:这篇文章参考了https://www.cnblogs.com/snowater/p/8303698.html 1.sun.misc.Unsafe中CAS方法 在sun.misc.Unsafe中CAS方法如下: compareAndSwapObject(java.lang.Object arg0, long a......

汉斯-冯-拉特
今天
3
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部