[Lxc-users] LXC on Fedora

Cristian Falcas cristi.falcas at gmail.com
Wed Feb 6 11:34:45 UTC 2013


I'm using the staging lxc on fedora 18 with fedora 18 guests, so it's working.

What i did (it's root all the waydown):
1. Compile lxc
cd ~
git clone https://github.com/lxc/lxc
cd  lxc
./autogen.sh && ./configure && make && make install

2. i didn't use the fedora template from lxc, but the openvz one (I
use x86 because of pentium4):
wget http://download.openvz.org/template/precreated/fedora-17-x86.tar.gz

3. uncompress in /mnt/files/lxc/fedora-x86/

4. Use this as the template:

 cat /mnt/files/lxc/lxc_template.conf
lxc.utsname = localhost.localdomain
lxc.rootfs = /mnt/files/lxc/fedora-x86/
#lxc.tty = 10

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = bridge_lxc
lxc.network.name = eth0
lxc.network.hwaddr = a2:cd:48:ff:ff:ff

lxc.autodev = 1
lxc.pts = 1024
lxc.arch = i386

#lxc.cgroup.devices.deny = a
lxc.cgroup.memory.limit_in_bytes = 128M
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
# consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm
# tun
lxc.cgroup.devices.allow = c 10:200 rwm

5. Create the bridge:

[root at wikitiki q]# cat /etc/sysconfig/network-scripts/ifcfg-bridge_lxc
DEVICE=bridge_lxc
TYPE=Bridge
NM_CONTROLED=no
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes

6. dhcp configuration:

[root at wikitiki q]# cat /etc/dnsmasq.d/lxc.conf
interface=bridge_lxc
dhcp-range=192.168.0.0,static
dhcp-option=3,192.168.0.1
resolv-file=/etc/resolv.conf
domain-needed
bogus-priv
no-hosts
dns-forward-max=150
cache-size=1000
#no-negcache
neg-ttl=3600
no-poll

dhcp-host=a2:cd:48:02:02:02,192.168.0.2
dhcp-host=a2:cd:48:ff:ff:ff,192.168.0.222

7, start bridge, dhcp

8. Create the lxc:

lxc-create -n testes -f /path/to/template

9. start the container:

lxc-start -n testes

10. update fedora guest to 18

For me the lxc console is useless, so i use ssh to connect to the
container for any work.


On Wed, Feb 6, 2013 at 1:10 PM, Antoine Gaillard
<antoine.gaillard13 at gmail.com> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> Le 06/02/2013 08:53, Cristian Falcas a ←crit :
>> you need the staging git for fedora 18 guests.
> I'm afraid I didn't make myself clear, I was actually talking about fedora
> host not guest.
>
> Regards,
>
> Antoine GAILLARD.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.17 (MingW32)
>
> iQIcBAEBCgAGBQJREjo8AAoJEErsvXVG0x58+ywP/18pLmso99etg/aN70Wfy8+s
> QVbySlwNv3k1DFqbnTbWKltUp+BCQGNGo73eSJKon2zx6ZhS/U0926EtOSf+F6gE
> 9/VYZQAxsD5fvX1UNyT2D5Sud9JErsOp1dw5rMCET+t8OY96fvqV4YyA4kKo3E2q
> 29UarcZjnRLq/Avf5Rz8DtqJThpVsHcHTy4z8Jy+IRrOS9h7AJdswRxwj3fgwe5e
> yCPMKGhOmpbBSS6ZjNckwVH1LcI4XZB7WON+8+cViRPF7UO3NE1U2eoMnpgLVaJR
> xUZ+MQfS0A2/I8pScm7grax5ifFz0rAvCL7Rr/eSEI014bnR7ePT4PabyjLYz45d
> qVa+UhrgpPQk2gBjKtTQR+B+b5dH2+luZp8ygOwi6phLLG2ywIdNKdSKCWN8rggT
> vTb3cNMmJhh8+O5zFL6mx5okB4FoHlHYf02M6ozwfaIIUgas1JFAYeljlNhyFIkZ
> 98ya0omIYGYdMWf89cvlxx4NB6qYrJBXtxzLg5quoJP1lTQUD2gtjJFnRvqguo+N
> WToWasbOTkBznF0t7WDrFiSWo+4SBrq/fP0VlINnHDxWvHWa/pGAjMY+n5i67h/k
> V0r5lM9K2xwcHBYDHCO6GW73/kdTgUsMT1fhvtcFupAyoHagYt+otsbq24OJV7CK
> Uk1eDaY1mUaQMikkd0va
> =3eAZ
> -----END PGP SIGNATURE-----
>




More information about the lxc-users mailing list