====== Installation d'une Debian dans un chroot ====== ===== cdebootstrap ===== Le but est de créer une image du système dans un répertoire puis de le transférer sur le nas. La commande ''cdebootstrap'' prend comme arguments : * -a architecture * distribution à installer * répertoire de travail * miroir à utiliser sudo cdebootstrap -aarm lenny debian_chroot/ ftp://ftp.proxad.net/mirrors/ftp.debian.org/ La commande se termine par une erreur : E: Execution failed: Exec format error E: Internal error: install C'est normal, on est sur un processeur d'une architecture différente. Ensuite on transfert le contenu vers le nas : sudo tar cvzf debian_lenny.tar.gz debian_chroot cp debian_lenny.tar.gz $PATH_TO_NAS ===== Installation sur le NAS ===== Ensuite on se connecte sur le nas pour effectuer la fin de l'installation. On décompresse l'archive : mv debian_lenny.tar.gz /mnt/md1 cd /mnt/md1 tar xzf debian_lenny.tar.gz Il faut installer sur le nas les ''coreutils'' disponible sur http://en.nas-4220.org/index.php/Tools. Ils fournissent la commande chroot. Ensuite on ''chroot'' : /mnt/md1/public/coreutils/chroot /mnt/md1/debian_chroot /bin/bash mount proc /proc -t proc Il faut forcer l'installation des paquets : cd /var/cache/bootstrap dpkg --force-all -i libc6*deb dpkg --force-all -i dpkg*deb dpkg -iGREB . Il faut monter ''/proc'' sinon ''dpkg'' n'arrive pas à effacer certains fichiers. La dernière commande est à répéter autant de fois qu'il faut pour supprimer toutes les erreurs. Il est possible qu'il faille effacer le répertoire ''/var/mail''. ===== Configuration ===== Ajouter un fichier ''/etc/resolv.conf'' : nameserver 212.27.40.241 nameserver 212.27.40.240 nameserver 212.30.96.108 Ajouter un fichier ''/etc/hosts'' : 127.0.0.1 localhost.localdomain localhost # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts Éditer le fichier ''/etc/apt/sources.list'' : deb ftp://ftp.proxad.net/mirrors/ftp.debian.org/ lenny main contrib non-free deb http://security.eu.debian.org/ lenny/updates main Mise à jour : update-alternatives --config editor aptitude update aptitude safe-upgrade Création de ''devices'' : aptitude install makedev /sbin/MAKEDEV Ajout de logiciels utiles : aptitude install less ssh nfs-kernel-server sudo ntp rsync locales maradns ===== Création des homes ===== En dehors du ''chroot'' mkdir /mnt/md1/home mount -o bind /mnt/md1/home /mnt/md1/debian_chroot/home ===== Démarrer le chroot ===== Création du répertoire contenant le script qui exécutera le ''chroot'' : /mnt/md1/public/applications/debian_chroot chmod 777 /mnt/md1/public/applications/debian_chroot touch /mnt/md1/public/applications/debian_chroot/init chmod 777 /mnt/md1/public/applications/debian_chroot/init touch /mnt/md1/public/applications/debian_chroot/rc.local chmod 777 /mnt/md1/public/applications/debian_chroot/rc.local Script ''init'' : #!/bin/sh HD_MNT_POINT=$(cat /usr/sausalito/codb/objects/1/Disk.rootdir 2> /dev/null) CWD=$HD_MNT_POINT/public/applications/debian_chroot cp $CWD/rc.conf /etc/ cp $CWD/rc.local /etc/ chmod 777 /etc/rc.local Script ''rc.local'' : #!/bin/sh killall -9 inetd killall -9 crond killall -9 upnpdevice killall -9 linkChg mount -o bind /mnt/md1/home /mnt/md1/debian_chroot/home mount -o bind /dev /mnt/md1/debian_chroot/dev /mnt/md1/public/coreutils/chroot /mnt/md1/debian_chroot /chroot.init Le script ''chroot.init'' : #!/bin/sh mount proc /proc -t proc mount sys /sys -t sysfs /etc/init.d/portmap start /etc/init.d/sudo start /etc/init.d/rsyslog start /etc/init.d/ssh start /etc/init.d/nfs-common start /etc/init.d/nfs-kernel-server start /etc/init.d/samba start /etc/init.d/ntp start /etc/init.d/maradns start