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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。