tpokorra / lxc-scripts

scripts useful for running a server with several lxc containers. DEPRECATED. Please use https://github.com/tpokorra/lxd-scripts!
31 stars 8 forks source link

CentOS7 as host for LXC #3

Closed tpokorra closed 9 years ago

tpokorra commented 10 years ago

see also https://der-linux-admin.de/2014/08/centos-7-centos-7-im-lxc-container/ http://libvirt.org/drvlxc.html

tpokorra commented 10 years ago

rpm -Uhv http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-1.noarch.rpm yum install lxc lxc-templates

tpokorra commented 10 years ago

lxc-checkconfig shows on Jiffybox stock kernel:

--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: required
User namespace: missing
Network namespace: missing
Multiple /dev/pts instances: missing

--- Control groups ---
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: missing
Macvlan: missing
Vlan: enabled
File capabilities: enabled

uname -a

Linux j99888.servers.jiffybox.net 3.12.20-x86_64-jb1 #3 SMP Wed May 21 10:34:51 CEST 2014 x86_64 x86_64 x86_64 GNU/Linux

Solution: use pvgrub64 kernel.

uname -a now shows:

Linux j99888.servers.jiffybox.net 3.10.0-123.6.3.el7.x86_64 #1 SMP Wed Aug 6 21:12:36 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

and lxc-checkconfig shows all enabled

tpokorra commented 10 years ago

starting a Debian container shows in the logfile:

lxc_conf - failed to attach 'veth39QYUL' to the bridge 'virbr0' : No such device

yum install bridge-utils libvirt

chkconfig NetworkManager off
chkconfig network on
service NetworkManager stop
service network start

systemctl enable libvirt-guests
systemctl enable libvirtd
systemctl start libvirt-guests
systemctl start libvirtd

virsh iface-bridge eth0 br0

container now starts fine

tpokorra commented 10 years ago

still a problem with network: cannot connect to outside

tpokorra commented 9 years ago
yum install yum-utils epel-release
# causes http 416 error?
#yum-config-manager --add-repo https://download.solidcharity.com/repos/tpokorra/lbs/centos/7/lbs-tpokorra-lbs.repo
wget https://download.solidcharity.com/repos/tpokorra/lbs/centos/7/lbs-tpokorra-lbs.repo -O /etc/yum.repos.d/lbs-tpokorra-lbs.repo
yum install lxc-scripts
systemctl enable libvirtd
systemctl start libvirtd
/usr/share/lxc-scripts/initLXC.sh
/usr/share/lxc-scripts/initIPTables.sh
tpokorra commented 9 years ago

creating Fedora 22 container:

Download of squashfs image complete.
mount: unknown filesystem type 'squashfs'

Mount of LiveOS squashfs image failed!  You mush have squashfs support
available to mount image.  Unable to continue.  Correct and retry

host is a jiffybox: need to change kernel, use Bootmanager 64bit (pvgrub64). then it works

tpokorra commented 9 years ago

TODO: post a blog post, and update the Readme.md with the installation instructions for CentOS

tpokorra commented 9 years ago

see post: http://www.pokorra.de/2015/08/easy-installation-of-lightbuildserver/