Debootstrap from foreign version or distribution

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search


This procedure (for Debian, Ubuntu, and derivatives) is useful when need to create a template, and your host doesn't have that suite's script (in /usr/share/debootstrap/scripts). This situation can happen when your host and your next template are from different distributions, or when your host is an older version than the next template you want to create (for example, creating an Ubuntu 10.04 template in an Ubuntu 8.04 host).

To do this, you need a computer to install a clean system or a virtual one with Qemu or similar.

Step 1: install a system with the distribution & version you want for template

We will call it the "satellite system". You can do it also with another already installed computer with the same distribution & version you want. Also with a Live-CD with sufficient RAM memory available for a subsystem installation.

Step 2: debootstrap (in satellite system)

cd /tmp
sudo apt-get install debootstrap
mkdir newsystem
# The parameter --variant=minbase is optional. You may want it to make a minimal template.
sudo debootstrap --variant=minbase $(lsb_release -cs) newsystem

Step 3: package for moving

cd newsystem
sudo tar czf /tmp/debootstrap_$(lsb_release -is | tr "[:upper:]" "[:lower:]")-$(lsb_release -rs)-$(uname -m)_minbase.tar.gz .
cd ..
sudo rm -R newsystem

Now you have a package like "debootstrap_ubuntu-10.04-i686.tar.gz" to copy to the OpenVZ host/server.

Unpacking for a new templaye (example for 777 container, in the OpenVZ server)

sudo mkdir -p /vz/private/777
cd /vz/private/777
sudo tar xf /tmp/debootstrap_ubuntu-10.04-i686.tar.gz

Next steps are the usual for creating a template.