=======
前提条件:
=======
1.
1、安装KVM
yum groupinstall Virtualization 'Virtualization Client'
[root@CAT software]# yum groupinstall Virtualization 'Virtualization Client'
Loaded plugins: langpacks, presto, refresh-packagekit
Resolving Dependencies
--> Running transaction check
---> Package libvirt.x86_64 0:0.9.11.4-3.fc17 will be installed
--> Processing Dependency: libvirt-daemon-config-nwfilter = 0.9.11.4-3.fc17 for package: libvirt-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: libvirt-daemon-config-network = 0.9.11.4-3.fc17 for package: libvirt-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: libvirt-daemon = 0.9.11.4-3.fc17 for package: libvirt-0.9.11.4-3.fc17.x86_64
---> Package qemu-kvm.x86_64 2:1.0.1-1.fc17 will be installed
--> Running transaction check
---> Package libvirt-daemon.x86_64 0:0.9.11.4-3.fc17 will be installed
--> Processing Dependency: glusterfs-client >= 2.0.1 for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: radvd for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: numad for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: nfs-utils for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: lzop for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: iscsi-initiator-utils for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: ebtables for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
--> Processing Dependency: dmidecode for package: libvirt-daemon-0.9.11.4-3.fc17.x86_64
---> Package libvirt-daemon-config-network.x86_64 0:0.9.11.4-3.fc17 will be installed
---> Package libvirt-daemon-config-nwfilter.x86_64 0:0.9.11.4-3.fc17 will be installed
--> Running transaction check
---> Package dmidecode.x86_64 1:2.11-8.fc17 will be installed
---> Package ebtables.x86_64 0:2.0.10-5.fc17 will be installed
---> Package glusterfs-fuse.x86_64 0:3.2.7-1.fc17 will be installed
--> Processing Dependency: glusterfs = 3.2.7-1.fc17 for package: glusterfs-fuse-3.2.7-1.fc17.x86_64
---> Package iscsi-initiator-utils.x86_64 0:6.2.0.872-18.fc17 will be installed
---> Package lzop.x86_64 0:1.03-4.fc17 will be installed
---> Package nfs-utils.x86_64 1:1.2.6-3.fc17 will be installed
--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
--> Processing Dependency: libtirpc for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
--> Processing Dependency: libnfsidmap for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
--> Processing Dependency: libgssglue.so.1(libgssapi_CITI_2)(64bit) for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
--> Processing Dependency: libgssglue for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
--> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
--> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
--> Processing Dependency: libgssglue.so.1()(64bit) for package: 1:nfs-utils-1.2.6-3.fc17.x86_64
---> Package numad.x86_64 0:0.5-4.20120522git.fc17 will be installed
---> Package radvd.x86_64 0:1.8.5-3.fc17 will be installed
--> Running transaction check
---> Package glusterfs.x86_64 0:3.2.7-1.fc17 will be installed
---> Package libgssglue.x86_64 0:0.4-0.fc17 will be installed
---> Package libnfsidmap.x86_64 0:0.25-3.fc17 will be installed
---> Package libtirpc.x86_64 0:0.2.2-2.1.fc17 will be installed
---> Package rpcbind.x86_64 0:0.2.0-16.fc17 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
libvirt x86_64 0.9.11.4-3.fc17 updates 27 k
qemu-kvm x86_64 2:1.0.1-1.fc17 updates 29 k
Installing for dependencies:
dmidecode x86_64 1:2.11-8.fc17 fedora 73 k
ebtables x86_64 2.0.10-5.fc17 fedora 103 k
glusterfs x86_64 3.2.7-1.fc17 updates 1.7 M
glusterfs-fuse x86_64 3.2.7-1.fc17 updates 60 k
iscsi-initiator-utils x86_64 6.2.0.872-18.fc17 fedora 400 k
libgssglue x86_64 0.4-0.fc17 updates 24 k
libnfsidmap x86_64 0.25-3.fc17 updates 34 k
libtirpc x86_64 0.2.2-2.1.fc17 fedora 78 k
libvirt-daemon x86_64 0.9.11.4-3.fc17 updates 1.8 M
libvirt-daemon-config-network x86_64 0.9.11.4-3.fc17 updates 27 k
libvirt-daemon-config-nwfilter x86_64 0.9.11.4-3.fc17 updates 31 k
lzop x86_64 1.03-4.fc17 fedora 51 k
nfs-utils x86_64 1:1.2.6-3.fc17 updates 316 k
numad x86_64 0.5-4.20120522git.fc17 updates 23 k
radvd x86_64 1.8.5-3.fc17 updates 81 k
rpcbind x86_64 0.2.0-16.fc17 fedora 52 k
Transaction Summary
================================================================================
Install 2 Packages (+16 Dependent packages)
Total download size: 4.9 M
Installed size: 15 M
Is this ok [y/N]: y
Downloading Packages:
(1/18): dmidecode-2.11-8.fc17.x86_64.rpm | 73 kB 00:00
(2/18): ebtables-2.0.10-5.fc17.x86_64.rpm | 103 kB 00:00
(3/18): glusterfs-3.2.7-1.fc17.x86_64.rpm | 1.7 MB 00:02
(4/18): glusterfs-fuse-3.2.7-1.fc17.x86_64.rpm | 60 kB 00:00
(5/18): iscsi-initiator-utils-6.2.0.872-18.fc17.x86_64.r | 400 kB 00:00
(6/18): libgssglue-0.4-0.fc17.x86_64.rpm | 24 kB 00:00
(7/18): libnfsidmap-0.25-3.fc17.x86_64.rpm | 34 kB 00:00
(8/18): libtirpc-0.2.2-2.1.fc17.x86_64.rpm | 78 kB 00:00
(9/18): libvirt-0.9.11.4-3.fc17.x86_64.rpm | 27 kB 00:00
(10/18): libvirt-daemon-0.9.11.4-3.fc17.x86_64.rpm | 1.8 MB 00:02
(11/18): libvirt-daemon-config-network-0.9.11.4-3.fc17.x | 27 kB 00:00
(12/18): libvirt-daemon-config-nwfilter-0.9.11.4-3.fc17. | 31 kB 00:00
(13/18): lzop-1.03-4.fc17.x86_64.rpm | 51 kB 00:00
(14/18): nfs-utils-1.2.6-3.fc17.x86_64.rpm | 316 kB 00:00
(15/18): numad-0.5-4.20120522git.fc17.x86_64.rpm | 23 kB 00:00
(16/18): qemu-kvm-1.0.1-1.fc17.x86_64.rpm | 29 kB 00:00
(17/18): radvd-1.8.5-3.fc17.x86_64.rpm | 81 kB 00:00
(18/18): rpcbind-0.2.0-16.fc17.x86_64.rpm | 52 kB 00:00
--------------------------------------------------------------------------------
Total 543 kB/s | 4.9 MB 00:09
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libgssglue-0.4-0.fc17.x86_64 1/18
Installing : libtirpc-0.2.2-2.1.fc17.x86_64 2/18
Installing : rpcbind-0.2.0-16.fc17.x86_64 3/18
Installing : radvd-1.8.5-3.fc17.x86_64 4/18
Installing : 1:dmidecode-2.11-8.fc17.x86_64 5/18
Installing : numad-0.5-4.20120522git.fc17.x86_64 6/18
Installing : iscsi-initiator-utils-6.2.0.872-18.fc17.x86_64 7/18
Installing : glusterfs-3.2.7-1.fc17.x86_64 8/18
Installing : glusterfs-fuse-3.2.7-1.fc17.x86_64 9/18
Installing : ebtables-2.0.10-5.fc17.x86_64 10/18
Installing : libnfsidmap-0.25-3.fc17.x86_64 11/18
Installing : 1:nfs-utils-1.2.6-3.fc17.x86_64 12/18
Installing : lzop-1.03-4.fc17.x86_64 13/18
Installing : libvirt-daemon-0.9.11.4-3.fc17.x86_64 14/18
Installing : libvirt-daemon-config-nwfilter-0.9.11.4-3.fc17.x86_64 15/18
Installing : libvirt-daemon-config-network-0.9.11.4-3.fc17.x86_64 16/18
Installing : libvirt-0.9.11.4-3.fc17.x86_64 17/18
Installing : 2:qemu-kvm-1.0.1-1.fc17.x86_64 18/18
Verifying : libvirt-daemon-0.9.11.4-3.fc17.x86_64 1/18
Verifying : libvirt-daemon-config-nwfilter-0.9.11.4-3.fc17.x86_64 2/18
Verifying : lzop-1.03-4.fc17.x86_64 3/18
Verifying : libvirt-daemon-config-network-0.9.11.4-3.fc17.x86_64 4/18
Verifying : 2:qemu-kvm-1.0.1-1.fc17.x86_64 5/18
Verifying : libnfsidmap-0.25-3.fc17.x86_64 6/18
Verifying : ebtables-2.0.10-5.fc17.x86_64 7/18
Verifying : libvirt-0.9.11.4-3.fc17.x86_64 8/18
Verifying : glusterfs-3.2.7-1.fc17.x86_64 9/18
Verifying : libgssglue-0.4-0.fc17.x86_64 10/18
Verifying : iscsi-initiator-utils-6.2.0.872-18.fc17.x86_64 11/18
Verifying : numad-0.5-4.20120522git.fc17.x86_64 12/18
Verifying : 1:dmidecode-2.11-8.fc17.x86_64 13/18
Verifying : glusterfs-fuse-3.2.7-1.fc17.x86_64 14/18
Verifying : 1:nfs-utils-1.2.6-3.fc17.x86_64 15/18
Verifying : rpcbind-0.2.0-16.fc17.x86_64 16/18
Verifying : radvd-1.8.5-3.fc17.x86_64 17/18
Verifying : libtirpc-0.2.2-2.1.fc17.x86_64 18/18
Installed:
libvirt.x86_64 0:0.9.11.4-3.fc17 qemu-kvm.x86_64 2:1.0.1-1.fc17
Dependency Installed:
dmidecode.x86_64 1:2.11-8.fc17
ebtables.x86_64 0:2.0.10-5.fc17
glusterfs.x86_64 0:3.2.7-1.fc17
glusterfs-fuse.x86_64 0:3.2.7-1.fc17
iscsi-initiator-utils.x86_64 0:6.2.0.872-18.fc17
libgssglue.x86_64 0:0.4-0.fc17
libnfsidmap.x86_64 0:0.25-3.fc17
libtirpc.x86_64 0:0.2.2-2.1.fc17
libvirt-daemon.x86_64 0:0.9.11.4-3.fc17
libvirt-daemon-config-network.x86_64 0:0.9.11.4-3.fc17
libvirt-daemon-config-nwfilter.x86_64 0:0.9.11.4-3.fc17
lzop.x86_64 0:1.03-4.fc17
nfs-utils.x86_64 1:1.2.6-3.fc17
numad.x86_64 0:0.5-4.20120522git.fc17
radvd.x86_64 0:1.8.5-3.fc17
rpcbind.x86_64 0:0.2.0-16.fc17
Complete!
2、安装api支持
yum install libvirt
service libvirtd start
3、验证是否已经载入KVM模块
$ lsmod | grep kvm
kvm
kvm_intel
4、使用virt-manager安装guest
virt-manager是一个api gui工具,可以很方便的管理。下面简单介绍使用virt-manager安装虚拟机系统。
1)打开virt-manager,Add-connection,hypervisor选择QEMU/KVM,点击connect。
2)在连接localhost(QEMU)右键-NEW,输入guest名称,还有选择安装方式,我这里选择iso文件安装,点击forword。
3)选择iso文件路径,点击forword。
4)定义分配内存及cpu个数。
5)定义磁盘映像大小。
6)下一步就是常规的系统安装了。
5、使用virt-install安装guest
当你的CentOS没有桌面环境时,可以使用virt-install命令安装,如:
1、输入虚拟机名称
2、分配多少内存
3、定义虚拟机磁盘映像的位置
4、此步可以直接输入iso的位置或是url
5、进行系统常规安装