Demo影片
https://www.youtube.com/watch?v=lACHT3BaQz8
Environment
- 兩台 Ubuntu 15.04 安裝KVM、vmbuilder、virt-manager
- IP
- X.X.X.X
- Y.Y.Y.Y
NFS
Server(X.X.X.X)
安裝
sudo apt install nfs-kernel-server nfs-common
分享目錄要權限
sudo chmod -R 777 /var/lib/libvirt/images
|
|
sudo systemctl nfs-kernel-server restart
sudo systemctl nfs-kernel-server status
Client(Y.Y.Y.Y)
sudo apt install nfs-common
sudo mount -t nfs X.X.X.X:/var/lib/libvirt/images /var/lib/libvirt/images
GUI
sudo virt-manager
Virsh
列出正在執行
sudo virsh list
列出包含關機的
sudo virsh list –all
列出所有snapshot
sudo virsh snapshot-list vm1
刪除snapshot
sudo virsh snapshot-delete vm1 [number]
列出遠端的VM
sudo virsh -c qemu+ssh://Y.Y.Y.Y/system list –all
Migration VM
sudo virsh migrate vm1 qemu+ssh://root@Y.Y.Y.Y/system
sudo virsh migrate –live vm1 qemu+ssh://root@Y.Y.Y.Y/system
DNS
sudo vim /etc/hosts
Y.Y.Y.Y HOSTNAME
SSH(不一定要加)
vim .ssh/authorized_keys
sudo systemctl restart sshd
Code Sample
|
|