<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://crancho.com/w/index.php?action=history&amp;feed=atom&amp;title=Lxc</id>
	<title>Lxc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://crancho.com/w/index.php?action=history&amp;feed=atom&amp;title=Lxc"/>
	<link rel="alternate" type="text/html" href="https://crancho.com/w/index.php?title=Lxc&amp;action=history"/>
	<updated>2026-05-02T05:44:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://crancho.com/w/index.php?title=Lxc&amp;diff=1250&amp;oldid=prev</id>
		<title>Ohayden: New page: == Install Linux Containers (lxc) == === Setup Host === * Install the following  aptitude install bridge-utils libcap2-bin lxc debootstrap * Setup Bridging for lxc  vim /etc/network/interf...</title>
		<link rel="alternate" type="text/html" href="https://crancho.com/w/index.php?title=Lxc&amp;diff=1250&amp;oldid=prev"/>
		<updated>2011-03-15T22:13:15Z</updated>

		<summary type="html">&lt;p&gt;New page: == Install Linux Containers (lxc) == === Setup Host === * Install the following  aptitude install bridge-utils libcap2-bin lxc debootstrap * Setup Bridging for lxc  vim /etc/network/interf...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Install Linux Containers (lxc) ==&lt;br /&gt;
=== Setup Host ===&lt;br /&gt;
* Install the following&lt;br /&gt;
 aptitude install bridge-utils libcap2-bin lxc debootstrap&lt;br /&gt;
* Setup Bridging for lxc&lt;br /&gt;
 vim /etc/network/interfaces&lt;br /&gt;
I changed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
allow-hotplug eth0&lt;br /&gt;
#iface eth0 inet static&lt;br /&gt;
#       address 192.168.0.60&lt;br /&gt;
#       netmask 255.255.255.0&lt;br /&gt;
#       network 192.168.0.0&lt;br /&gt;
#       broadcast 192.168.0.255&lt;br /&gt;
#       gateway 192.168.0.5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto br0&lt;br /&gt;
iface br0 inet static&lt;br /&gt;
        address 192.168.0.60&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.0.5&lt;br /&gt;
        bridge_ports eth0&lt;br /&gt;
        bridge_fd 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Create a directory for the cgroup&lt;br /&gt;
 mkdir /share/cgroup&lt;br /&gt;
* Setup cgroup to mount automatically&lt;br /&gt;
 vim /etc/fstab&lt;br /&gt;
I added:&lt;br /&gt;
 cgroup          /share/cgroup   cgroup  defaults        0       0&lt;br /&gt;
Then run:&lt;br /&gt;
 mount cgroup&lt;br /&gt;
* Make sure everything is fine&lt;br /&gt;
 lxc-checkconfig&lt;br /&gt;
I had the following:&lt;br /&gt;
 Cgroup memory controller: missing&lt;br /&gt;
It&amp;#039;s not required, but allows for allocating memory.  Looks like it&amp;#039;s being left out due to it not being optimized and will chew 2% to 3% of the CPU, etc.&lt;br /&gt;
*Create a workspace:&lt;br /&gt;
 mkdir /var/lib/lxc/lupin-captivate&lt;br /&gt;
&lt;br /&gt;
=== Containers ===&lt;br /&gt;
You can either do the default lenny container, which already has a template or you can create the squeeze template + container.&lt;br /&gt;
==== Lenny Guest (old) ====&lt;br /&gt;
* Debootstrap the debian image for the new vm container:&lt;br /&gt;
 /usr/lib/lxc/templates/lxc-debian -p /var/lib/lxc/lupin-captivate&lt;br /&gt;
&lt;br /&gt;
==== Squeeze Guest (new) ====&lt;br /&gt;
===== Creating the Template =====&lt;br /&gt;
* At the time of this documentation, lxc only had a lenny template (see above), so for squeeze we must roll our own.&lt;br /&gt;
  vim /usr/lib/lxc/templates/lxc-debian-squeeze&lt;br /&gt;
* Add the following&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# lxc: linux Container library&lt;br /&gt;
&lt;br /&gt;
# Authors:&lt;br /&gt;
# Daniel Lezcano &amp;lt;daniel.lezcano@free.fr&amp;gt;&lt;br /&gt;
# Hayden Owens &amp;lt;ohayden#gmail#com&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# This library is free software; you can redistribute it and/or&lt;br /&gt;
# modify it under the terms of the GNU Lesser General Public&lt;br /&gt;
# License as published by the Free Software Foundation; either&lt;br /&gt;
# version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
&lt;br /&gt;
# This library is distributed in the hope that it will be useful,&lt;br /&gt;
# but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU&lt;br /&gt;
# Lesser General Public License for more details.&lt;br /&gt;
&lt;br /&gt;
# You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
# License along with this library; if not, write to the Free Software&lt;br /&gt;
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA&lt;br /&gt;
&lt;br /&gt;
configure_debian()&lt;br /&gt;
{&lt;br /&gt;
    rootfs=$1&lt;br /&gt;
    hostname=$2&lt;br /&gt;
&lt;br /&gt;
    # configure the inittab&lt;br /&gt;
    cat &amp;lt;&amp;lt;EOF &amp;gt; $rootfs/etc/inittab&lt;br /&gt;
id:3:initdefault:&lt;br /&gt;
si::sysinit:/etc/init.d/rcS&lt;br /&gt;
l0:0:wait:/etc/init.d/rc 0&lt;br /&gt;
l1:1:wait:/etc/init.d/rc 1&lt;br /&gt;
l2:2:wait:/etc/init.d/rc 2&lt;br /&gt;
l3:3:wait:/etc/init.d/rc 3&lt;br /&gt;
l4:4:wait:/etc/init.d/rc 4&lt;br /&gt;
l5:5:wait:/etc/init.d/rc 5&lt;br /&gt;
l6:6:wait:/etc/init.d/rc 6&lt;br /&gt;
# Normally not reached, but fallthrough in case of emergency.&lt;br /&gt;
z6:6:respawn:/sbin/sulogin&lt;br /&gt;
1:2345:respawn:/sbin/getty 38400 console&lt;br /&gt;
c1:12345:respawn:/sbin/getty 38400 tty1 linux&lt;br /&gt;
c2:12345:respawn:/sbin/getty 38400 tty2 linux&lt;br /&gt;
c3:12345:respawn:/sbin/getty 38400 tty3 linux&lt;br /&gt;
c4:12345:respawn:/sbin/getty 38400 tty4 linux&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
    # disable selinux in debian&lt;br /&gt;
    mkdir -p $rootfs/selinux&lt;br /&gt;
    echo 0 &amp;gt; $rootfs/selinux/enforce&lt;br /&gt;
&lt;br /&gt;
    # configure the network using the dhcp&lt;br /&gt;
    cat &amp;lt;&amp;lt;EOF &amp;gt; $rootfs/etc/network/interfaces&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
    # set the hostname&lt;br /&gt;
    cat &amp;lt;&amp;lt;EOF &amp;gt; $rootfs/etc/hostname&lt;br /&gt;
$hostname&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
    # reconfigure some services&lt;br /&gt;
    if [ -z &amp;quot;$LANG&amp;quot; ]; then&lt;br /&gt;
	chroot $rootfs locale-gen en_US.UTF-8&lt;br /&gt;
	chroot $rootfs update-locale LANG=en_US.UTF-8&lt;br /&gt;
    else&lt;br /&gt;
	chroot $rootfs locale-gen $LANG&lt;br /&gt;
	chroot $rootfs update-locale LANG=$LANG&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    # remove pointless services in a container&lt;br /&gt;
    chroot $rootfs /usr/sbin/update-rc.d -f umountfs remove&lt;br /&gt;
    chroot $rootfs /usr/sbin/update-rc.d -f hwclock.sh remove&lt;br /&gt;
    chroot $rootfs /usr/sbin/update-rc.d -f hwclockfirst.sh remove&lt;br /&gt;
&lt;br /&gt;
    # create tty devices&lt;br /&gt;
    chroot $rootfs mknod -m 666 /dev/tty1 c 4 1&lt;br /&gt;
    chroot $rootfs mknod -m 666 /dev/tty2 c 4 2&lt;br /&gt;
&lt;br /&gt;
    echo &amp;quot;root:root&amp;quot; | chroot $rootfs chpasswd&lt;br /&gt;
    echo &amp;quot;Root password is &amp;#039;root&amp;#039;, please change !&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    return 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
download_debian()&lt;br /&gt;
{&lt;br /&gt;
    packages=\&lt;br /&gt;
ifupdown,\&lt;br /&gt;
locales,\&lt;br /&gt;
libui-dialog-perl,\&lt;br /&gt;
dialog,\&lt;br /&gt;
isc-dhcp-client,\&lt;br /&gt;
netbase,\&lt;br /&gt;
net-tools,\&lt;br /&gt;
iproute,\&lt;br /&gt;
vim,\&lt;br /&gt;
wget,\&lt;br /&gt;
iputils-ping,\&lt;br /&gt;
screen,\&lt;br /&gt;
openssh-server&lt;br /&gt;
&lt;br /&gt;
    cache=$1&lt;br /&gt;
    arch=$2&lt;br /&gt;
&lt;br /&gt;
    # check the mini debian was not already downloaded&lt;br /&gt;
    mkdir -p &amp;quot;$cache/partial-$arch&amp;quot;&lt;br /&gt;
    if [ $? -ne 0 ]; then&lt;br /&gt;
        echo &amp;quot;Failed to create &amp;#039;$cache/partial-$arch&amp;#039; directory&amp;quot;&lt;br /&gt;
        return 1&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    # download a mini debian into a cache&lt;br /&gt;
    echo &amp;quot;Downloading debian minimal ...&amp;quot;&lt;br /&gt;
    debootstrap --verbose --variant=minbase --arch=$arch \&lt;br /&gt;
        --include $packages \&lt;br /&gt;
        squeeze $cache/partial-$arch http://ftp.us.debian.org/debian&lt;br /&gt;
    if [ $? -ne 0 ]; then&lt;br /&gt;
        echo &amp;quot;Failed to download the rootfs, aborting.&amp;quot;&lt;br /&gt;
        return 1&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    mv &amp;quot;$1/partial-$arch&amp;quot; &amp;quot;$1/rootfs-$arch&amp;quot;&lt;br /&gt;
    echo &amp;quot;Download complete.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    return 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
copy_debian()&lt;br /&gt;
{&lt;br /&gt;
    cache=$1&lt;br /&gt;
    arch=$2&lt;br /&gt;
    rootfs=$3&lt;br /&gt;
&lt;br /&gt;
    # make a local copy of the minidebian&lt;br /&gt;
    echo -n &amp;quot;Copying rootfs to $rootfs...&amp;quot;&lt;br /&gt;
    cp -a $cache/rootfs-$arch $rootfs || return 1&lt;br /&gt;
    return 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
install_debian()&lt;br /&gt;
{&lt;br /&gt;
    cache=&amp;quot;/var/cache/lxc/debian-squeeze&amp;quot;&lt;br /&gt;
    rootfs=$1&lt;br /&gt;
    mkdir -p /var/lock/subsys/&lt;br /&gt;
    (&lt;br /&gt;
        flock -n -x 200&lt;br /&gt;
        if [ $? -ne 0 ]; then&lt;br /&gt;
            echo &amp;quot;Cache repository is busy.&amp;quot;&lt;br /&gt;
            return 1&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
        arch=$(arch)&lt;br /&gt;
        if [ &amp;quot;$arch&amp;quot; == &amp;quot;x86_64&amp;quot; ]; then&lt;br /&gt;
            arch=amd64&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
        if [ &amp;quot;$arch&amp;quot; == &amp;quot;i686&amp;quot; ]; then&lt;br /&gt;
            arch=i386&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
        echo &amp;quot;Checking cache download in $cache/rootfs-$arch ... &amp;quot;&lt;br /&gt;
        if [ ! -e &amp;quot;$cache/rootfs-$arch&amp;quot; ]; then&lt;br /&gt;
            download_debian $cache $arch&lt;br /&gt;
            if [ $? -ne 0 ]; then&lt;br /&gt;
                echo &amp;quot;Failed to download &amp;#039;debian base&amp;#039;&amp;quot;&lt;br /&gt;
                return 1&lt;br /&gt;
            fi&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
        copy_debian $cache $arch $rootfs&lt;br /&gt;
        if [ $? -ne 0 ]; then&lt;br /&gt;
            echo &amp;quot;Failed to copy rootfs&amp;quot;&lt;br /&gt;
            return 1&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
        return 0&lt;br /&gt;
&lt;br /&gt;
        ) 200&amp;gt;/var/lock/subsys/lxc&lt;br /&gt;
&lt;br /&gt;
    return $?&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
copy_configuration()&lt;br /&gt;
{&lt;br /&gt;
    path=$1&lt;br /&gt;
    rootfs=$2&lt;br /&gt;
    name=$3&lt;br /&gt;
&lt;br /&gt;
    cat &amp;lt;&amp;lt;EOF &amp;gt;&amp;gt; $path/config&lt;br /&gt;
lxc.tty = 4&lt;br /&gt;
lxc.pts = 1024&lt;br /&gt;
lxc.rootfs = $rootfs&lt;br /&gt;
lxc.cgroup.devices.deny = a&lt;br /&gt;
# /dev/null and zero&lt;br /&gt;
lxc.cgroup.devices.allow = c 1:3 rwm&lt;br /&gt;
lxc.cgroup.devices.allow = c 1:5 rwm&lt;br /&gt;
# consoles&lt;br /&gt;
lxc.cgroup.devices.allow = c 5:1 rwm&lt;br /&gt;
lxc.cgroup.devices.allow = c 5:0 rwm&lt;br /&gt;
lxc.cgroup.devices.allow = c 4:0 rwm&lt;br /&gt;
lxc.cgroup.devices.allow = c 4:1 rwm&lt;br /&gt;
# /dev/{,u}random&lt;br /&gt;
lxc.cgroup.devices.allow = c 1:9 rwm&lt;br /&gt;
lxc.cgroup.devices.allow = c 1:8 rwm&lt;br /&gt;
lxc.cgroup.devices.allow = c 136:* rwm&lt;br /&gt;
lxc.cgroup.devices.allow = c 5:2 rwm&lt;br /&gt;
# rtc&lt;br /&gt;
lxc.cgroup.devices.allow = c 254:0 rwm&lt;br /&gt;
&lt;br /&gt;
# mounts point&lt;br /&gt;
lxc.mount.entry=proc $rootfs/proc proc nodev,noexec,nosuid 0 0&lt;br /&gt;
lxc.mount.entry=devpts $rootfs/dev/pts devpts defaults 0 0&lt;br /&gt;
lxc.mount.entry=sysfs $rootfs/sys sysfs defaults  0 0&lt;br /&gt;
&lt;br /&gt;
lxc.utsname = $name&lt;br /&gt;
lxc.network.type = veth&lt;br /&gt;
# up = start up with host&lt;br /&gt;
lxc.network.flags = up&lt;br /&gt;
lxc.network.link = br0&lt;br /&gt;
# FLC - TODO - UNCOMMENT AND CONIFGURE THESE:&lt;br /&gt;
# container&amp;#039;s mac address&lt;br /&gt;
#lxc.network.hwaddr = 00:aa:bb:cc:00:01&lt;br /&gt;
# container&amp;#039;s ip address&lt;br /&gt;
#lxc.network.ipv4 = 192.168.0.230/24&lt;br /&gt;
&lt;br /&gt;
# flc - change theses&lt;br /&gt;
#lxc.network.ipv4 = 192.168.0.230/24&lt;br /&gt;
#lxc.network.hwaddr = 00:aa:bb:cc:dd:00&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
    if [ $? -ne 0 ]; then&lt;br /&gt;
        echo &amp;quot;Failed to add configuration&amp;quot;&lt;br /&gt;
        return 1&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    return 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
clean()&lt;br /&gt;
{&lt;br /&gt;
    cache=&amp;quot;/var/cache/lxc/debian-squeeze&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    if [ ! -e $cache ]; then&lt;br /&gt;
        exit 0&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    # lock, so we won&amp;#039;t purge while someone is creating a repository&lt;br /&gt;
    (&lt;br /&gt;
        flock -n -x 200&lt;br /&gt;
        if [ $? != 0 ]; then&lt;br /&gt;
            echo &amp;quot;Cache repository is busy.&amp;quot;&lt;br /&gt;
            exit 1&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
        echo -n &amp;quot;Purging the download cache...&amp;quot;&lt;br /&gt;
        rm --preserve-root --one-file-system -rf $cache &amp;amp;&amp;amp; echo &amp;quot;Done.&amp;quot; || exit 1&lt;br /&gt;
        exit 0&lt;br /&gt;
&lt;br /&gt;
    ) 200&amp;gt;/var/lock/subsys/lxc&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
usage()&lt;br /&gt;
{&lt;br /&gt;
    cat &amp;lt;&amp;lt;EOF&lt;br /&gt;
$1 -h|--help -p|--path=&amp;lt;path&amp;gt; --clean&lt;br /&gt;
EOF&lt;br /&gt;
    return 0&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
options=$(getopt -o hp:n:c -l help,path:,name:,clean -- &amp;quot;$@&amp;quot;)&lt;br /&gt;
if [ $? -ne 0 ]; then&lt;br /&gt;
        usage $(basename $0)&lt;br /&gt;
        exit 1&lt;br /&gt;
fi&lt;br /&gt;
eval set -- &amp;quot;$options&amp;quot;&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
    case &amp;quot;$1&amp;quot; in&lt;br /&gt;
        -h|--help)      usage $0 &amp;amp;&amp;amp; exit 0;;&lt;br /&gt;
        -p|--path)      path=$2; shift 2;;&lt;br /&gt;
        -n|--name)      name=$2; shift 2;;&lt;br /&gt;
        -c|--clean)     clean=$2; shift 2;;&lt;br /&gt;
        --)             shift 1; break ;;&lt;br /&gt;
        *)              break ;;&lt;br /&gt;
    esac&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ ! -z &amp;quot;$clean&amp;quot; -a -z &amp;quot;$path&amp;quot; ]; then&lt;br /&gt;
    clean || exit 1&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
type debootstrap&lt;br /&gt;
if [ $? -ne 0 ]; then&lt;br /&gt;
    echo &amp;quot;&amp;#039;debootstrap&amp;#039; command is missing&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ -z &amp;quot;$path&amp;quot; ]; then&lt;br /&gt;
    echo &amp;quot;&amp;#039;path&amp;#039; parameter is required&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$(id -u)&amp;quot; != &amp;quot;0&amp;quot; ]; then&lt;br /&gt;
    echo &amp;quot;This script should be run as &amp;#039;root&amp;#039;&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
rootfs=$path/rootfs&lt;br /&gt;
&lt;br /&gt;
install_debian $rootfs&lt;br /&gt;
if [ $? -ne 0 ]; then&lt;br /&gt;
    echo &amp;quot;failed to install debian&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
configure_debian $rootfs $name&lt;br /&gt;
if [ $? -ne 0 ]; then&lt;br /&gt;
    echo &amp;quot;failed to configure debian for a container&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
copy_configuration $path $rootfs $name&lt;br /&gt;
if [ $? -ne 0 ]; then&lt;br /&gt;
    echo &amp;quot;failed write configuration file&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ ! -z $clean ]; then&lt;br /&gt;
    clean || exit 1&lt;br /&gt;
    exit 0&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Look for &amp;quot;# FLC - TODO - UNCOMMENT AND CONIFGURE THESE&amp;quot; and change ip and mac address, then mark the file as executable&lt;br /&gt;
  chmod +x /usr/lib/lxc/templates/lxc-debian-squeeze&lt;br /&gt;
&lt;br /&gt;
===== Creating the Container =====&lt;br /&gt;
&lt;br /&gt;
* Debootstrap the debian image for the new vm container:&lt;br /&gt;
 /usr/lib/lxc/templates/lxc-debian-squeeze -p /var/lib/lxc/lupin-squeeze&lt;br /&gt;
&lt;br /&gt;
=== Setup Guest ===&lt;br /&gt;
&amp;lt;guest name&amp;gt; is the name of guest from above.  In my case is either lupin-captivate or lupin-squeeze.&lt;br /&gt;
&lt;br /&gt;
* Configure the container&lt;br /&gt;
 vim /var/lib/lxc/&amp;lt;guest name&amp;gt;/config&lt;br /&gt;
I added the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lxc.utsname = &amp;lt;guest name&amp;gt;&lt;br /&gt;
lxc.network.type = veth&lt;br /&gt;
# up = start up with host&lt;br /&gt;
lxc.network.flags = up&lt;br /&gt;
lxc.network.link = br0&lt;br /&gt;
# container&amp;#039;s mac address&lt;br /&gt;
lxc.network.hwaddr = 00:aa:bb:cc:00:01&lt;br /&gt;
# container&amp;#039;s ip address&lt;br /&gt;
lxc.network.ipv4 = 192.168.0.230/24&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Fix the containers network interface&lt;br /&gt;
 vim /var/lib/lxc/&amp;lt;guest name&amp;gt;/rootfs/etc/network/interfaces&lt;br /&gt;
I changed to:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.0.230&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.0.0&lt;br /&gt;
        broadcast 192.168.0.255&lt;br /&gt;
        gateway 192.168.0.5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Start the container in daemon mode&lt;br /&gt;
 lxc-start -n &amp;lt;guest name&amp;gt; -d&lt;br /&gt;
* Connect to the console&lt;br /&gt;
 lxc-console -n &amp;lt;guest name&amp;gt;&lt;br /&gt;
* Login in with root (default password is root as well, which you should change)&lt;br /&gt;
&lt;br /&gt;
=== Tips ===&lt;br /&gt;
* Start container&lt;br /&gt;
 lxc-start -n lupin-captivate&lt;br /&gt;
* Start container in daemon mode&lt;br /&gt;
 lxc-start -n lupin-captivate -d&lt;br /&gt;
* Connect to container in daemon mode&lt;br /&gt;
 lxc-console -n lupin-captivate&lt;br /&gt;
* Container status&lt;br /&gt;
 lxc-info -n lupin-captivate&lt;br /&gt;
* Stop the container (whilst in in the container)&lt;br /&gt;
 poweroff&lt;br /&gt;
* Stop the container from the host&lt;br /&gt;
 lxc-stop -n lupin-captivate&lt;br /&gt;
* Hibernate the container&lt;br /&gt;
 lxc-freeze -n lupin-captivate&lt;br /&gt;
* Restore container from hibernation&lt;br /&gt;
 lxc-unfreeze -n lupin-captivate&lt;br /&gt;
* Running graphical apps&lt;br /&gt;
On the host:&lt;br /&gt;
 Xephyr -ac :1 -screen 1280x960&lt;br /&gt;
In the container:&lt;br /&gt;
 export DISPLAY=&amp;lt;host name&amp;gt;:1&lt;br /&gt;
If you want to use export in a bash script then you need to separate the setter and export:&lt;br /&gt;
 DISPLAY=&amp;lt;host name&amp;gt;:1&lt;br /&gt;
 export DISPLAY&lt;br /&gt;
Now you can run any graphical program and the display will be redirected to the host. Another tip is to install &amp;quot;openbox&amp;quot; on the guest and run that along with any graphic program so it will give you a nice light weight window manger.&lt;/div&gt;</summary>
		<author><name>Ohayden</name></author>
	</entry>
</feed>