This is an old revision of the document!
root@hostX:~# apt-get install debootstrap root@hostX:~# mkdir -p /var/lxc/ root@hostX:~# debootstrap --variant=minbase --arch i386 lucid /var/lxc/serverX.rootfs
root@hostX:~# chroot /var/lxc/serverX.rootfs /bin/bash root@hostX:/# apt-get update root@hostX:/# apt-get install --force-yes -y gpgv root@hostX:/# apt-get update root@hostX:/# apt-get -y install language-pack-en root@hostX:/# locale-gen en_US.UTF-8 root@hostX:/# /usr/sbin/update-locale LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" LC_ALL="en_US.UTF-8" LC_CTYPE="C" root@hostX:/# apt-get install -y vim telnet inetutils-ping ssh rsyslog root@hostX:/# cd /etc/init root@hostX:/etc/init# rm -f console* control* hwclock* module* mount* network-interface* root@hostX:/etc/init# rm -f plymouth* procps* tty{1,2,3,4,5,6}.conf udev* upstart* root@hostX:/etc/init# cat rc-sysinit.conf
start on startup pre-start script rm -f $(find /var/run -name '*pid') route add default gw 172.16.1.254 # /etc/init.d/postfix start end script
root@hostX:/etc/init# cat ssh.conf
... start on startup ...
root@hostX:/etc/init# cat rsyslog.conf
... start on startup ...
root@hostX:/# cat /etc/hostname serverX.class.un root@hostX:/# cat /etc/hosts 172.16.1.100+X serverX.class.un root@hostX:/# cat /etc/resolv.conf search class.un nameserver 172.16.1.254 root@hostX:/# passwd root@hostX:/# exit
root@hostX:~# apt-get install bridge-utils root@hostX:~# ifdown eth0 root@hostX:~# cat /etc/network/interfaces
auto lo iface lo inet loopback #auto eth0 #iface eth0 inet static # address 172.16.1.X # netmask 255.255.255.0 # gateway 172.16.1.254 auto br0 iface br0 inet static address 172.16.1.X netmask 255.255.255.0 bridge_ports eth0 bridge_stp off bridge_maxwait 5 post-up /usr/sbin/brctl setfd br0 0 gateway 172.16.1.254
root@hostX:~# ifup br0
root@hostX:~# apt-get install lxc root@hostX:~# mkdir /cgroup root@hostX:~# cat /etc/fstab ... none /cgroup cgroup defaults 0 0 root@hostX:~# mount /cgroup
root@hostX:~# cat /var/lxc/serverX.config lxc.utsname = serverX lxc.network.type = veth lxc.network.flags = up lxc.network.link = br0 lxc.network.name = eth0 lxc.network.mtu = 1500 lxc.network.ipv4 = 172.16.1.100+X/24 lxc.rootfs = /var/lxc/serverX.rootfs lxc.mount = /var/lxc/serverX.fstab root@hostX:~# cat /var/lxc/serverX.fstab none /var/lxc/serverX.rootfs/dev/pts devpts defaults 0 0 none /var/lxc/serverX.rootfs/proc proc defaults 0 0 none /var/lxc/serverX.rootfs/sys sysfs defaults 0 0 none /var/lxc/serverX.rootfs/var/lock tmpfs defaults 0 0 none /var/lxc/serverX.rootfs/var/run tmpfs defaults 0 0 root@hostX:~# lxc-create -f /var/lib/lxc/config.serverX -n serverX root@hostX:~# lxc-ls serverX root@hostX:~# ls /var/lib/lxc serverX
root@hostX:~# lxc-start -n serverX /bin/bash root@hostX:~# lxc-start -n serverX -d root@hostX:~# lxc-info -n serverX 'serverX' is RUNNING root@hostX:~# lxc-ps --name serverX root@hostX:~# ssh 172.16.1.100+X root@hostX:~# lxc-stop -n serverX