usb_device=/dev/sdb
apt_mirror=http://ftp.debian.org/debian/
sudo apt-get update
sudo apt-get install debootstrap coreutils util-linux e2fsprogs
df -h
sudo umount "${usb_device}1"
sudo fdisk "${usb_device}"
- o create a new empty DOS partition table
- p print the partition table
- n add a new partition
- use all defaults
- a toggle a bootable flag
- use partition 1
- w write table to disk and exit
# for non usb i'd use ext4
sudo mkfs.ext4 "${usb_device}1"
# for usb i'd use ext2
sudo mkfs.ext2 "${usb_device}1"
mkdir $HOME/tmp/usbstick -p
sudo mount "${usb_device}1" $HOME/tmp/usbstick
sudo debootstrap --arch amd64 stretch $HOME/tmp/usbstick "${apt_mirror}"
sudo debootstrap --arch amd64 wheezy $HOME/tmp/usbstick "${apt_mirror}"
sudo debootstrap --arch amd64 jessie $HOME/tmp/usbstick "${apt_mirror}"
sudo mount -t proc none $HOME/tmp/usbstick/proc
sudo mount --bind /sys $HOME/tmp/usbstick/sys
sudo mount --bind /dev $HOME/tmp/usbstick/dev
sudo cp /etc/resolv.conf $HOME/tmp/usbstick/etc/resolv.conf
sudo chroot $HOME/tmp/usbstick/
# my sources.list
deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
# wheezy-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
apt-get update
apt-get install locales sudo vim ntp openssh-client openssh-server tmux
add the following to /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
add the following to /etc/hosts
127.0.1.1 your_hostname
# setup timezone
dpkg-reconfigure tzdata
# i choose en_US.UTF-8
dpkg-reconfigure locales
make sure ntp is rocking
ntpq -p
date -R
# and if necessary..
dpkg-reconfigure ntp
adduser grumpy
adduser grumpy sudo
# or if no adduser
usermod -G sudo -a grumpy
aptitude install grub-pc linux-base linux-image-amd64
# when the "Configuring grub-pc" menu pops up I selected "/dev/sdb"
blkid "${usb_device}1" -o export | head -n 1 > /etc/fstab
then edit /etc/fstab
to look something like this:
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=5763e67c-53f4-448c-8376-d371c24f4057 / ext4 errors=remount-ro 0 1
exit
sudo umount $HOME/tmp/usbstick/sys
sudo umount $HOME/tmp/usbstick/dev
sudo umount $HOME/tmp/usbstick/proc
sudo umount $HOME/tmp/usbstick/
a good deal of my steps were gleaned from reading this