C.4. Installing Debian GNU/Linux from a Unix/Linux System

This section explains how to install Debian GNU/Linux from an existing
Unix or Linux system, without using the menu-driven installer as
explained in the rest of the manual. This “cross-install”
HOWTO has been requested by users switching to Debian GNU/Linux from
Red Hat, Mandrake, and SUSE. In this section some familiarity with
entering *nix commands and navigating the file system is assumed. In
this section, $ symbolizes a command to be entered in
the user's current system, while # refers to a
command entered in the Debian chroot.

Once you've got the new Debian system configured to your preference,
you can migrate your existing user data (if any) to it, and keep on
rolling. This is therefore a “zero downtime” Debian GNU/Linux
install. It's also a clever way for dealing with hardware that
otherwise doesn't play friendly with various boot or installation
media.

C.4.1. Getting Started

With your current *nix partitioning tools, repartition the hard
drive as needed, creating at least one filesystem plus swap. You
need at least 150MB of space available for a console only install,
or at least 300MB if you plan to install X.

To create file systems on your partitions. For example, to create an
ext3 file system on partition /dev/hda6 (that's
our example root partition):

Mount one partition as /mnt/debinst (the
installation point, to be the root (/) filesystem
on your new system). The mount point name is strictly arbitrary, it is
referenced later below.

# mkdir /mnt/debinst
# mount /dev/hda6 /mnt/debinst

Note

If you want to have parts of the filesystem (e.g. /usr) mounted on
separate partitions, you will need to create and mount these directories
manually before proceding with the next stage.

C.4.2. Install debootstrap

The tool that the Debian installer uses, which is recognized as the
official way to install a Debian base system, is
debootstrap. It uses wget and
ar, but otherwise depends only on
/bin/sh. Install wget and
ar if they aren't already on your current system,
then download and install debootstrap.

Or, you can use the following procedure to install it
manually. Make a work folder for extracting the .deb into:

# mkdir work
# cd work

The debootstrap binary is located in the Debian
archive (be sure to select the proper file for your
architecture). Download the debootstrap .deb from
the
pool, copy the package to the work folder, and extract the
binary files from it. You will need to have root privileges to install
the binaries.

Note that running debootstrap may require you to have
a minimal version of glibc installed (currently
GLIBC_2.3). debootstrap itself is a shell script, but
it calls various utilities that require glibc.

C.4.3. Run debootstrap

debootstrap can download the needed files directly
from the archive when you run it. You can substitute any Debian
archive mirror for http.us.debian.org/debian in
the command example below, preferably a mirror close to you
network-wise. Mirrors are listed at
http://www.debian.org/misc/README.mirrors.

If you have a sarge Debian GNU/Linux CD mounted at
/cdrom, you could substitute a file URL instead
of the http URL: file:/cdrom/debian/

Substitute one of the following for ARCH
in the debootstrap command:
alpha,
arm,
hppa,
i386,
ia64,
m68k,
mips,
mipsel,
powerpc,
s390, or
sparc.

If you have multiple network cards, you should arrange the names of
driver modules in the /etc/modules file into the
desired order. Then during boot, each card will be associated with the
interface name (eth0, eth1, etc.) that you expect.

C.4.4.4. Configure Timezone, Users, and APT

C.4.4.5. Configure Locales

To configure your locale settings to use a language other than
English, install the locales support package and configure it:

# apt-get install locales
# dpkg-reconfigure locales

NOTE: Apt must be configured before, ie. during the base-config phase.
Before using locales with character sets other than ASCII or latin1,
please consult the appropriate localization HOWTO.

C.4.5. Install a Kernel

If you intend to boot this system, you probably want a Linux kernel
and a boot loader. Identify available pre-packaged kernels with

# apt-cache search kernel-image

Then install your choice using its package name.

# apt-get install kernel-image-2.X.X-arch-etc

C.4.6. Set up the Boot Loader

To make your Debian GNU/Linux system bootable, set up your boot loader to load
the installed kernel with your new root partition. Note that debootstrap
does not install a boot loader, though you can use apt-get inside your
Debian chroot to do so.