|
By ppip@bbs.nankai.edu.cn
来自 Installing Debian GNU/Linux 3.0 For Intel x86,仅仅写出了步骤而已,如果需要详细说明,请参考原文。
3.7 在 Unix/Linux 系统下安装 Debian GNU/Linux
注意:在以下的说明中,$ 表示你现在的系统,# 表示 chroot 之后的系统。
3.7.1 开始
可以用以下命令在 /dev/hda6 上建立一个 EXT3 文件系统
$ mke2fs -j /dev/hda6
如果要建立 EXT2 文件系统,去掉 -j 选项。
初始化并激活交换分区 (substitute the partition number for your intended Debian swap partition,这里我还不是太明白):
$ mkswap /dev/hda5
$ sync; sync; sync
$ swapon /dev/hda5
加载根分区,/mnt/debinst 最好不要改变,因为下面要用到。
$ mkdir /mnt/debinst
$ mount /dev/hda6 /mnt/debinst
3.7.2 安装 debootstrap
debootstrap 是官方的安装 Debian 的方法,它基于 wget ,如果你的系统上没有 wget ,请先下载安装。
如果你使用 .rpm 的系统,可以使用 alien 把 .deb 转换为 .rpm,或者在 http://people.debian.org/~blade/install/debootstrap 下载 .rpm 版本。
建立下面目录,并在其中解开 .deb 文件:
$ mkdir work
$ cd work
debootstrap 二进制文件在 .deb 包中,可以在 http://ftp.debian.org/debian/pool/main/d/debootstrap/ 下载,注意选择正确的平台。把 .deb 文件复制到 work 目录中并解开,你需要有 root 权限。
$ ar -xf debootstrap_0.X.X(版本)_arch(平台).deb
$ cd /
$ zcat < /到 work 的路径/work/data.tar.gz | tar xv
3.7.3 运行 debootstrap (需要连接在网络上)
debootstrap 可以直接从网络上下载需要的文件,在下面的命令中,文件将从 http.us.debian.org/debian 上得到。你可以自己选择速度更快的镜像。
如果你有 woody 的安装 CD 加载在 /cdrom 上,你可以这样写 file:/cdrom/debian/
把 ARCH 替换为正确的平台: alpha, arm, hppa, i386, ia64, m68k, mips, mipsel, powerpc, s390, 或者 sparc.
$ /usr/sbin/debootstrap --arch ARCH woody \
/mnt/debinst http://http.us.debian.org/debian
3.7.4 运行 debootstrap (使用 basedebs.tar)
debootstrap 可以使用事先下载的 basedebs.tar。
basedebs.tar 一般在 base-images-current 目录中,比如 http://http.us.debian.org/debian ... urrent/basedebs.tar
请把 ARCH 用正确的平台代替: alpha, arm, hppa, i386, ia64, m68k, mips, mipsel, powerpc, s390, 或者 sparc.
$ /usr/sbin/debootstrap --arch ARCH --unpack-tarball \
/path-to-downloaded/basedebs.tar woody /mnt/debinst
3.7.5 配制基础系统
现在你需要进入真正的 Debian 中去了:
$ chroot /mnt/debinst /bin/bash
3.7.5.1 加载盘符
你需要编辑 /etc/fstab.
# editor /etc/fstab
下面是一个例子,你可以在修改之后使用:
# /etc/fstab: static file system information.
#
# file system mount point type options dump pass
/dev/XXX / ext2 defaults 0 0
/dev/XXX /boot ext2 ro,nosuid,nodev 0 2
/dev/XXX none swap sw 0 0
proc /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 ext2 rw,nosuid,nodev 0 2
/dev/XXX /var ext2 rw,nosuid,nodev 0 2
/dev/XXX /usr ext2 rw,nodev 0 2
/dev/XXX /home ext2 rw,nosuid,nodev 0 2
使用 mount -a 加载你在 /etc/fstab 中描述的盘符,或者,分别单独加载:
# mount /路径 # 例: mount /usr
/proc 可以自己任意多次加载,但是如果你没有把他写进 /etc/fstab 中,就要在继续工作之前加载他:
# mount -t proc proc /proc
3.7.5.2 配制键盘
配制键盘用到的命令:
# dpkg-reconfigure console-data
3.7.5.3 配制网络
与网络相关的文件分别是: /etc/network/interfaces, /etc/resolv.conf, and etc/hostname.
# editor /etc/network/interfaces
下面是一个简单的例子,来自 /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
/etc/resolv.conf 中是搜索目录(?)和域名服务器:
# editor /etc/resolv.conf
/etc/resolv.conf 的例子:
# search hqdom.local\000
# nameserver 10.1.1.36
# nameserver 192.168.9.100
输入 host name (2 to 63 个字母):
# echo DebianHostName > /etc/hostname
如果你有多个网卡,就需要在 /etc/modules 文件中为他们安排好名字,这样的话,启动的时候每个网卡就会绑定到希望的名子上去 (eth0, eth1, etc.)。
3.7.5.4 配制时区,用户和 APT
命令:
# /usr/sbin/base-config
3.7.5.5 配制 Locales
如果你是非英语语系的用户,你需要配制 locale:
# apt-get install locales
# dpkg-reconfigure locales
3.7.6 安装 Kernel
如果你要让你的系统能够启动,你需要核心和正确的引导,用下面的命令找到一个你所需要的 Kernel:
# apt-cache search kernel-image
然后安装它
# apt-get install kernel-image-2.X.X-arch-etc
(ppip 注:你也可以下载 kernel-source 自己编译,我就是这么做的。)
3.7.7 设置引导器
要使新的系统能够被引导,你需要配制 lilo 或者 grub。无论在原来的系统,或在 chroot 之后的系统中都行。
===========================================================
我按照上面的步骤做了一遍,顺利的在一个 Debian 的基础上装上了另一个 Debian,感觉真是很方便,如果是其他的 Linux 发行版,应该问题也不大。如果你和我一样,引导光盘或者 lilo 引导 .bin 文件都无法启动安装程序,可以尝试一下这种安装。 |
|