#
# Debian 5 lenny 安装日志
#
# ==============================================================================
# 用 ubuntu-8.04.3-desktop-amd64.iso 启动,更改 root 口令后打开其登录 shell
sudo passwd root
su -
# 分区
cfdisk /dev/sda
# 创建文件系统
mkfs.ext2 /dev/sda1
mkfs.ext3 /dev/sda2
mkfs.ext3 /dev/sda5
tune2fs -c 127 /dev/sda1
tune2fs -c 127 /dev/sda2
tune2fs -c 127 /dev/sda5
# 挂载
mkdir /mnt/debian
mount /dev/sda2 /mnt/debian
mkdir /mnt/debian/boot /mnt/debian/home
mount /dev/sda1 /mnt/debian/boot
mount /dev/sda5 /mnt/debian/home
# 我习惯把包缓存脱离根分区
mkdir -p /mnt/debian/home/root/archives /mnt/debian/var/cache/apt
ln -s ../../../home/root/archives /mnt/debian/var/cache/apt/
# 随便
ln -s . /mnt/ubuntu/boot/boot
# ------------------------------------------------------------------------------
# 下载 debootstrap
wget
http://ftp.tw.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.10lenny1_all.deb# 安装 debootstrap
dpkg -i debootstrap_1.0.10lenny1_all.deb
# 运行 debootstrap 安装基本系统,版本代号 lenny
debootstrap --arch amd64 lenny /mnt/debian
http://ftp.tw.debian.org/debian/# ------------------------------------------------------------------------------
# 文件系统表
vi /etc/fstab {
proc /proc proc defaults 0 0
/dev/sda1 /boot ext2 noauto 0 2
/dev/sda2 / ext3 errors=remount-ro 0 1
/dev/sda5 /home ext3 defaults 0 2
#/dev/sda6 /vm ext3 defaults 0 2
#/dev/sda7 /pub ext3 defaults 0 2
}
# ------------------------------------------------------------------------------
# 网卡
vi /mnt/debian/etc/network/interfaces {
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
}
# 路由配置,用 ubuntu livecd 会自动正确配置,可检查一下
vi /mnt/debian/etc/resolv.conf {
domain domain
search domain
nameserver 10.0.2.3
}
# 计算机名
echo cp2 > /mnt/debian/etc/hostname
# ------------------------------------------------------------------------------
# 其它配置,习惯问题
vi /mnt/debian/etc/inputrc {
"\e[A": history-search-backward
"\e[B": history-search-forward
}
vi /mnt/debian/root/.bashrc {
export PS1='>$?< \W\$ '
alias ls='ls -AF'
date
}
# ------------------------------------------------------------------------------
# 挂载 /proc 、/sys 和 /dev
mount -t proc proc /mnt/debian/proc
mount -t sysfs sysfs /mnt/debian/sys
mount -o bind /dev /mnt/debian/dev
# 换根
LANG=C chroot /mnt/debian /bin/bash
# 醒目
export PS1='[chroot]>$?< \W\$ '
# ==============================================================================
# 导入 multimedia 、backports 源公钥
pushd /tmp
wget
http://ftp.tw.debian.org/debian-multimedia/pool/main/d/debian-multimedia-keyring/debian-multimedia-keyring_2008.10.16_all.debwget
http://ftp.tw.debian.org/backports.org/pool/main/d/debian-backports-keyring/debian-backports-keyring_2009.02.20_all.debdpkg -i debian-multimedia-keyring_2008.10.16_all.deb debian-backports-keyring_2009.02.20_all.deb
popd
# 设源
vi /etc/apt/sources.list {
deb
http://ftp.tw.debian.org/debian lenny main contrib non-free
#deb
http://security.debian.org/debian-security lenny/updates main contrib non-free
deb
http://ftp.sjtu.edu.cn/debian-security lenny/updates main contrib non-free
deb
http://ftp.tw.debian.org/debian-volatile lenny/volatile main contrib non-free
deb
http://ftp.tw.debian.org/debian-multimedia lenny main
deb
http://ftp.tw.debian.org/backports.org lenny-backports main contrib non-free
}
# 刷表
aptitude update
# 更新
aptitude safe-upgrade
aptitude full-upgrade
# ------------------------------------------------------------------------------
# 若硬时钟非 UTC
vi /etc/default/rcS {
UTC=no
}
# 时区
dpkg-reconfigure tzdata {
Asia/Shanghai
}
# 本地化
aptitude install -R locales
dpkg-reconfigure locales {
en_US.UTF-8 # 默认
zh_CN.UTF-8
}
# 键盘
aptitude install -R console-data console-tools console-common
# 若上一命令执行时设置错了,可再次配置
dpkg-reconfigure console-data
# ------------------------------------------------------------------------------
# 引导器
# Debian 文档说先装内核再安装引导器,但尝试出错,只能先安装引导器。
aptitude install -R grub-legacy
grep -v rootfs /proc/mounts > /etc/mtab <<<<<
grub-install /dev/sda
update-grub
# 内核映象配置文件
vi /etc/kernel-img.conf {
# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = update-grub
postrm_hook = update-grub
}
# 内核
aptitude search ^linux-image
aptitude install -R linux-image-2.6-amd64
# 检查或定制引导配置
vi /boot/grub/menu.lst {
}
# ------------------------------------------------------------------------------
# 保存一份包列表,以备日后研究
dpkg -l > ~/pkg-000.lst
# 设置口令
passwd
# 退出 chroot 环境
exit
# 卸载
umount /mnt/debian/dev /mnt/debian/sys /mnt/debian/proc
umount /mnt/debian/boot /mnt/debian/home /mnt/debian
# 退出并重启
exit
# ==============================================================================
# 重启进入新系统后
# 后续安装……
复制代码