安装:
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
创建Rootfs
debian
$ sudo debootstrap sid rootfs http://ftp.tw.debian.org/debian/
ubunut
sudo debootstrap lucid rootfs http://ftp.tw.debian.org/ubuntu/
1. 动态库链接出错
lxc-create: error while loading shared libraries: liblxc.so.1: cannot open shared object file: No such file or directory
遇见这个错误说明没找到liblxc.so.1文件
1:查看/usr/local/lib下是否有这个库文件,有的话说明已经安装了liblxc,没有说明没有安装
2:若没有安装就下载个安装包,安装好,再测试
3:若已经安装,有两个方法解决
A:在/etc/ld.so.conf中添加/usr/local/lib,再执行一下ldconfig,测试是否可行
B:给liblxc.so.1做个软件链接 (不如A方法好)
ln -s /usr/local/lib/liblxc.so.1 /usr/lib/liblxc.so.1
2. 创建虚拟机出错
lxcVmStart:1477 : internal error The 'cpuacct', 'devices' & 'memory' cgroups controllers must be mounted
运行/etc/init.d/cgconfig (若没有cgconfig,则说明没有安装cgroup-bin(http://packages.ubuntu.com/lucid/admin/cgroup-bin))
重启libvirtd;
lxcVmStart:1496 : internal error Unable to find 'memory' cgroups controller mount
修改/etc/cgconfig.conf配置文件加入memory的mount项
mount {
cpu = /mnt/cgroups/cpu;
cpuacct = /mnt/cgroups/cpuacct;
devices = /mnt/cgroups/devices;
memory = /mnt/cgroups/memory;
}
重启cgroup,libvirtd。