Linux Containers (LXC) provides containers similar BSD Jails, Linux VServer and Solaris Zones. It gives the impression of virtualization, but shares the kernel and resources with the "host".
Install the required packages:
Prepare network on host
Set up a bridge on the host. Example /etc/network/interfaces:
auto br0 iface br0 inet dhcp bridge-ports eth0
Create a network configuration template for the guests, /etc/lxc/lxc.conf:
lxc.network.type = veth lxc.network.link = br0 lxc.network.flags = up
Create a guest
This will create a /var/lib/lxc/guest1 directory with a config file and a rootfs directory.
Starting/Stopping the guest
Create a symlink to the /etc/init.d/lxc script for your guest.
You can start your guest with:
Stop it with:
Make it autostart on boot up with:
Connecting to the guest
By default sshd is not installed, so you will have to connect to a virtual console. This is done with:
To disconnect from it, press <key>Ctrl+a q</key>
Deleting a guest
Make sure the guest is stopped and run:
This will erase eerything, without asking any questions. It is equivalent to: