Installing &debian-gnu; from a Unix/Linux System This section explains how to install &debian-gnu; 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; from Red Hat, Mandriva, 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; install. It's also a clever way for dealing with hardware that otherwise doesn't play friendly with various boot or installation media. As this is a mostly manual procedure, you should bear in mind that you will need to do a lot of basic configuration of the system yourself, which will also require more knowledge of &debian; and of &arch-kernel; in general than performing a regular installation. You cannot expect this procedure to result in a system that is identical to a system from a regular installation. You should also keep in mind that this procedure only gives the basic steps to set up a system. Additional installation and/or configuration steps may be needed. Getting Started With your current *nix partitioning tools, repartition the hard drive as needed, creating at least one filesystem plus swap. You need around 350MB of space available for a console only install, or about 1GB if you plan to install X (more if you intend to install desktop environments like GNOME or KDE). Next, create file systems on the partitions. For example, to create an ext3 file system on partition /dev/hda6 (that's our example root partition): # mke2fs -j /dev/hda6 To create an ext2 file system instead, omit -j. Initialize and activate swap (substitute the partition number for your intended &debian; swap partition): # mkswap /dev/hda5 # sync; sync; sync # swapon /dev/hda5 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 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. Install <command>debootstrap</command> The utility used by the &debian; installer, and 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 and basic Unix/Linux tools These include the GNU core utilities and commands like sed, grep, tar and gzip. . 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 files from it. You will need to have root privileges to install the files. # ar -x debootstrap_0.X.X_all.deb # cd / # zcat /full-path-to-work/work/data.tar.gz | tar xv Run <command>debootstrap</command> debootstrap can download the needed files directly from the archive when you run it. You can substitute any &debian; archive mirror for &archive-mirror;/debian in the command example below, preferably a mirror close to you network-wise. Mirrors are listed at . If you have a &releasename; &debian-gnu; 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, amd64, arm, armel, hppa, i386, ia64, m68k, mips, mipsel, powerpc, s390, or sparc. # /usr/sbin/debootstrap --arch ARCH &releasename; \ /mnt/debinst http://ftp.us.debian.org/debian Configure The Base System Now you've got a real &debian; system, though rather lean, on disk. chroot into it: # LANG=C chroot /mnt/debinst /bin/bash After chrooting you may need to set the terminal definition to be compatible with the &debian; base system, for example: # export TERM=xterm-color Create device files At this point /dev/ only contains very basic device files. For the next steps of the installation additional device files may be needed. There are different ways to go about this and which method you should use depends on the host system you are using for the installation, on whether you intend to use a modular kernel or not, and on whether you intend to use dynamic (e.g. using udev) or static device files for the new system. A few of the available options are: create a default set of static device files using # cd /dev # MAKEDEV generic manually create only specific device files using MAKEDEV bind mount /dev from your host system on top of /dev in the target system; note that the postinst scripts of some packages may try to create device files, so this option should only be used with care Mount Partitions You need to create /etc/fstab. # editor /etc/fstab Here is a sample you can modify to suit: # /etc/fstab: static file system information. # # file system mount point type options dump pass /dev/XXX / ext3 defaults 0 1 /dev/XXX /boot ext3 ro,nosuid,nodev 0 2 /dev/XXX none swap sw 0 0 proc /proc proc defaults 0 0 /dev/fd0 /media/floppy auto noauto,rw,sync,user,exec 0 0 /dev/cdrom /media/cdrom iso9660 noauto,ro,user,exec 0 0 /dev/XXX /tmp ext3 rw,nosuid,nodev 0 2 /dev/XXX /var ext3 rw,nosuid,nodev 0 2 /dev/XXX /usr ext3 rw,nodev 0 2 /dev/XXX /home ext3 rw,nosuid,nodev 0 2 Use mount -a to mount all the file systems you have specified in your /etc/fstab, or, to mount file systems individually, use: # mount /path # e.g.: mount /usr Current &debian; systems have mountpoints for removable media under /media, but keep compatibility symlinks in /. Create these as as needed, for example: # cd /media # mkdir cdrom0 # ln -s cdrom0 cdrom # cd / # ln -s media/cdrom You can mount the proc file system multiple times and to arbitrary locations, though /proc is customary. If you didn't use mount -a, be sure to mount proc before continuing: # mount -t proc proc /proc The command ls /proc should now show a non-empty directory. Should this fail, you may be able to mount proc from outside the chroot: # mount -t proc proc /mnt/debinst/proc Setting Timezone An option in the file /etc/default/rcS determines whether the system will interpret the hardware clock as being set to UTC or local time. The following command allows you to set that and choose your timezone. # editor /etc/default/rcS # dpkg-reconfigure tzdata Configure Networking To configure networking, edit /etc/network/interfaces, /etc/resolv.conf, /etc/hostname and /etc/hosts. # editor /etc/network/interfaces Here are some simple examples from /usr/share/doc/ifupdown/examples: ###################################################################### # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # See the interfaces(5) manpage for information on what options are # available. ###################################################################### # We always want the loopback interface. # auto lo iface lo inet loopback # To use dhcp: # # auto eth0 # iface eth0 inet dhcp # An example static IP setup: (broadcast and gateway are optional) # # auto eth0 # iface eth0 inet static # address 192.168.0.42 # network 192.168.0.0 # netmask 255.255.255.0 # broadcast 192.168.0.255 # gateway 192.168.0.1 Enter your nameserver(s) and search directives in /etc/resolv.conf: # editor /etc/resolv.conf A simple example /etc/resolv.conf: search hqdom.local nameserver 10.1.1.36 nameserver 192.168.9.100 Enter your system's host name (2 to 63 characters): # echo DebianHostName > /etc/hostname And a basic /etc/hosts with IPv6 support: 127.0.0.1 localhost 127.0.1.1 DebianHostName # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts 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. Configure Apt Debootstrap will have created a very basic /etc/apt/sources.list that will allow installing additional packages. However, you may want to add some additional sources, for example for source packages and security updates: deb-src http://ftp.us.debian.org/debian &releasename; main deb http://security.debian.org/ &releasename;/updates main deb-src http://security.debian.org/ &releasename;/updates main Make sure to run aptitude update after you have made changes to the sources list. Configure Locales and Keyboard To configure your locale settings to use a language other than English, install the locales support package and configure it. Currently the use of UTF-8 locales is recommended. # aptitude install locales # dpkg-reconfigure locales To configure your keyboard (if needed): # aptitude install console-data # dpkg-reconfigure console-data Note that the keyboard cannot be set while in the chroot, but will be configured for the next reboot. Install a Kernel If you intend to boot this system, you probably want a &arch-kernel; kernel and a boot loader. Identify available pre-packaged kernels with: # apt-cache search &kernelpackage; Then install the kernel package of your choice using its package name. # aptitude install &kernelpackage;-&kernelversion;-arch-etc Set up the Boot Loader To make your &debian-gnu; 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 aptitude inside your &debian; chroot to do so. Check info grub or man lilo.conf for instructions on setting up the bootloader. If you are keeping the system you used to install &debian;, just add an entry for the &debian; install to your existing grub menu.lstor lilo.conf. For lilo.conf, you could also copy it to the new system and edit it there. After you are done editing, call lilo (remember it will use lilo.conf relative to the system you call it from). Installing and setting up grub is as easy as: # aptitude install grub # grub-install /dev/hda # update-grub The second command will install grub (in this case in the MBR of hda). The last command will create a sane and working /boot/grub/menu.lst. Note that this assumes that a /dev/hda device file has been created. There are alternative methods to install grub, but those are outside the scope of this appendix. Here is a basic /etc/lilo.conf as an example: boot=/dev/hda6 root=/dev/hda6 install=menu delay=20 lba32 image=/vmlinuz initrd=/initrd.img label=Debian Check man yaboot.conf for instructions on setting up the bootloader. If you are keeping the system you used to install &debian;, just add an entry for the &debian; install to your existing yaboot.conf. You could also copy it to the new system and edit it there. After you are done editing, call ybin (remember it will use yaboot.conf relative to the system you call it from). Here is a basic /etc/yaboot.conf as an example: boot=/dev/hda2 device=hd: partition=6 root=/dev/hda6 magicboot=/usr/lib/yaboot/ofboot timeout=50 image=/vmlinux label=Debian On some machines, you may need to use ide0: instead of hd:. Finishing touches As mentioned earlier, the installed system will be very basic. If you would like to make the system a bit more mature, there is an easy method to install all packages with standard priority: # tasksel install standard Of course, you can also just use aptitude to install packages individually. After the installation there will be a lot of downloaded packages in /var/cache/apt/archives/. You can free up some diskspace by running: # aptitude clean