D.3. Installing Debian GNU/Linux from a Unix/Linux System (2023)

This section explains how to install Debian GNU/Linux from an existingUnix or Linux system, without using the menu-driven installer asexplained in the rest of the manual. This cross-installHOWTO has been requested by users switching to Debian GNU/Linux fromRed Hat, Mandriva, and SUSE. In this section some familiarity withentering *nix commands and navigating the file system is assumed. Inthis section, $ symbolizes a command to be entered inthe user's current system, while # refers to acommand 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 onrolling. This is therefore a zero downtime Debian GNU/Linuxinstall. It's also a clever way for dealing with hardware thatotherwise doesn't play friendly with various boot or installationmedia.


As this is a mostly manual procedure, you should bear in mind that youwill need to do a lot of basic configuration of the system yourself,which will also require more knowledge of Debian and of Linux in generalthan performing a regular installation. You cannot expect this procedureto result in a system that is identical to a system from a regularinstallation. You should also keep in mind that this procedure onlygives the basic steps to set up a system. Additional installation and/orconfiguration steps may be needed.

D.3.1.Getting Started

With your current *nix partitioning tools, repartition the harddrive as needed, creating at least one filesystem plus swap. Youneed around 432MB of space available for a console only install,or about 1521MB if you plan to install X (more if you intend toinstall desktop environments like GNOME or KDE).

Next, create file systems on the partitions. For example, to create anext3 file system on partition /dev/hda6 (that'sour example root partition):

# mke2fs -j /dev/hda6

To create an ext2 file system instead, omit -j.

Initialize and activate swap (substitute the partition number foryour intended Debian swap partition):

# mkswap /dev/hda5# sync# swapon /dev/hda5

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

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


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

D.3.2.Install debootstrap

The utility used by the Debian installer, and recognized as theofficial way to install a Debian base system, isdebootstrap. It uses wget andar, but otherwise depends only on/bin/sh and basic Unix/Linux tools[22]. Install wget andar if they aren't already on your current system,then download and install debootstrap.

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

# mkdir work# cd work

The debootstrap binary is located in the Debianarchive (be sure to select the proper file for yourarchitecture). Download the debootstrap .deb fromthe pool, copy the package to the work folder, and extract thefiles from it. You will need to have root privileges to installthe files.

# ar -x debootstrap_0.X.X_all.deb# cd /# zcat /full-path-to-work/work/data.tar.gz | tar xv

D.3.3.Run debootstrap

debootstrap can download the needed files directlyfrom the archive when you run it. You can substitute any Debianarchive mirror for http.us.debian.org/debian inthe command example below, preferably a mirror close to younetwork-wise. Mirrors are listed athttp://www.debian.org/mirror/list.

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

Substitute one of the following for ARCHin the debootstrap command:amd64,armel,armhf,i386,ia64,mips,mipsel,powerpc,s390,s390x, orsparc.

# /usr/sbin/debootstrap --arch ARCH wheezy \ /mnt/debinst http://ftp.us.debian.org/debian

D.3.4.Configure The Base System

Now you've got a real Debian system, though rather lean, on disk.chroot into it:

# LANG=C.UTF-8 chroot /mnt/debinst /bin/bash

After chrooting you may need to set the terminal definition to becompatible with the Debian base system, for example:

# export TERM=xterm-color

Depending on the value of TERM, you may have to install thencurses-term package to get support for it.

D.3.4.1.Create device files

At this point /dev/ only contains very basic devicefiles. For the next steps of the installation additional device files maybe needed. There are different ways to go about this and which method youshould 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 youintend to use dynamic (e.g. using udev) or staticdevice files for the new system.

A few of the available options are:

  • install the makedev package, and create a default set of static device filesusing (after chrooting)

    # apt-get install makedev# mount none /proc -t proc# 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 devicefiles, so this option should only be used with care

D.3.4.2.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 0proc /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 youhave specified in your /etc/fstab, or, to mountfile 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 arbitrarylocations, though /proc is customary. If you didn't usemount -a, be sure to mount proc before continuing:

# mount -t proc proc /proc

The command ls /proc should now show a non-emptydirectory. Should this fail, you may be able to mount proc from outsidethe chroot:

# mount -t proc proc /mnt/debinst/proc
(Video) Install Debian Linux: Download and Install Debian on Your Computer

D.3.4.3.Setting Timezone

Setting the third line of the file /etc/adjtime to UTC or LOCAL determineswhether the system will interpret the hardware clock as being set to UTCrespective local time. The following command allows you to set that.

# editor /etc/adjtime

Here is a sample:

0.0 0 0.00UTC

The following command allows you to choose your timezone.

# dpkg-reconfigure tzdata

D.3.4.4.Configure Networking

(Video) Debian 12 - The First 12 Things You Should Do After Installation!

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 loiface 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 network netmask broadcast gateway

Enter your nameserver(s) and search directives in/etc/resolv.conf:

# editor /etc/resolv.conf

A simple example /etc/resolv.conf:

search hqdom.localnameserver

Enter your system's host name (2 to 63 characters):

# echo DebianHostName > /etc/hostname

And a basic /etc/hosts with IPv6 support: localhost127.0.1.1 DebianHostName# The following lines are desirable for IPv6 capable hosts::1 ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allroutersff02::3 ip6-allhosts

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

D.3.4.5.Configure Apt

Debootstrap will have created a very basic/etc/apt/sources.list that will allow installingadditional 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 wheezy maindeb http://security.debian.org/ wheezy/updates maindeb-src http://security.debian.org/ wheezy/updates main

Make sure to run aptitude update after you havemade changes to the sources list.

D.3.4.6.Configure Locales and Keyboard

To configure your locale settings to use a language other thanEnglish, install the locales support packageand 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-setup# dpkg-reconfigure keyboard-configuration 

Note that the keyboard cannot be set while in the chroot, but will beconfigured for the next reboot.

(Video) How to install and run DEBIAN LINUX on your system

D.3.5.Install a Kernel

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

# apt-cache search linux-image

Then install the kernel package of your choice using its package name.

# aptitude install linux-image-arch-etc

D.3.6.Set up the Boot Loader

To make your Debian GNU/Linux system bootable, set up your boot loader to loadthe installed kernel with your new root partition. Note thatdebootstrap does not install a boot loader, though youcan use aptitude inside your Debian chroot to do so.

Note that this assumes that a /dev/hda device file hasbeen created. There are alternative methods to install grub2,but those are outside the scope of this appendix.

D.3.7.Remote access: Installing SSH and setting a password

In case you can login to the system via console, you can skip this section. Ifthe system should be accessible via the network later on, you need to installSSH and set a password for root:

# aptitude install ssh# passwd

D.3.8.Finishing touches

As mentioned earlier, the installed system will be very basic. If youwould like to make the system a bit more mature, there is an easy methodto install all packages with standard priority:

# tasksel install standard

Of course, you can also just use aptitude to installpackages individually.

After the installation there will be a lot of downloaded packages in/var/cache/apt/archives/. You can free up somediskspace by running:

# aptitude clean
(Video) Watch This Before Installing Debian 12!

[22] These include the GNU core utilities and commands like sed, grep, tar and gzip.


How to install GNU make on Debian? ›

How to Download / Install GNU Make. If you're on Linux, the make program is probably already installed. If not, you can install it with the following commands: Debian/Ubuntu – apt install make.

Is Debian GNU Linux good? ›

Bug-Free: Debian's standard version is highly reliable since it rigorously tests software and libraries. Because of its dependability, Debian Stable is an ideal server operating system. This is one of the grounds why many developers utilize Debian as the foundation for their derivative distributions, like Ubuntu.

How to install Debian file in Linux terminal? ›

Installing deb package on Ubuntu/Debian
  1. Install gdebi tool and then open and install the . deb file using it.
  2. Use dpkg and apt-get command line tools as follows: sudo dpkg -i /absolute/path/to/deb/file sudo apt-get install -f.

How to install Debian package from command line? ›

You can install a downloaded Debian package using dpkg in a terminal: dpkg -i *. deb (where *. deb is the path and name of the package you downloaded).

How to make a bootable USB for Debian? ›

Install Debian Linux by creating Flash Drive on Windows
  1. Step 1: Download Debian Linux ISO File. ...
  2. Step 2: Download Rufus Flashing tool. ...
  3. Step 3: Flash Debian Linux ISO to USB Flash Drive. ...
  4. Step 4: Set and Boot from bootable Flash Drive. ...
  5. Step 5: Install Debian Linux.

Is it easy to install Debian? ›

Debian is one of the oldest and most popular Linux distributions, but it has a reputation as being for more technical people. In reality, Debian is easy to install as long as you go through the installation program carefully.

How to install GnuPG on Debian 11? ›

The most common way would be to use apt-get . First, you have to update the apt database using the update command. After you have updated the database on your system, you can install gnupg via the install command.

Can you try Debian without installing? ›

You can try Debian by booting a live system from a CD, DVD or USB key without installing any files to the computer. When you are ready, you can run the included installer (starting from Debian 10 Buster, this is the end-user-friendly Calamares Installer).

What is Debian GNU Linux used for? ›

Debian offers over 59,000 packages that support a wide range of capabilities. For example, Debian provides packages for editing documents, developing software, administering systems, connecting to networks, debugging packages, mixing sound, routing email and playing games.

Why do people use Debian? ›

Most users appreciate the stability, and the smooth upgrade processes of both packages and the entire distribution. Debian is also widely used by software and hardware developers because it runs on numerous architectures and devices, offers a public bug tracker and other tools for developers.

Is Debian and GNU Linux the same thing? ›

Debian (/ˈdɛbiən/), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993.

How to install makefile on Linux? ›

Your general installation procedure will therefore be:
  1. Read the README file and other applicable docs.
  2. Run xmkmf -a, or the INSTALL or configure script.
  3. Check the Makefile .
  4. If necessary, run make clean, make Makefiles, make includes, and make depend.
  5. Run make.
  6. Check file permissions.
  7. If necessary, run make install.

How to install Composer on Debian Linux? ›

To install composer globally, use the following command to download and install Composer as a system-wide command named composer under /usr/local/bin : sudo php composer-setup. php --install-dir=/usr/local/bin --filename=composer.

How to install Google fonts on Debian? ›

Create a .fonts directory in home using the terminal and the command:
  1. mkdir ~/.fonts. Unzip the contents of the downloaded file (approx. ...
  2. cd ~/.fonts; unzip ~/Downloads/master.zip. Regenerate the font cache command:
  3. sudo fc-cache -fv.


1. How to Install Linux for Beginners
(Chris Titus Tech)
2. Installing Debian Linux 2.1 From 1999 Was A Painful Experience ...
3. Installing Linux The "Right" Way
(Chris Titus Tech)
4. Introduction to Linux – Full Course for Beginners
5. #2 DevOps From Scratch | History of Unix and Linux, Installing Debian 10 on VirtualBox
6. Linux Operating System - Crash Course for Beginners
Top Articles
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated: 23/07/2023

Views: 5553

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.