您好,登錄后才能下訂單哦!
1 查看是否支持
vmxnum=$(egrep '(vmx|svm)' --color=always /proc/cpuinfo -o |wc -l)
cpunum=$(cat /proc/cpuinfo | grep processor | wc -l)
if [ $vmxnum -eq $cpunum ];
then
echo "cpu not support"
exit 1
else
echo "ok ,continue "
fi
2 安裝軟件包
apt-get install qemu-kvm libvirt-bin bridge-utils -y
modprobe kvm_intel
if [ $? -eq 0 ];
then
echo "you must motify this in bios"
fi
ERROR: could not insert 'kvm_intel': Operation not supported
或者
dmesg | grep kvm | grep -c "disabled by bios"
root@mysqlmaster:~# dmesg | grep kvm
[1031219.203545] kvm: disabled by bios
[1031343.376838] kvm: disabled by bios
需要開啟bios對虛擬化的支持
3 修改網絡配置:
cp /etc/network/interface /etc/network/interface.bak
cat >> /etc/network/interface <<EOF
auto lo br0
iface lo inet loopback
iface eth4 inet manual
iface br0 inet static
#bridge_ports eth0 eth2
bridge_ports eth4
address 192.168.4.102
netmask 255.255.255.0
gateway 192.168.4.233
bridge_stp off
bridge_waitport 0
bridge_fd 0
EOF
/etc/init.d/networking stop && /etc/init.d/networking start
4 修改內核參數:
cat >> /etc/sysctl.conf <<EOF
#for kvm
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
EOF
sysctl -p
5 生成磁盤鏡像文件:
qemu-img create -f raw /data/debian7.img 10G
6 開啟vnc
vim /etc/libvirt/qemu.conf
vnc_listen = "192.168.4.102"
/etc/init.d/libvirt-bin restart
7 安裝系統:
virt-install -d -n vm_kvm -r 2048 --disk path=/data/debian7.img,bus=virtio,cache=none --network bridge=br0,model=virtio --cdrom=/data/software/debian-7.4.0-amd64-netinst-bnx2-auto.iso
windows通過vnc連接:
安裝debian7.
待續...
參考:
http://hi.baidu.com/zhangfan879/item/eec87ee59764443c86d9de02
....
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。