Home | Mirror | Search

第 29 章 KVM

目錄

1. kvm install usage yum
2. install usage apt-get
3. virsh
4. CentOS 6.2
5. brctl / tunctl
6. virt-install
7. Virtual Machine Manager

http://wiki.centos.org/HowTos/KVM

1. kvm install usage yum

確認處理器是否支持KVM

egrep 'vmx|svm' /proc/cpuinfo
		

對當前系統做一個全面升級

sudo yum update
sudo yum upgrade
		

Installing

如果你不想安裝Virtualization組,想單獨安裝需要的軟件,可是使用下面命令

# yum install kvm kmod-kvm qemu
# yum install bridge-utils
		

確認kvm已經安裝

lsmod | grep kvm
[root@scientific ~]# lsmod|grep kvm
kvm_intel              45674  0
kvm                   291811  1 kvm_intel
		

Create the disk image

qemu-img create -f qcow2 disk.img 5G

or

dd if=/dev/zero of=disk.img bs=1G count=5
# qemu-img create -f qcow2 disk.img 5G
Formatting 'disk.img', fmt=qcow2, size=5242880 kB

# dd if=/dev/zero of=disk.img bs=1G count=5
5+0 records in
5+0 records out
5368709120 bytes (5.4 GB) copied, 61.0353 seconds, 88.0 MB/s
		

Creating a virtual machine

/usr/libexec/qemu-kvm -hda disk.img -cdrom archlinux-2009.08-core-x86_64.iso -m 512 -boot d
		

如果你不在localhost上安裝OS,你需要指定vnc,這樣你可以遠程連接到kvm

[root@scientific ~]# /usr/libexec/qemu-kvm disk.img -cdrom rhel-server-5.6-x86_64-dvd.iso -m 8000 -boot d -vnc :1
		
comments powered by Disqus