Hardcore Linux

Anything about Ubuntu, Centos, openSuSe and Fedora

LXC on Ubuntu 10.04

LXC (LinuX Containers) is a  lightweight virtualization that lets you run an isolated processes and resources. You can run this so-called “containers” inside your Linux host and use the resources without the need of paravirt drivers, the performance is almost as native machine does.

How to install?

1. First install the necessary packages.

$> sudo apt-get install lxc bridge-utils debootstrap

2. Mount the cgroup, which lxc uses to regulate and limit resources for the containers.Modify your /etc/fstab and add the following:

none  /cgroup  cgroup  defaults  0 0

3. Then configure your network card to bridge mode.

auto lo
iface lo inet loopback

auto br0
iface br0 inet dhcp
    bridge_ports eth0
    bridge_stp off
    bridge_maxwait 5
    post-up /usr/sbin/brctl setfd br0 0

4. You can also set it to static IP.

auto lo
iface lo inet loopback

auto br0 
iface br0 inet static
   address 192.168.1.10
   netmask 255.255.255.0
   broadcast 192.168.1.255
   gateway 192.168.1.1
   bridge_ports eth0
   bridge_stp off
   bridge_maxwait 5
   post-up /usr/sbin/brctl setfd br0 0

5. Reboot and now your set. You can now create your own sets of containers or use the pre-configured from this site. I, myself still failed to create my own container templates, so for now I’m still using what bodhizazen have created.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 341 other followers

%d bloggers like this: