Use debootstrap to install debian on an existing Linux System

Source: Internet
Author: User
Tags nameserver
Debootstrap is used to install debian-Linux Release Technology-Debian information on an existing Linux system. The following is a detailed description. I found some information on the internet yesterday and installed debian on ubuntu with debootstrap. Let's summarize the process:

(1) debootstrap:
Apt-get install debootstrap

(2) the hard disk partitions to be used for debian are formatted and mounted to any directory, such as/mnt/debinst/

If you want to mount some directories in the root directory from another partition instead of a root partition, for example, we often mount/usr/local from another partition. For example, the following command is to submit/usr/local to another partition:

Mkdir/mnt/debinst/usr/local-p
Mount/dev/hdXX/mnt/debinst/usr/local

(3) Use debootstrap to create a basic system in a directory such as/mnt/debinst/, for example:

Debootstrap sarge/mnt/debinst/http://http.us.debian.org/debia

Debootstrap downloads some files from the Internet to make/mnt/debist/a chroot sub-environment, that is, a basic system. The source selection is very important. If the source was upted, the installation may fail. For example, I chose cn99 for the first time, and the result failed.

At this time,/mnt/debinst/is already a basic system, with poor configuration, software installation, and a bootable kernel. The following describes how to complete these tasks:

(4) Some device files may be missing in the basic system. For example, some block files, such as hdX, are missing during installation, which can be copied from the main system, for example:

Cp/dev/hda */mnt/debinst/dev/-ap

(5) chroot to the basic system:
Chroot/mnt/debinst

(6) Configure/etc/fstab,/etc/hostname,/etc/resolv. conf,/etc/network/interfaces, and mount the file system. If the mounting fails, it is likely that the device file is missing. You can press (4) to solve the problem. Samples of configuration files can be found at debian.org. The excerpt is as follows:

/Etc/fstab:
#/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 defaults 0 0

/Dev/fd0/mnt/floppy auto noauto, rw, sync, user, exec 0 0
/Dev/cdrom/mnt/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
/Etc/hostname:

DebianHostName


/Etc/resolv. conf:
Search hqdom. local {post. abstract} 0
Nameserver 10.1.1.36
Nameserver 192.168.9.100
/Etc/network/interfaces:


#/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

Modify the preceding sample to suit your needs.

(7) Configure apt. If you use ppp to access the Internet, install ppp now (otherwise, restart and enter the new environment ......).

(8) install the kernel and boot program.

Apt-get install kernel-image-2.6.18.4-XXXX
Apt-get install grub

You can also exit to modify the/boot/grub/menu. lst of the main system without installing grub. Note that if the initrd kernel is installed, you must add initrd to/boot/menu. lst.

(9) reboot, and install other software in the new system.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.