Linux DevCenter    
 Published on Linux DevCenter (http://www.linuxdevcenter.com/)
 See this if you're having trouble printing code examples


Installing Debian

by Edd Dumbill
09/29/2005

The experience of installing Debian can vary widely depending on your hardware and requirements. There simply isn't room here to provide a comprehensive installation guide. Instead, you'll find an outline of the major points of the installation process, and plenty of information about where to go and what to do when things don't work as expected.

While Debian has a great reputation for day-to-day use, it has a poor (and not entirely unmerited) reputation for ease of installation. However, with the Debian 3.1 release, code-named Sarge, the developers have taken major steps to improve the installation experience, so don't be afraid.

Perhaps the best advice I can give concerning Debian installation is to not expect to always get it right the first time. If you're ready to start over and experiment, you'll soon become happy with the installation process.

Installing Debian

Most of the articles in this series will give you tasks that help you learn about Debian as you work through them. You'll be able to dive right in, as the amount of explanation at the beginning of an article will be minimal. Installing Debian is a little different; you probably don't want to repeat it too often. The time you spend reading about the installation process beforehand will reward you when you do the install.

The most straightforward installations are onto a computer with a fresh hard disk dedicated to Debian. However, you can install Debian in almost any configuration, in peaceful coexistence with other operating systems. If you do not have a disk you can dedicate to Debian, your most important first step is to back up all your existing data before starting the installation process.

This article walks you through the Debian installation process. If you have special requirements, it almost certainly won't cover those, but it will tell you how to cater for them.

Equip yourself

Learn Debian-speak for your computer's architecture. A Mac needs the PowerPC installer, while a PC needs Intel x86.

First, get a copy of the official Debian installation guide. This will be useful to have at your side during the installation process. Besides the online version, you can find it in the doc/install directory on a Debian CD.

The next decision to make is about installation media. The most well-trodden path is to use a set of Debian installation CDs. In addition to downloading them, you can purchase them from a vendor; the same web page gives details about that too. If you have broadband internet access, the best strategy may well be to perform a net installation, which requires only a small CD download and installs everything else over the network.

If you've got no CD drive, you can download a set of floppy disk images to use with a network installation.

There are a variety of other installation methods, including a 100 percent networked installation (requiring no CD at all). This article presumes you are using either a full CD/DVD or a small CD plus network installation. Debian also runs on many computing architectures, but for the purposes of this article we assume you are targeting a conventional PC or new-style Mac computer (G3 500 processor or better). The Debian installer documentation covers the particular nuances of your architecture of choice.

Starting the installation

If you don't back up your data, don't blame us if you lose it!

Before booting the installation CD, ensure that you have backed up your data and have spare space on the target hard drive to install Debian. A completely fresh hard drive is ideal.

If you intend to dual-boot with Windows, that may mean using a tool such as Partition Magic to resize the Windows partition and clear some space. Mac users will either need to back up and reinstall their computer, using Disk Utility to reserve space for Debian, or use a third-party partitioning tool to move their data around.

On Macs, the order of the partitions matters for Debian, so read the installer docs carefully.

Now, boot from the installation media. PC users may have to configure their BIOS to ensure that the machine boots from the CD; Mac users should hold down the C key on system power-up. On boot, PC users will see a screen as in Figure 1, Mac users a more basic text display. On both platforms, the normal procedure is to just press the Enter key to boot the installer. However, if you need special settings to make the installer work with your system, enter them at this point. PC users can find a summary of the options by using the help accessible from the function keys; Mac users can refer to the text already onscreen.

initial Debian installer screen
Figure 1. Initial Debian installer screen

One important boot option common to all architectures is the expert mode. Normally, the installer will choose sensible defaults for most configuration options. It may happen that for some reason this does not suit your system. In that case, entering expert as one of the installer boot options switches the installer to expert mode. It will then ask you questions about almost every aspect of the installation. Don't use this unless you really need to!

Beware: if during the installation process you need to cancel an operation due to an error such as the network not being available, the installer automatically puts you into expert mode for the rest of the process. In most cases, this just means you should take the presented defaults for all the extra questions.

Debian System

Related Reading

Debian System
Concepts and Techniques
By Martin F. Krafft

Network configuration

Unlike some other Linuxes, Debian allows you to add more languages later, by running dpkg-reconfigure locales as root.

Once booted, the installer will guide you through a succession of menus. Figure 2 shows the first of these, language choice. Navigate the installer menus with the keyboard: the up and down arrow keys move the selection, and Enter selects it. When multiple selections are available, the space bar toggles selections on and off. Where a menu has options such as Go Back, use the Tab key or left and right arrow keys to jump to those.

installer language choice menu
Figure 2. Installer language choice menu

It's possible to install Debian over a wireless network, but only with certain wireless cards.

Once your language, location, and keyboard choice are set up, the installer attempts to configure the network. The way to make this easiest on yourself is to have the machine plugged in to a DCHP-capable network, so you need to do as little configuration as possible. (Most small business and home network routers have DHCP available by default.) If you're installing just from CDs, then it's OK to proceed without configuring the network.

The final stage of the network configuration is to choose the hostname and domain name. These constitute your computer's identity on the network. Unless you configured the network manually and have predetermined the hostname, it's fine to accept the defaults here. You can always change them later.

Partitioning the disk

Debian, like any Linux, divides up a disk for different purposes. The minimum basic configuration is to have two partitions, one for disk storage and one for swap space, the virtual memory used by Linux to store parts of programs when it doesn't need them in physical memory. Partitioning is one of the few choices you make in the Debian installer that you can't really fix afterward without a complete reinstallation, so a sensible strategy is to refrain from making it more complicated for yourself than it needs to be.

When it comes to partitioning the disk for installation, you find the value of being able to dedicate a whole disk.

The partition stage of the installer offers two choices: to erase the entire disk or to configure the partitions manually.

Following the whole-disk strategy first, the installer will use "guided partitioning" mode. Here you will face a choice between three setups: all files in one partition, a desktop setup with a separate partition for home directories, and a multiuser setup with a partition for each of /, /home, /usr, /var and /tmp. If you don't understand the significance of the multiple partitions, then you are unlikely to need to choose the multiuser setup. If in any doubt, just choose the first option, recommended for new users.

After making a choice on partitioning, you will see a screen similar to that in Figure 3, where you should choose to finish the partitioning and write the changes to disk.

Partition summary screen
Figure 3. Partition summary screen

If you wish to dual-boot your computer or have more specialized partitioning requirements, follow the manual partitioning path. This will bring you directly to the screen in Figure 3, which will show the existing partitioning strategy for the disk. This list of partitions will show any existing partitions from Windows, indicated by ntfs, or Mac OS X, indicated by hfs+ or Macintosh.

The minimum requirement for partitioning is to set up a partition for the root filesystem, /, and a swap partition. You must have free space for doing this, which either you freed up earlier or can make by deleting unwanted partitions. Be careful about deleting partitions you don't understand. Many new PCs keep suspend-to-RAM or recovery partitions at the beginning of the disk, and it's better to keep those. Likewise, Macs have a succession of drivers stored in separate partitions on the disk that should remain.

To make a new partition, select the FREE SPACE entry and press Enter. If you then choose to partition the free space automatically, the procedure becomes that of the guided partitioning described earlier. Otherwise you must create your own partitions. The "Partitioning and Mount Point Selection" section of the Debian installation guide describes this process.

By default, the Debian installer will choose the ext3 filesystem for your disks. This is a well-tested filesystem with journaling capability, which means it can recover from crashes easily. More advanced users may wish to choose other filesystems, which is possible by the manual editing of the partition tables. If you use RAID or Logical Volume Manager systems for disk management, the installer also has special options; choose the appropriate options from the partition list screen.

Mac users should note one subtlety in partitioning. Debian requires a NewWorld boot partition of about 1MB in order to boot. The guided partitioning automatically sets this up, but if you're choosing the manual route, be sure to create this partition. The installer won't let you proceed without it.

For PC users, the final stage of partitioning is the installation of the grub boot loader, a program that handles the choice of different operating systems on machine power-up. Accepting the defaults the installer offers is fine here; it will install grub on the hard disk and configure it to show a choice of all operating systems available on the disk. If you want to use another boot loader of your choice, consult the "Making Your System Bootable" section of the Debian installer documentation.

Configuring the base system

When partitioning is complete, the installer will copy over the base Debian system to the hard disk, and then eject the installation CD. At this point, you will be asked to confirm that you want the computer rebooted. This is the moment of truth!

On reboot, PC users will find themselves looking at the grub boot screen, a list of operating systems available on the computer. Mac users will find themselves in yaboot, which offers a choice of booting Linux, OS X, or a CD-ROM. In both cases, after a few seconds' wait, the machines will boot the default choice, Debian.

There are now just a handful of questions to answer before the installation completes.

Time zone configuration

Unless you intend to dual-boot Windows and Linux, you should confirm that your hardware clock uses the GMT format here. (Note that UTC, which the installer displays, is the same as GMT.) After this, pick your time zone from the list displayed. You can configure the time zone later by running tzsetup as the root user.

Root password

The root user, or superuser, is able to modify anything on your machine. This is the most important system password.

User account

This is an initial user account for you to use. Enter your full name first, and then an abbreviated login name and password.

APT configuration

APT is the mechanism Debian uses to manage and install software packages. Before the rest of the installation can commence, you must select a source from which APT can install packages. When installing via CDs, choose cdrom, and insert each CD in turn for scanning. If you don't have a network connection, the installer will ask you if you want to set up a PPP (dial-up) connection in order to download security updates. This is the recommended approach if you have a modem attached to the computer.

Some internet service providers maintain their own Debian mirrors: if your ISP is in the list, choose their mirror.

If performing a net installation, choose http. You must then choose which Debian server, or mirror, to use. Pick the one closest to you. If you are on a network with an HTTP proxy, there's an opportunity to enter this before proceeding. The installer will then retrieve the list of available packages, including any security updates, from the network.

The final choice to make before installation gets under way is the software you wish to have preinstalled, as Figure 4 shows. You can select one or more of these options to include a variety of software. If you're doing a net installation, be aware that this can have a significant effect on download time!

Software selection menu
Figure 4. Software selection menu

What do you get if you choose the preinstalled selections?

Desktop environment

Installs the XFree86 graphical windowing system, plus the GNOME and KDE desktop environments.

Web server

Installs the Apache 2 web server.

Print server

Installs the Common Unix Printing System (CUPS), setting your machine up as a print server.

DNS server

Installs the Berkeley Internet Name Daemon (BIND), for serving DNS requests.

Mail server

Installs the Exim 4 mail server.

SQL database

Installs the PostgreSQL relational database server.

Manual package selection

This option allows you to use aptitude to manually pick from the packages Debian has available.

If you don't choose anything extra from the selection menu, you get just the standard system installed. Veterans of multiple installations often find this works best for them, as they can selectively install just the software they want at a later date. The contents of the standard system include everything to get the system and its hardware running, everything you'd expect on a normal Unix system, a C programming environment, Python and Perl interpreters, and network tools.

If you've chosen extra software packages, the remaining installation process will perform any essential configuration they require. As they're optional, I won't deal with them here. The most important is probably the XFree86 windowing system configuration.

The standard installation asks just a few more questions to get your system configured. Unless you have special requirements, accept the suggested defaults.

Configuring the mail server

The final step of configuration is to set up the email server on the machine. Debian's default email server is Exim 4, and its web site has comprehensive documentation. Unless you are configuring a mail hub for multiple users, one of the presets provided by the installation process will suit your purposes.

A smart host is an email server that will send on mail for you; ISPs more commonly refer to it as an outgoing mail server.

The first question the Exim setup process asks is whether you want to split its configuration into small files. Choose this only if you're going to be doing extensive configuration later on, as it provides a flexible but fussy infrastructure. The process then gives four main preset options for email delivery, depending on the intended use of the server. Systems intended for personal use should choose "mail sent by smarthost; received via SMTP or fetchmail." Satellite workstations probably require "mail sent by smarthost; no local mail." If you're unsure or just don't want to think about it, opt for "no configuration at this time." You can always start the configuration again later by running dpkg-reconfigure exim4-config as the root user.

Finally, the installer will ask where to have administrative email sent. This will normally be your own user account or email address.

That's it. Whew! Now you can log in to your new Debian system and start exploring.

When disaster strikes

What about when something goes wrong? The cause of installation failure is most likely to be a problem with Linux recognizing some part of a system's hardware. At this point, you need to determine whether Linux actually supports the item of hardware at all. Searching the Web is usually an effective way of doing this. You could also try booting from a Knoppix CD, a Linux system that runs exclusively from the CD. If your hardware is supported, there is probably a boot option or a workaround you can use to get Debian to install.

Linux 2.6 is the default for Mac installs because of improved hardware support, but Debian does not consider it stable enough for the PC, where 2.4 is the default.

For certain types of hardware setups, the only requirement is an extra option when you boot the installer CD. From the PC installer boot screen, use the function keys to display help screens with the various options. Mac users can type help to view more options. Another possibility on PC systems is that the default Linux kernel, which uses the 2.4 series of kernels, doesn't contain support for your hardware but the 2.6 series does. Try the linux26 boot option in that case.

If, after carefully reading the Debian installation manual, you still don't have a solution to your problem, then try asking for help in one of the many support forums available for Debian. The Debian web site contains details on where to find these.

If your machine is locking up on boot and you have no other way to transcribe the errors, taking a picture of the screen with a digital camera can be a good way to capture the debugging messages.

When you encounter an error in the installation process, an error report usually appears against a red screen. To see more detailed messages, view the error log by pressing Alt-F3. Shift-Page Up and Shift-Page Down will scroll through these error messages. If you need to pause the flow of log messages at any point, use Ctrl-S to stop the screen scrolling, and Ctrl-Q to resume. This can be very useful at boot time.

If there is obviously no way to fix your problem, the final resort is to file a bug with the Debian installer team. The section Troubleshooting the Install Process in the Debian installation manual provides a template that you can fill out and email to the Debian bug-tracking system. From there, a team member may contact you about the problem.

Edd Dumbill is co-chair of the O'Reilly Open Source Convention. He is also chair of the XTech web technology conference. Edd conceived and developed Expectnation, a hosted service for organizing and producing conferences. Edd has also been Managing Editor for XML.com, a Debian developer, and GNOME contributor. He writes a blog called Behind the Times.


Return to the Linux DevCenter.

Copyright © 2009 O'Reilly Media, Inc.