2015年8月28日 星期五

Start qemu kvm at ubuntu 14.04.3

安裝好後就開使用啦~

如果只是純使用,推薦 virt-manager,GUI界面、簡單好用。


如果有改到 code 的話,就只能用 command line 了
下面是 qemu script,disk 和 net ㄉ都是 virtio了
======
#!/bin/bash
set -x

mem=2048
disk=ubuntu14043.qcow2
smp=2

bridge=br0

# create tap0 interface
#sudo tunctl -u $USER
tap=`sudo tunctl -u $USER | sed 's/['\'']//g' | awk '{print  $2}'`
sleep 1

# bridge tap0 with br0
sudo brctl addif $bridge $tap

# bring the tap0 link up
sudo ip link set $tap up

qemu-system-x86_64 \
-smp $smp \
-m $mem \
-drive file=$disk,if=virtio \
-net tap,ifname=$tap,script=no,downscript=no \
-net nic,model=virtio \
-enable-kvm \
-monitor stdio \
-vnc :5
#-cdrom ../ubuntu-14.04.3-server-amd64.iso

# bring the tap0 link down
sudo ip link set $tap down

# remove tap0 from the bridge
sudo brctl delif $bridge $tap

# remove the tap0 interface
sudo tunctl -d $tap
======
REF:
https://wiki.gentoo.org/wiki/QEMU/Options





因為沒有 GUI 所以要用 vnc 連,又 ubuntu 預設的 remmina 超爛
======
sudo apt-get purge remmina
sudo apt-get install vncviewer
sudo apt-get autoremove

vncviewer <VNC server IP:port>
======
REF:
http://www.ehow.com/how_5095862_use-vnc-viewer-ubuntu.html

有時候只是忘記IP 卻用懶的用 VNC看,這時候就要scan IP
mac 就用 qemu monitor 看就好了 info net
======
sudo apt-get install nmap
sudo nmap -sP 192.168.0.0/24    #scan 192.168.0.0~192.168.0.254
======
REF:
http://www.itswapshop.com/articles/top-3-ip-scanners-linux

沒有留言:

張貼留言