본문 바로가기
  • AI (Artificial Intelligence)
Skills/RedHat, CentOS

CentOS 5.5에서 kvm 설치

by 로샤스 2014. 4. 21.
1. 패키지 설치
yum install kvm virt-manager libvirt libvirt-python python-virtinst qemu bridge-utils
reboot


2. Bridge network 설정
#configure bridge:

vi /etc/sysconfig/network-scripts/ifcfg-br0
#I used these values:
BOOTPROTO=dhcp
DEVICE=br0
TYPE=Bridge
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes


vi /etc/sysconfig/network-scripts/ifcfg-eth0
#I used these values:DEVICE=eth0
HWADDR=00:1F:D0:D7:48:F2
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no


#then restart with:
/etc/init.d/network restart

 


기본으로 설정되는 NAT 네트워크(virbr0) 중지
virsh net-autostart default --disable
virsh net-destroy default

 

----------------------------
mount /dev/drbd0 /opt/kvm
----------------------------
/dev/drbd0
----------------------------
/dev/sda6
----------------------------

 


참조
Installing KVM on CentOS 5.5
http://drup.org/installing-kvm-centos-54


CentOS 5.5 그리고 KVM
http://j2k.naver.com/j2k_frame.php/korean/www.ookawara.com/archives/568


(CentOS)KVM에 의한 서버 가상화
http://j2k.naver.com/j2k_frame.php/korean/d.hatena.ne.jp/jitsu102/20110108/1294455395

CPU 가상화 기능 확인
AMD : grep svm /proc/cpuinfo --color
Intel : grep vmx /proc/cpuinfo --color

CentOS / Redhat: Install KVM Virtualization Software
http://www.cyberciti.biz/faq/centos-rhel-linux-kvm-virtulization-tutorial/


/etc/libvirt/ - Main configuration directory.
/etc/libvirt/qemu/ - Virtual machine configuration directory. All xml files regarding VMs are stored here. You can edit them manually or via virt-manager.
/etc/libvirt/qemu/networks/ - Networking for your KVM including default NAT. NAT is only recommended for small setup or desktops. I strongly suggest you use bridged based networking for performance.
/etc/libvirt/qemu/networks/default.xml - The default NAT configuration used by NAT device virbr0.
/var/log/libvirt/ - The default log file directory. All VM specific logs files are stored here.
/etc/libvirt/libvirtd.conf - Master libvirtd configuration file.
/etc/libvirt/qemu.conf - Master configuration file for the QEMU driver.

 

 

virt-install --connect qemu:///system --name dev-cent01 --ram 1024 --vcpus=1 --disk path=/var/lib/libvirt/images/dev-cent01.img,size=5 --nographics --os-type=linux --os-variant=virtio26 --accelerate --location=http://ftp.daum.net/centos/5.5/os/x86_64

 

명령으로 가상머신 제어
http://www.cyberciti.biz/faq/linux-kvm-stop-start-guest-virtual-machine/


How to manage KVM virtual machines using virsh
http://acidborg.wordpress.com/2010/02/19/how-to-manage-kvm-virtual-machines-using-virsh/


Description: virsh is a program which uses libvirt to manage KVM virtual machines (guests). I’m going to show a summary of its main functions (cheat sheet style):

Show guests’ information:

?Show a list of all the defined guests: virsh list --all
?Show a guest’s info: virsh dominfo guest's_name

 

Start and stop guests:

?Start a guest: virsh start guest's_name
?Shutdown a guest (gently): virsh shutdown guest's_name
?Shutdown a guest (wild): virsh destroy guest's_name
?Suspend a guest: virsh suspend guest's_name
?Resume a suspended guest: virsh resume guest's_name

 

Create and modify guests:

?Create a new guest
?Create a guest from its XML definition: virsh create xml_file.xml
?Dump a guest’s definition in XML: virsh dumpxml guest's_name
?Modify a guest’s definition: virsh edit guest's_name
?Remove a guest’s definition (it doesn’t remove the image file): virsh undefine guest's_name

 

Backup and restore guests:

?Save a guest’s state on a file: virsh save guest's_name guest's_state_file
?Restore a guest from a state file: virsh restore guest's_state_file

 

 

 

active fail -> backup로 failover -> backup에서 추가 guest 생성 -> active 로 failback 하면,
backup에서 생성한 guest가 virt-manager에서 보이지 않는다.
이럴 경우

virsh에서

define /etc/libvirt/qemu/test.crystaljjun.kr_ubuntu.xml

와 같이 재정의 해주어야한다.

이래야만 virt-manager에서도 보이고, virsh list 에서도 보인다.
원인은 아직 모르겠음...


KVM: virsh define (와)과 virsh edit
http://j2k.naver.com/j2k_frame.php/korean/lost-and-found-narihiro.blogspot.com/2010/11/kvm-virsh-define-virsh-edit.html


참조 : http://code.google.com/p/appscale/wiki/Introduction_to_KVM
참조 : http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=/liaai/kvmadv/kvmadvvirsh.htm


Basic KVM Commands
Here are a few useful KVM-related commands and hot-keys.
?To list the VM's, use the following command:
  virsh list --all

?To get the console for each VM, use the following command:
  virsh console <domU-id or registered name>

For example, to get the console for appscale-image1 above, you can do this:
  virsh console 29

or this:
  virsh console appscale-image1

Hit enter a couple of times to get the prompt

?To disconnect from a console and return to your local machine, use the following hot-key:
  <Ctrl> + ']'

?To shutdown a running instance, you can do this:
  virsh shutdown <domU-id>

 

 


KVM 참고 메뉴얼

Quick Start Guide for installing and running KVM
http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaai/kvminstall/KVMInstall_pdf.pdf

The developer's approach to installing and managing KVMs
http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaai/kvmadv/kvmadv_pdf.pdf


Setting up Windows XP guest using virt-manager
http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaai/kvminstall/KVMinstallXP_pdf.pdf

 

Virtualization using KVM with libvirt on RHEL
http://kaivanov.blogspot.com/2010/10/virtualization-using-kvm-with-libvirt.html

 


(CentOS)KVM게스트OS이미지의 클론 작성
http://j2k.naver.com/j2k_frame.php/korean/d.hatena.ne.jp/jitsu102/20110112/1294838023


virt-clone -o <클론원VM명> -n <클론처VM명> -f <클론 이미지 파일명>


virsh list --all
virt-clone -o dev-cent01 -n dev-cent02 -f /var/lib/libvirt/images/dev-cent02.img

diff /etc/libvirt/qemu/dev-cent01.xml /etc/libvirt/qemu/dev-cent02.xml
UUID, MAC주소 중복되지 않게 변경

virsh define /etc/libvirt/qemu/dev-cent02.xml

virsh start dev-cent02
virsh start dev-cent01

 

 

 

해봐야할것

1. guest 머신 추가(완료)
2. guest 머신 복제하여 생성
3. online상에서 guest에 cpu추가
4. online상에서 guest에 ram추가
5. online상에서 guest에 disk추가
5. 빈 이미지 생성한후 P2V
 

 



2012.8.13 추가함

KVM

http://wiki.eri.ucsb.edu/sysadm/KVM



 

VM Conversion

http://wiki.eri.ucsb.edu/sysadm/VM_Conversion

 

 

 

 

 

 

 

출처 : http://blog.naver.com/junix?Redirect=Log&logNo=80122798821

 

 

 

 

 

 

 

'Skills > RedHat, CentOS' 카테고리의 다른 글

Linux Rescue mode 로 부팅하기  (0) 2014.05.02
가상머신 버추얼박스 : CentOS 설치  (2) 2014.04.21
CentOS 6.2 에서 KVM 설치  (0) 2014.04.21
CentOS 6.4 네트워크 설정  (1) 2014.04.21
CentOS 설치 시 참고할 점  (0) 2014.04.19

댓글