Debootstrap from foreign version or distribution

From OpenVZ Virtuozzo Containers Wiki
Revision as of 09:07, 5 May 2010 by Narcisgarcia (talk | contribs) (Live-CD)
Jump to: navigation, search


This procedure (for Debian, Ubuntu, and derivatives) is useful when need to create a template, and your host hasn't suite's script (in /usr/share/debootstrap/scripts). This situation can de caused because your host and your next template are from different distributions, or because your host is an older version than the next template you want to create (fo example, creating 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.