Purpose: In this post we will learn how you can “bootstrap” a Debian Linux system. “Bootstrap” simply means boot a system. Suppose you are doing a lot of trial-and-error with your Linux system and you are worried that you might harm your system while experimenting by deleting some important configuration files or by mis-editing something.
How about we can create a test system which looks exactly like your a regular Linux system, right on our existing Linux system, in which we can carry out our experiments without harming our actual system? Yes, that is totally possible and is a very popular technique for people who like to experiment and play around a lot of with their Linux system. Basically what we will do is create an entire Linux system on your existing Linux system and use it as if it were a real Linux system.
Examples: Here are some example scenarios in which you can use the technique that we are going to learn here:
- Create a freshly installed Debian system on your existing Debian system.
- You have installed Debian Stable but you would like to try Debian Squeeze (Testing) or Debian Sid (Unstable) without actually installing it.
- You have installed Debian amd64 i.e. 64-bit version of Debian but you would like to run some 32-bit applications on a i386 (32-bit) Debian.
- You can create as many test system as you can as long as you have space on your hard dive.
Requirements: A standard Linux install preferably a Debian based like Debian, Ubuntu, Sidux, Mint, etc.
Step 1: Create a directory for your bootstrap system
# mkdir /home/kushalk/chroots/debian32
Basically the directory “debian32″ will hold your test Linux system.
Step2: Install Debootstrap
# apt-get update
# apt-get install debootstrap
Step 3: Create your bootstrap system
Now give the following command:
# debootstrap --arch i386 lenny /home/kushalk/chroots/debian32 http://ftp.us.debian.org/debian
–arch i386 = Architecture that you would like to install. You can also substitute “amd64″ for “i386″ to install an 64-bit version of Debian.
lenny = The Debian’s current stable distribution. You can also install “testing” and “sid” by substituting “lenny”.
/home/kushalk/chroots/debian32 = Path of directory where you would like to install/bootstrap the Debian system.
http://ftp.us.debian.org/debian = Debian’s package repository. You can even use a local repository if you have one in your intranet/network.
The entire process might take time depending upon the speed of your Internet connection and the location of your package repository.
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Configuring aptitude...
I: Configuring tasksel-data...
I: Configuring tasksel...
I: Base system installed successfully.
Step 4: Enter into your newly bootstrap system
Now to enter into your system that you just installed and to start playing around give the following command:
# cd /home/kushalk/chroots/
# chroot debian32
Note at this point of time you are already in your bootstrap system. You can confirm it by giving the following command:
bin dev home media opt root selinux sys usr
boot etc lib mnt proc sbin srv tmp var
As you can see you have exactly a regular filesystem just like your original filesystem on your machine. The newly created system is exactly like a fresh new install of Debian. So basically we created a Debian system without installing from any sort of installation media.
Also you can see that the boot directory is empty since it was created using bootstrap technique which does not require any kind of bootloader.
debian:/# ls /boot/
Now you can execute any command/program on this “test” system of your without worrying about harming your original system.
Step 5: Exit from bootstrap system
Coming out of your bootstrap system i.e. returning to your original system is very easy. At anytime from your bootstrap system give the following command:
As you can see you returned to the original directory of your original system from where you entered into your bootstrap system.