Table of Contents
Flash Card
Installation d'une Debian sur une carte flash.
Version humainement lisible: Flash Card Tret
Préparation de la carte
Réinitialiser la carte à zéro.
debian:/home/sbolay# dd if=/dev/zero of=/dev/sdb
dd: writing to `/dev/sdb': No space left on device 7813121+0 records in 7813120+0 records out 4000317440 bytes (4.0 GB) copied, 1873.47 s, 2.1 MB/s
Création des partitions
Une fois la carte entièrement réinitialisée, on crée la partition qui accueillera le système.
debian:/home/sbolay# fdisk /dev/sdb
Command (m for help): p Disk /dev/sdb: 4000 MB, 4000317440 bytes 124 heads, 62 sectors/track, 1016 cylinders Units = cylinders of 7688 * 512 = 3936256 bytes Disk identifier: 0xbf7f3f48 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1016, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1016, default 1016): Using default value 1016 Command (m for help): p Disk /dev/sdb: 4000 MB, 4000317440 bytes 124 heads, 62 sectors/track, 1016 cylinders Units = cylinders of 7688 * 512 = 3936256 bytes Disk identifier: 0xbf7f3f48
Device Boot Start End Blocks Id System /dev/sdb1 1 1016 3905473 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
Formatage de la partition
On crée la partition qui contiendra notre Debian.
debian:/home/sbolay# mkfs.ext3 -v /dev/sdb1
mke2fs 1.41.3 (12-Oct-2008) fs_types for mke2fs.conf resolution: 'ext3', 'default' Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 244320 inodes, 976368 blocks 48818 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1002438656 30 block groups 32768 blocks per group, 32768 fragments per group 8144 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 31 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
Installation de Debian
Installation de l'image
L'utilitaire 'debootstrap' va installer une image de Debian sur la carte.
debian:/mnt# mount /dev/sdb1 /mnt/cf/
debian:/mnt# debootstrap –arch i386 squeeze /mnt/cf/ http://ftp.ch.debian.org/debian
.... I: Configuring aptitude... I: Configuring tasksel-data... I: Configuring tasksel... I: Base system installed successfully.
Configuration de l'image
debian:/mnt# mount -t proc none /mnt/cf/proc
debian:/mnt# mount -t sysfs none /mnt/cf/sys
debian:/mnt# mount -o bind /proc /mnt/cf/proc
debian:/mnt# mount -o bind /dev /mnt/cf/dev
debian:/mnt# mount -o bind /sys /mnt/cf/sys
debian:/mnt# LANG=C chroot /mnt/cf/ /bin/bash
root@debian:/# mount devpts /dev/pts -t devpts
root@debian:/# UUID=$(dumpe2fs /dev/sdb1 | grep 'UUID' | cut -d':' -f2 | sed 's/ [ [:space:] ]/ /g')
dumpe2fs 1.41.12 (17-May-2010)
root@debian:/# echo $UUID
8c14d9c1-48cb-4ac1-b91d-780de47f8b8a
root@debian:/# sed -i “1s/$/\n proc \/proc proc nodev,noexec,nosuid 0 0/” /etc/fstab
root@debian:/# sed -i “1s/$/\n UUID=$UUID \/ ext3 defaults,noatime 0 1/” /etc/fstab
root@debian:/# dpkg-reconfigure tzdata
Current default time zone: 'Europe/Zurich' Local time is now: Fri Oct 14 17:16:25 CEST 2011. Universal Time is now: Fri Oct 14 15:16:25 UTC 2011.
root@debian:/# vi /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp
root@debian:/# cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM proc /proc proc defaults 0 0 UUID=8c14d9c1-48cb-4ac1-b91d-780de47f8b8a / ext3 defaults,noatime 0 1 #/dev/sda1 / ext3 defaults,noatime 0 1 tmpfs /tmp tmpfs defaults,noatime 0 0 tmpfs /var/tmp tmpfs defaults,noatime 0 0 tmpfs /var/run tmpfs defaults 0 0 tmpfs /var/log tmpfs defaults 0 0 tmpfs /var/lock tmpfs defaults 0 0
root@debian:/# vi /etc/hostname
NiX
root@debian:/# sed -i '1s/$/\ndeb http:\/\/security\.debian\.org\/ squeeze\/updates main/' /etc/apt/sources.list
root@debian:/# sed -i '1s/$/\ndeb-src http:\/\/security\.debian\.org\/ squeeze\/updates main/' /etc/apt/sources.list
root@debian:/# cat /etc/apt/sources.list
deb http://ftp.ch.debian.org/debian squeeze main deb-src http://security,debian.org/ squeeze/updates main deb http://security,debian.org/ squeeze/updates main
root@debian:/# aptitude update
root@debian:/# aptitude install locales
root@debian:/# dpkg-reconfigure locales
Generating locales (this might take a while)... fr_CH.ISO-8859-1... done Generation complete.
root@debian:/# aptitude install console-data
root@debian:/# aptitude install linux-image-486
root@debian:/# aptitude install grub
root@debian:/# vi /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` #GRUB_CMDLINE_LINUX_DEFAULT="quiet" GRUB_CMDLINE_LINUX_DEFAULT="verbose console=ttyS0,38400n8 reboot=bios" GRUB_SERIAL_COMMAND="serial --unit=0 --speed=38400" GRUB_CMDLINE_LINUX="" # Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console GRUB_TERMINAL=serial # The resolution used on graphical terminal # note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo' #GRUB_GFXMODE=640x480 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux #GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entries #GRUB_DISABLE_LINUX_RECOVERY="true" # Uncomment to get a beep at grub start #GRUB_INIT_TUNE="480 440 1"
debian:/mnt/cf/boot/grub# echo '(hd0) /dev/sdb' > /boot/grub/device.map
root@debian:/# grub-install /dev/sdb
Installation finished. No error reported.
root@debian:/# update-grub
Generating grub.cfg ... Found linux image: /boot/vmlinuz-2.6.32-5-486 Found initrd image: /boot/initrd.img-2.6.32-5-486 done
root@debian:/# sed -i 's/hd1/hd0/g' /boot/grub/grub.cfg
root@debian:/# vi /etc/inittab
#1:2345:respawn:/sbin/getty 38400 tty1 #2:23:respawn:/sbin/getty 38400 tty2 #3:23:respawn:/sbin/getty 38400 tty3 #4:23:respawn:/sbin/getty 38400 tty4 #5:23:respawn:/sbin/getty 38400 tty5 #6:23:respawn:/sbin/getty 38400 tty6 T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
root@debian:/# passwd root (nixpw)
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
root@debian:/# aptitude install rsyslog sudo
root@debian:/# tasksel install standard
root@debian:/# tasksel install ssh-server
root@debian:/# aptitude clean
root@debian:/# umount /dev/pts
root@debian:/# exit
exit
debian:/# umount /mnt/cf/proc/
debian:/# umount /mnt/cf/sys
debian:/# umount /mnt/cf/dev
debian:/# umount /mnt/cf
debian:/mnt# df -h
Filesystem Size Used Avail Use% Mounted on /dev/sdb1 3.7G 547M 3.0G 16% /mnt/cf
Si le système d'exploitation ne démarre pas, revérifier fichier /etc/fstab. la variable UUID doit est impérativement collé au '=' et à l'UUID du stockage.