SliTaz GNU/Linux official and community documentation wiki.
.png

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
en:handbook:chroot [2010/07/08 17:14]
127.0.0.1 external edit
en:handbook:chroot [2011/05/03 22:46]
domcox update
Line 1: Line 1:
-====== ​Chroot environment ​======+====== ​Environnement chrooté ​======
  
-This document ​describes the necessary steps to create a chrooted environment,​ in order to change the root of the system so that you can workThis makes it possible to compiletest and develop ​SliTaz ​without any risk to the host system you're working ​on. The host system can be SliTaz ​installed to a hard drive or any other GNU/​Linux ​system such as Debian, Fedora, PCLinuxOS ​and so onYou can also create a chrooted environment in LiveCD ​mode associated with USB mediaThe only prerequisite is to have a SliTaz ISO image available and a little timeNote that all commands are carried out as system administrator ​(root).+Ce document ​décrit les étapes à réaliser pour créer un environnement chrooté afin de changer la racine du système pour travaillerCela permet de compilertester et développer ​SliTaz ​sans risques pour le système hôte depuis lequel ​on travailleCe système hôte peut être SliTaz ​installée en dur ou tout autre système ​GNU/​Linux ​tel que Debian, Fedora, PCLinuxOS, etcOn peut aussi créer un environnement chrooté en mode LiveCD associé à un média ​USB. Les seuls prérequis sont d'​avoir une image ISO de SliTaz à disposition et un peu de tempsÀ noter que toutes les opérations sont réalisées en tant qu'​administrateur ​(//root//). 
  
-===== Prepare the environment ​=====+===== Préparer l'​environnement ​=====
  
-To beginwe must extract the contents of the ISO image into the directory that will serve as our chroot. ​The directory can be created any place you choose, we'll use a directory ​///​home/​slitaz/​chroot-env//​. ​To extract the contents of an ISO image, ​we must mount it in a loop directory and then copy the compressed root filesystem ​(rootfs.gz) ​into the chroot ​directoryAssuming the ISO is in the current directory:+Pour commenceril faut extraire le contenu de l'image ISO dans le répertoire qui va servir au chroot. ​Le répertoire de chroot peut se créer à l'endroit que l'on veut, nous utilisons un répertoire ​///​home/​slitaz/​chroot-env//​. ​Pour extraire le contenu d'​une ​image ISOil faut la monter en //loop// sur un répertoire,​ pour ensuite copier le système de fichiers racine compressé ​(//rootfs.gz//dans le répertoire de chroot. ​En supposant que l'ISO est dans le répertoire courant 
  
 <​code>​ <​code>​
  # mkdir /tmp/loop  # mkdir /tmp/loop
- # mount -o loop slitaz-cooking.iso /tmp/loop+ # mount -o loop slitaz-3.0.iso /tmp/loop
  # mkdir -p /​home/​slitaz/​chroot-env  # mkdir -p /​home/​slitaz/​chroot-env
  # cp /​tmp/​loop/​boot/​rootfs.gz \  # cp /​tmp/​loop/​boot/​rootfs.gz \
Line 16: Line 16:
 </​code>​ </​code>​
  
-Now we have copy of the compressed filesystemwe must extract and unpack it (this is a cpio archive compressed with either ​gzip or lzma). To complete this stagewe can remove the rootfs ​which is no longer required:+Maintenant qu'​on ​une copie du système de fichiers compresséil faut le décompresser et le dés-archiver ​(c'est une archive //cpio// compressée avec lzma ou gzip). ​Pour finir cette étape de préparation et continueron peut retirer le //rootfs// qui n'est plus utilisé 
  
 <​code>​ <​code>​
Line 24: Line 24:
 </​code>​ </​code>​
  
-If the unpacking of the rootfs ​compressed with lzma fails; you can use the following method:+Si le dés-archivage du rootfs ​compressé avec LZMA échoue en utilisant la première méthode vous pouvez utiliser
  
 <​code>​ <​code>​
Line 31: Line 31:
 </​code>​ </​code>​
  
-===== Using the environment ​===== +===== Utiliser l'​environnement ​=====
- +
-To begin using the chrooted environment,​ you just need to mount some virtual filesystems and use the chroot command. To simplify things, we can write a small script automating the process. Example using the chroot directory ///​home/​slitaz/​chroot-env//​ and creating a script chroot_in_env.sh in ///​home/​slitaz//​. On any systems other than SliTaz you can uncomment the lines about ///dev// and ///tmp// - Note to save typing you can copy and paste:+
  
 +Pour utiliser l'​environnement chrooté, il suffit de monter quelques systèmes de fichier virtuels et d'​utiliser la commande //chroot//. Pour se simplifier la vie on peut rapidement créer un petit script automatisant le chroot. Exemple en utilisant le répertoire de chroot ///​home/​slitaz/​chroot-env//​ et en créant un script nommé //​chroot_in_env.sh//​ dans ///​home/​slitaz//​. À noter que le contenu du script n'a pas besoin d'​être tapé mais simplement copié/​coller dans le terminal et que sur un autre système que SliTaz vous pouvez dé-commenter les lignes montant/​démontant ///dev// et ///​tmp//​ : ​
 <​code>​ # cat > /​home/​slitaz/​chroot_in_env.sh << "​EOF" ​ <​code>​ # cat > /​home/​slitaz/​chroot_in_env.sh << "​EOF" ​
  
Line 69: Line 68:
 </​code>​ </​code>​
  
-To finish and test the environmentyou just make the script ​executable and run:+Pour finir et tester l'​environnementil suffit de rendre le script ​exécutable et le lancer 
  
 <​code>​ <​code>​
Line 76: Line 75:
 </​code>​ </​code>​
  
-=== To activate the network ​===+=== Activer le réseau ​===
  
-In order to have the network up to download and install some development packagesjust start the DHCP client ​on the correct ​interface. Example using eth1:+Pour avoir le réseau afin de téléchargernaviguer en mode texte et installer des paquets de développement,​ il suffit de lancer le client ​DHCP sur la bonne interface, exemple avec //eth1// 
  
  <​code>​ # udhcpc -i eth1 </​code>​  <​code>​ # udhcpc -i eth1 </​code>​
  
-=== Installing packages ​===+=== Installer des paquets ​===
  
-If the network is functionaljust reload the list of packages and use tazpkg get-install ​to install themIf a connection is not possible, ​you can download the packages from another systemcopy them to the chrooted environment and install them with the tazpkg install ​commandTo install the basic compilation tools:+Si le réseau est fonctionnelil suffit de recharger la liste des paquets et utiliser //tazpkg get-install// pour installer de nouveaux paquetsSi la connexion n'est pas possible, ​on peut télécharger les paquets du miroir depuis un autre systèmeles copier dans l'​environnement chrooté et les installer via la commande //tazpkg install//Pour installer la base des outils de compilation 
  
  <​code>​ # tazpkg recharge  <​code>​ # tazpkg recharge
  # tazpkg get-install slitaz-toolchain </​code>​  # tazpkg get-install slitaz-toolchain </​code>​
  
-Once the environment is configuredyou can compile ​applications ​from source to create packagestest scripts, etcThe Cookbook should help you out here:+Une fois l'​environnement configuréon peut compiler des applications ​depuis les sources pour en créer des paquetstester des scripts ​et autreLe chapitre [[en:handbook:​development|développement]] du Handbook et le [[fr:​cookbook:​start|Cookbook] devraient aider à aller plus loin. 
  
-=== Exit the environment ​===+=== Sortir de l'​environnement ​===
  
-To exit the chrooted environmentjust type exit, the //​chroot_in_env.sh// ​script will then end by unmounting the virtual filesystems from the Linux Kernel:+Pour sortir de l'​environnement chrooté il suffit de taper //exit//le script ​//​chroot_in_env.sh// ​va finir son rôle en démontant le systèmes de fichiers virtuels propre au noyau Linux 
  
 <​code>​ <​code>​
Line 99: Line 98:
  #  #
 </​code>​ </​code>​
- 
 
en/handbook/chroot.txt · Last modified: 2011/05/03 22:47 by domcox