平时一直玩RHEL/CentOS/OEL系列的操作,玩虚拟化也是采这一类系统,kvm在RHEL6系列操作系统支持比较好,本文采用采用OEL6.3操作系统,网上所有文章都说KVM比xen简单,我怎么感觉kvm比较复杂,可能是它的工具太多了吧,所以决定开始记录KVM的学习过程。
本文出自:http://koumm.blog.51cto.com
kvm虚拟化学习笔记(一)之kvm虚拟化环境安装
http://koumm.blog.51cto.com/703525/1288795
kvm虚拟化学习笔记(二)之linuxkvm虚拟机安装
http://koumm.blog.51cto.com/703525/1289627
kvm虚拟化学习笔记(三)之windowskvm虚拟机安装
http://koumm.blog.51cto.com/703525/1290191
kvm虚拟化学习笔记(四)之kvm虚拟机日常管理与配置
http://koumm.blog.51cto.com/703525/1290269
kvm虚拟化学习笔记(五)之windows虚拟机性能调整
http://koumm.blog.51cto.com/703525/1290682
kvm虚拟化学习笔记(六)之kvm虚拟机控制台登录配置
http://koumm.blog.51cto.com/703525/1290996
kvm虚拟化学习笔记(七)之kvm虚拟机克隆
http://koumm.blog.51cto.com/703525/1291793
kvm虚拟化学习笔记(八)之kvm虚拟机vnc配置
http://koumm.blog.51cto.com/703525/1291803
kvm虚拟化学习笔记(九)之kvm虚拟机时间配置
http://koumm.blog.51cto.com/703525/1291862
kvm虚拟化学习笔记(十)之kvm虚拟机快照备份
http://koumm.blog.51cto.com/703525/1291893
kvm虚拟化学习笔记(十一)之kvm虚拟机扩展磁盘空间
http://koumm.blog.51cto.com/703525/1292146
kvm虚拟化学习笔记(十二)之kvmlinux虚拟机在线扩展磁盘
http://koumm.blog.51cto.com/703525/1295296
kvm虚拟化学习笔记(十三)之kvm虚拟机磁盘文件读取小结
http://koumm.blog.51cto.com/703525/1298845
kvm虚拟化学习笔记(十四)之kvm虚拟机静态迁移
http://koumm.blog.51cto.com/703525/1298852
kvm虚拟化学习笔记(十五)之kvm虚拟机动态迁移
http://koumm.blog.51cto.com/703525/1300783
kvm虚拟化学习笔记(十六)之kvm虚拟化存储池配置
http://koumm.blog.51cto.com/703525/1304196
kvm虚拟化学习笔记(十七)之KVM到KVM之v2v迁移
http://koumm.blog.51cto.com/703525/1304271
kvm虚拟化学习笔记(十八)之ESXi到KVM之v2v迁移
http://koumm.blog.51cto.com/703525/1304461
kvm虚拟化学习笔记(十九)之convirt集中管理平台搭建
http://koumm.blog.51cto.com/703525/1305553
kvm虚拟化学习笔记(二十)之convirt安装linux系统
http://koumm.blog.51cto.com/703525/1306526
kvm虚拟化学习笔记(二十一)之KVM性能优化学习笔记
http://koumm.blog.51cto.com/703525/1606422
1.操作系统安装
本文采用OEL6.3X64操作系统,也可以采用RHEL/CentOS6.x。
(1)修改内核模式为兼容内核启动
(2)关闭selinux,重启后生效
(3)关闭防火墙
1
2
|
chkconfig ip6tables off chkconfig iptables off |
(4)重启
1
|
# reboot |
2.虚拟化环境配置
(1)查看是否支持虚拟机
说明1:半虚拟化是不能运行与安装KVM虚拟机的。
1
|
#egrep '(vmx|svm)' --color=always /proc/cpuinfo
|
(2)配置yum环境
OEL6.3已经配置好源,只需要开启即可。
(3)安装kvm软件包
1
|
#yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v |
过程略。
补充安装kvm虚拟化一些管理工具包
1
|
#yum -y install libguestfs-tools |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
Loaded plugins: refresh-packagekit, security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package libguestfs-tools.x86_64 1 : 1.16 . 34 - 2 .el6 will be installed
--> Processing Dependency: libguestfs-tools-c = 1 : 1.16 . 34 - 2 .el6 for package : 1 :libguestfs-tools- 1.16 . 34 - 2 .el6.x86_64
--> Processing Dependency: perl(XML::Writer) for package : 1 :libguestfs-tools- 1.16 . 34 - 2 .el6.x86_64
--> Processing Dependency: /usr/bin/guestmount for package : 1 :libguestfs-tools- 1.16 . 34 - 2 .el6.x86_64
--> Running transaction check ---> Package libguestfs-tools-c.x86_64 1 : 1.16 . 34 - 2 .el6 will be installed
--> Processing Dependency: libconfig.so. 8 ()(64bit) for package : 1 :libguestfs-tools-c- 1.16 . 34 - 2 .el6.x86_64
---> Package perl-XML-Writer.noarch 0 : 0.606 - 6 .el6 will be installed
--> Running transaction check ---> Package libconfig.x86_64 0 : 1.3 . 2 - 1.1 .el6 will be installed
--> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================== Package Arch Version Repository Size ===================================================================================================================== Installing: libguestfs-tools x86_64 1 : 1.16 . 34 - 2 .el6 ol6_latest 94 k
Installing for dependencies:
libconfig x86_64 1.3 . 2 - 1.1 .el6 ol6_latest 50 k
libguestfs-tools-c x86_64 1 : 1.16 . 34 - 2 .el6 ol6_latest 850 k
perl-XML-Writer noarch 0.606 - 6 .el6 ol6_latest 26 k
Transaction Summary ===================================================================================================================== Install 4 Package(s)
Total download size: 1.0 M
Installed size: 3.6 M
Is this ok [y/N]: y
Downloading Packages: ( 1 / 4 ): libconfig- 1.3 . 2 - 1.1 .el6.x86_64.rpm | 50 kB 00 : 00
( 2 / 4 ): libguestfs-tools- 1.16 . 34 - 2 .el6.x86_64.rpm | 94 kB 00 : 00
( 3 / 4 ): libguestfs-tools-c- 1.16 . 34 - 2 .el6.x86_64.rpm | 850 kB 00 : 04
( 4 / 4 ): perl-XML-Writer- 0.606 - 6 .el6.noarch.rpm | 26 kB 00 : 00
--------------------------------------------------------------------------------------------------------------------- Total 115 kB/s | 1.0 MB 00 : 08
Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : libconfig- 1.3 . 2 - 1.1 .el6.x86_64 1 / 4
Installing : 1 :libguestfs-tools-c- 1.16 . 34 - 2 .el6.x86_64 2 / 4
Installing : perl-XML-Writer- 0.606 - 6 .el6.noarch 3 / 4
Installing : 1 :libguestfs-tools- 1.16 . 34 - 2 .el6.x86_64 4 / 4
Verifying : perl-XML-Writer- 0.606 - 6 .el6.noarch 1 / 4
Verifying : libconfig- 1.3 . 2 - 1.1 .el6.x86_64 2 / 4
Verifying : 1 :libguestfs-tools-c- 1.16 . 34 - 2 .el6.x86_64 3 / 4
Verifying : 1 :libguestfs-tools- 1.16 . 34 - 2 .el6.x86_64 4 / 4
Installed: libguestfs-tools.x86_64 1 : 1.16 . 34 - 2 .el6
Dependency Installed: libconfig.x86_64 0 : 1.3 . 2 - 1.1 .el6 libguestfs-tools-c.x86_64 1 : 1.16 . 34 - 2 .el6 perl-XML-Writer.noarch 0 : 0.606 - 6 .el6
Complete! |
3.查看虚拟化环境
(1)查看虚拟机环境
(2)查看kvm模块支持
(3)查看虚拟工具版本
4.手动配置虚拟网桥
(1)关闭networkmanager服务
(2)创建br0网桥
1
2
3
4
|
[root@node1~]#cd /etc/sysconfig/network-scripts/ [root@node1network-scripts]#cp ifcfg-eth0 ifcfg-br0 [root@node1network-scripts]# [root@node1network-scripts]# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
[root@node1network-scripts]#vi ifcfg-eth0 DEVICE= "eth0"
BOOTPROTO= static
NM_CONTROLLED= "no"
ONBOOT=yes TYPE= "Ethernet"
BRIDGE= "br0"
UUID= "99dde4d3-94f1-4293-b8a8-b10255d5b8be"
HWADDR= 00 :0C: 29 : 47 : 41 :8C
IPADDR= 192.168 . 233.130
PREFIX= 24
GATEWAY= 192.168 . 233.2
DNS1= 192.168 . 233.2
DEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME= "Systemeth0"
[root@node1network-scripts]# [root@node1network-scripts]#vi ifcfg-br0 DEVICE= "br0"
BOOTPROTO= static
ONBOOT=yes TYPE= "Bridge"
HWADDR= 00 :0C: 29 : 47 : 41 :8C
IPADDR= 192.168 . 233.130
PREFIX= 24
GATEWAY= 192.168 . 233.2
DNS1= 192.168 . 233.2
|
(3)关闭了networkmanager服务之后,才能通过servicenetworkrestart管理网络。
(4)查看网桥br0.
(4)查看网桥
到此kvm虚拟化环境安装完毕。