5. 安装配置KVM虚拟化Host主机
首先增加源配置:deb http://cloudstack.apt-get.eu/ubuntu precise 4.3
5.1 安装配置Agent $ sudo apt-get install cloud-agent
5.2 安装配置libvirt $ sudo vim /etc/libvirt/libvirtd.conf 修改以下配置
查看配置 $ cat /etc/libvirt/libvirtd.conf | grep -v '#' | grep -v "^$"
5
unix_sock_group =
"libvirtd"
6
unix_sock_rw_perms =
"0770"
$ sudo vim /etc/init/libvirt-bin.conf 修改以下参数
1
env
libvirtd_opts=
"-d -l"
# sudo vim /etc/libvirt/qemu.conf 修改以下参数
重启服务 $ sudo service libvirt-bin restart
5.3 配置安全策略 $ sudo dpkg --list "apparmor"
1
Desired=Unknown/Install/Remove/Purge/Hold
2
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
3
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
4
||/ Name Version Description
5
+++-===================================-===================================-======================================================================================
7
2.7.102-0ubuntu3.1 User-space parser utility
for
AppArmor
$ sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/ $ sudo ln -s /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper /etc/apparmor.d/disable/ $ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd $ sudo apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper
5.4 配置网桥 需要注意的是,官方文档给出的配置参数会导致网络不可用。 正确的配置是将物理网卡设置为manual,然后在虚拟网卡上设置IP并桥接到物理网卡上。 $ sudo vim /etc/network/interfaces
14
iface cloudbr0 inet static
22
dns-nameservers 10.6.255.253 61.139.2.69
26
iface cloudbr1 inet manual
$ sudo /etc/init.d/networking restart $ sudo /etc/init.d/networking start
5.5 配置防火墙 $ sudo ufw allow proto tcp from any to any port 22 $ sudo ufw allow proto tcp from any to any port 80 $ sudo ufw allow proto tcp from any to any port 1798 $ sudo ufw allow proto tcp from any to any port 16509 $ sudo ufw allow proto tcp from any to any port 5900:6100 $ sudo ufw allow proto tcp from any to any port 49152:49216