読者です 読者をやめる 読者になる 読者になる

めもぶろぐ

お勉強したこと、趣味なんかを適当に書いてます。。。

CentOS7 How to use KVM

MEMO:

 

Environment: LIFEBOOK AH40/K(notebook) / CentOS7

 

Prepare KVM: yum --disablerepo="*" --enablerepo="InstallMedia" -y install *lib*virt*

 

GenIsoImage: mount /dev/sr0 /mnt && mkdir /iso && genisoimage -JR -o /iso/InstallMedia.iso /mnt

 

Install OS on KVM:

virt-install --name rhel7_hvm \

--os-variant rhel7 \

--ram 2048 --vcpus 2 \

--location /iso/InstallMedia.iso  \

--disk size=10,cache=writeback \

--graphics vnc,password=password,port=5912,keymap=ja \

--virt-type kvm

 

 

After Installing.....

 

boot VM: virsh start rhel7_kvm

 

con Guest Console: virsh console rhel7_kvm

 

virsh attach-disk rhel7_kvm /iso/InstallMedia.iso sdz

 

shutdown VM: virsh shutdown rhel7_kvm

 

create snapshot: virsh snapshot-create rhel7_kvm

 

rename snapshot name: virsh snapshot-edit --rename --current rhel7_kvm

<domainsnapshot>
  <name>1478705434 JustInstall</name>
  <state>running</state>
  <creationTime>1478705434</creationTime>
  <memory snapshot='internal'/>

 

 

show snapshot list: virsh snapshot-list rhel7_kvm

 

revert snapshot: virsh snapshot-revert rhel7_kvm --current

revert snapshot2: virsh snapshot-revert rhel7_kvm JustInstall

 

delete snapshot: virsh snapshot-delete rhel7_kvm JustInstall

 

delete VM: virsh destroy rhel7_kvm ; virsh undefine rhel7_kvm ; virsh list --all

 

 

 

 

 

 

 

 

 

 

 

 

広告を非表示にする