Fresh Debian Install

*) mkfs.reiserfs /dev/hda1 *) mount /dev/hda1 /mnt/hda1 *) cd /mnt/hda1 *) cdebootstrap sarge . Don't use debootstrap. I found it very buggy and make sure it runs correctly *) cp /etc/resolv.conf /etc/fstab /etc/hosts /etc/hostname etc *) cp /etc/network/interfaces etc/network/ *) cp /etc/apt/sources.list etc/apt/ Edit those files above if you want something different *) chroot . *) mount -t proc proc /proc *) cd /dev; MAKEDEV generic *) base-config *) apt-get update *) apt-get install discover grub locales reiserfsprogs unzip ssh kernel-image-2.6.8-686 With the exception of ssh and unzip, it is necessary to have those packages *) mkdir /boot/grub; update-grub *) umount proc *) exit Exit chroot *) grub root (hd0,0) setup (hd0) Change this command accordingly Make sure you do grub outside of chroot shell and I found it works better doing grub instead of grub-install *) Make sure if you ever copy this stuff to a new partition you do it with cp -a. That's very important #!/bin/bash -v HDPARTITION=/dev/hda2 HDMOUNTPT=/home VERSION=sarge DEBSTATUS=testing FS=reiserfs HASPCMCIA=yes KVERSION=2.4.25-1-686 # if you have pcmcia, make sure they have pcmica modules WANTX=yes # make the file system to be reiserfs, ext3 whatever # mkfs.reiserfs $HDPARTITION # mount it mount -t $FS $HDPARTITION $HDMOUNTPT # debootstrap a new system debootstrap $VERSION $HDMOUNTPT # mount proc chroot $HDMOUNTPT mount -t proc proc /proc echo "deb http://ftp.us.debian.org/debian/ $DEBSTATUS main contrib non-free" > $HDMOUNTPT/etc/apt/sources.list # mkinitrd is bad at scanning which root device you are using. # so just make our own mkinitrd.conf mkdir $HDMOUNTPT/etc/mkinitrd echo "MODULES=most DELAY=0 ROOT=$HDPARTITION UMASK=022 MKIMAGE='mkcramfs %s %s > /dev/null' BUSYBOX=no PKGSCRIPTS=yes INITRD_LD_LIBRARY_PATH=\$LD_LIBRARY_PATH " > $HDMOUNTPT/etc/mkinitrd/mkinitrd.conf # add kernel chroot $HDMOUNTPT apt-get update chroot $HDMOUNTPT apt-get install kernel-image-$KVERSION chroot $HDMOUNTPT apt-get -y install discover grub # don't even need to do mkinitrd # if failed, do this # chroot $HDMOUNTPT mkinitrd -k -o /boot/initrd.img-$KVERSION -r $HDPARTITION /lib/modules/$KVERSION # change your root password chroot $HDMOUNTPT passwd # coping some config file from host cp /etc/hosts $HDMOUNTPT/etc/hosts cp /etc/fstab $HDMOUNTPT/etc/fstab cp /etc/resolv.conf $HDMOUNTPT/etc/resolv.conf cp /etc/modules $HDMOUNTPT/etc/modules cp /etc/network/interfaces $HDMOUNTPT/etc/network/interfaces # get reiserfs util if [ "$FS" == "reiserfs" ]; then chroot $HDMOUNTPT apt-get install reiserfsprogs fi # get pcmcia drivers, software if [ "$HASPCMCIA" == "yes" ]; then chroot $HDMOUNTPT apt-get install pcmcia-modules-$KVERSION fi # get X if [ "$WANTX" == "yes" ]; then chroot $HDMOUNTPT apt-get install xfree86-common xserver-xfree86 xserver-common xbase-clients xfonts-base aterm fi # I use Windowmaker, so chroot $HDMOUNTPT apt-get -y install wmaker # essential software chroot $HDMOUNTPT apt-get install -y mozilla-firefox xpdf emacs21 gsfonts gsfonts-x11 ssh zip unzip bzip2 # development software chroot $HDMOUNTPT apt-get install -y g++ make cvs gdb # more software chroot $HDMOUNTPT apt-get install -y gaim bittorrent xmms gxine gift libltdl3-dev # some tools chroot $HDMOUNTPT apt-get install -y hdparm dosfstools checkinstall patch deborphan debootstrap # do base config chroot $HDMOUNTPT /usr/sbin/base-config # delete move useless directory rmdir $HDMOUNTPT/media 2> /dev/null rmdir $HDMOUNTPT/srv 2> /dev/null rmdir $HDMOUNTPT/sys 2> /dev/null mv $HDMOUNTPT/cdrom $HDMOUNTPT/mnt 2> /dev/null mv $HDMOUNTPT/floppy $HDMOUNTPT/mnt 2> /dev/null # clean up to save space /bin/rm -rf $HDMOUNTPT/var/cache/apt/archives/*.deb 2> /dev/null /bin/rm -rf $HDMOUNTPT/tmp/* 2> /dev/null /bin/rm -rf $HDMOUNTPT/var/tmp/* 2> /dev/null chroot $HDMOUNTPT apt-get update chroot $HDMOUNTPT apt-get clean chroot $HDMOUNTPT apt-get autoclean # umount chroot $HDMOUNTPT umount /proc

Written by Terence Tong
Statistics:
Go back to Home