obtenir un serveur de déployement pour le boot PXE.
Pour se faire, nous utiliserons les paquets DRBL/TFTP/DHCP sur DEBIAN.
Le but est de pouvoir installer différentes distributions Linux par le réseau,
ainsi que de charger des live CD d'utilitaires en RAM.
aptitude install tftpd-hpa
vi /etc/default/tftpd-hpa
J'affecte le Directory sur la partition /data que je prévu à cet effet (10Go en LVM)
#Defaults for tftpd-hpa RUN_DAEMON="yes" OPTIONS="-l -s /data/tftpboot/nbi_img"
/etc/init.d/tftpd-hpa start Starting HPA's tftpd: in.tftpd.
nano /etc/apt/sources.list
Ajouter l'URL du dépôt du projet DRBL
add : deb http://free.nchc.org.tw/drbl-core drbl stable
wget http://drbl.nchc.org.tw/GPG-KEY-DRBL
apt-key add GPG-KEY-DRBL
apt-get update
apt-get install drbl
/opt/drbl/sbin/drblsrv -i
Champs par défauts.
Installation automatiques des paquets requis (dhcp3, …)
Patienter quelques minutes.
Le CD Live bootable en PXE permettera de créer à partir des postes clients une image de leur disques/partitions sur le serveur CloneZilla, qui ensuite sera déployée en multicast sur les postes clones ou de restaurer une image spécifique sur le poste.
cd /data/tftpboot/nbi_img wget http://mesh.dl.sourceforge.net/project/clonezilla/clonezilla_live_stable/1.2.8-23/clonezilla-live-1.2.8-23-i686.zip unzip -j clonezilla-live-1.2.8-23-i686.zip
> replace vesamenu.c32? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
LA MACHINE SERVEUR DOIT AVOIR 2 CARTES RESEAUX, UNE VERS LE WAN ET L'AUTRES VERS LE RESEAUX LOCAL SANS QUOI LE SCRIPT S'ARRETERA.SOUS VMWARE, IL EST POSSIBLE DE créer UNE CARTE RESEAUX VIRTUELLE.
Pour la configuration de DRBL, on va utiliser le script de configuration interactif drblpush.
Voici les différents choix que nous avons effectués pour répondre aux questions de ce script de configuration. Il suffit donc d'exécuter la commande /opt/drbl/sbin/drblpush -i et de répondre aux différentes questions qui nous sont posées.
Hint! When a yes/no option is available, the default value is uppercase, Ex. (y/N), the default is "N", when you press "Enter", it will use "N". If you are not sure which one to choose, you can just press "Enter" key. ****************************************************** Searching the installed packages for DRBL server...This might take several minutes... Finished searching the installed packages for DRBL server. ****************************************************** ------------------------------------------------------ The interactive mode let you supply the information of your DRBL environment.
(ici: mondomaine.example.com). A remplacer par votre domaine DNS
------------------------------------------------------ Please enter DNS domain (such as drbl.sf.net): [drbl.sf.net] mondomaine.example.com Set DOMAIN as mondomaine.example.com ------------------------------------------------------
Acceptez cette option (longue à télécharger), pour obtenir les kernels et initrd appropriés et fourni par le projet DRBL.
Comme seul le mode Clonezilla de notre serveur DRBL nous intéresse, peut importe la valeur que l'on indique ici:
------------------------------------------------------ Please enter NIS/YP domain name: [penguinzilla] penguizilla Set DOMAIN as penguizilla ------------------------------------------------------
------------------------------------------------------ Please enter the client hostname prefix: This prefix is used to automatically create hostname for clients. If you want to overwrite some or all automatically created hostnames, press Ctrl-C to quit this program now, edit /opt/drbl/conf/client-ip-hostname, then run this program again. [localhost] clone Set the client hostname prefix as clone ------------------------------------------------------
------------------------------------------------------ Found private IP "192.168.254.10" in eth0 on your system! Found private IP "192.168.8.254 in eth1 on your system! Configured ethernet card(s) found in your system: eth0 eth1 ------------------------------------------------------ The public IP address of this server is NOT found. Which ethernet port in this server is for public Internet accsess, not for DRBL connection ? Available ethernet ports in this server: eth0 (192.168.254.10), eth0:1 (192.168.8.254), [eth0] eth0 The ethernet port you choose for the WAN connection: eth0 The ethernet port(s) for DRBL environment: eth1 ****************************************************** Press Enter to continue... ******************************************************
Now we can collect the MAC address of clients! If you want to let the DHCP service in DRBL server offer same IP address to client every time when client boot, and you never did this procedure, you should do it now! If you already have those MAC addresses of clients, you can put them into different group files (These files number is the same number of networks cards for DRBL service). In this case, you can skip this step. This step helps you to record the MAC addresses of clients, then divide them into different groups. It will save your time and reduce the typos. The MAC addresses will be recorded turn by turn according to the boot of clients, and they will be put into different files according to the network card in server, file name will be like macadr-eth1.txt, macadr-eth2.txt... You can find them in directory /etc/drbl. Please boot the clients by order, make sure they boot from etherboot or PXE! Do you want to collect them ? [y/N] N ****************************************************** OK! Let's continue...
Do you want to let the DHCP service in DRBL server offer same IP address to the client every time when client boots (If you want this function, you have to collectthe MAC addresses of clients, and save them in file(s) (as in the previous procedure)). This is for the clients connected to DRBL server's ethernet network interface eth0 ? [y/N] N ****************************************************** OK! Let's continue, we will set the IP address of clients by "first boot gets IP first" instead of fixed one! ****************************************************** What is the initial number do you want to use in the last set of digits in the IP (i.e. the initial value of d in the IP address a.b.c.d) for DRBL clients connected to this ethernet port eth1. [1] 1 ****************************************************** How many DRBL clients (PC for students) connected to DRBL server's ethernet network interface eth0 ? Please enter the number: [12] 4 ****************************************************** The final number in the last set of digits in the clients' IP is "4. We will set the IP address for the clients connected to DRBL server's ethernet network interface eth0 as: 192.168.8.1 – 192.168.8.4 Accept ? [Y/n] Y ****************************************************** OK! Let's continue... ******************************************************
The Layout for your DRBL environment:
******************************************************
NIC NIC IP Clients
+-----------------------------+
| DRBL SERVER |
| |
| +-- [eth0] 192.168.254.10 +- to WAN
| |
| +-- [eth1] 192.168.8.254 +- to clients group 1 [ 4 clients, their IP
| | from 192.168.8.1 – 192.168.8.4 ]
+-----------------------------+
******************************************************
Total clients: 4
******************************************************
Press Enter to continue...
******************************************************
In the system, there are 3 modes for diskless linux services: [0] Full DRBL mode, every client has its own NFS based /etc and /var. [1] DRBL SSI (Single system image) mode, every client uses tmpfs based /etc and /var. In this mode, the loading and necessary disk space of server will be lighter. NOTE! (a) The client machine memory is recommended at least 256 MB. (b) The setting and config files of client will not be saved to the DRBL server! They are just used once and will vanish after the machine shutdowns! Besides, if you modify any file in the template client (located in /tftpboot/nodes), you have to run /opt/drbl/sbin/gen_ssi_files to create the template tarball in /tftpboot/node_root/drbl_ssi/. (c) If you want to provide some file to overwrite the setting in the template tarball when client boots, check /tftpboot/node_root/drbl_ssi/clients/00_README for more details. [2] I do NOT want to provide diskless Linux service to client. Which mode do you prefer ? [0] 2 No diskless Linux for client is the system. ******************************************************
In the system, there are 3 modes available for clonezilla: [0] Full Clonezilla mode, every client has its own NFS based /etc and /var. [1] Clonezilla box mode, every client uses tmpfs based /etc and /var. In this mode, the loading and necessary disk space of server will be lighter than that in Full Clonezilla mode. Note! In Clonezilla box mode, the setting and config files of client will not be saved to the DRBL server! They just use once and will vanish after the machine shutdowns! [2] I do NOT want clonezilla. Which mode do you prefer ? [0] 1 Clonezilla box mode is set, an elegant mode for clonezilla is on the way!
When using clonezilla, which directory in this server you want to store the saved image (Please use absolute path, and do NOT assign it under /mnt/, /media/ or /tmp/) ? [/home/partimag] /data/partimag Directory for clonezilla saved images: /data/partimag ****************************************************** The clients will use text mode when they boot. ****************************************************** OK! Let's continue...
Do you want to set the pxelinux password for clients so that when client boots, a password must be entered to startup (For better security) [y/N] n
------------------------------------------------------ Do you want to use graphic background for PXE menu when client boots ? Note! If you use graphical PXELinux menu, however client fails to boot, you can switch to text mode by running "/opt/drbl/sbin/switch-pxe-bg-mode -m text". [y/N] N Use text PXE Linux menu for client. OK! Let's continue... ------------------------------------------------------
Do you want to let DRBL server as a NAT server ? If not, your DRBL client will NOT be able to access Internat. [Y/n] n This DRBL server does NOT provide NAT service, so your DRBL client will NOT be able to access Internet.
****************************************************** Checking server kernel config "/boot/config-2.6.22.12-desktop-1mdv..." The running kernel in the server supports NFS over TCP! Note! If you change the running kernel in the server, and not sure whether the kernel supports NFS over udp or tcp, you'd better to re-run "drblpush -i" again to avoid the client boots in failure! Press Enter to continue... ------------------------------------------------------ Searching installed Etherboot files for dhcpd.conf... done! ****************************************************** The calculated NETWORK for eth0 is 192.168.8.0. ****************************************************** ****************************************************** We are now ready to deploy the files to system! Do you want to continue ? Warning! If you go on, your firewall rules will be overwritten during the setup! The original rules will be backuped as iptables.drblsave in system config directory (/etc/sysconfig or /etc/default). ^[[0m[Y/n] Y ****************************************************** OK! Let's do it! ------------------------------------------------------ (...)
La configuration du serveur est maintenant terminée, ne reste plus qu'à créer les images et à les déployer sur les différents postes.
La configuration globale du menu de boot PXE s'effectue dans le fichier suivant:
cd /data/tftpboot/nbi_img/ vi pxelinux.cfg/default
Il permet à tous les postes disposant d'un boot pxe d'acceder à différentes options de démarrage.
# Default boot option to use
UI vesamenu.c32
# Prompt user for selection
PROMPT 0
TIMEOUT 500
NOESCAPE 0
KBDMAP fr.kbd
#MENU BACKGROUND syslinux_splash.jpg
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU TIMEOUTROW 20
MENU HELPMSGROW 22
MENU HELPMSGENDROW 29
MENU TITLE Faites votre choix :
MENU PASSPROMPT Saisissez le mot de passe ADMIN:
MENU MASTER PASSWD $4$GKt0gX8x$gnTZAZgNIdJBXpY3j/LZN1lFYjc$
Pour protéger l'accès, on utilise MENU MASTER PASSWD pour protéger le mode édition des entrées et MENU PASSWD pour lancer une entrée du menu.
aptitude install libdigest-sha1-perl sha1pass votrePassword
wget http://guim.info/dokuwiki/_media/debian/fr.kbd
/data/tftpboot/nbi_img/pxelinux.cfg/default
label Clonezilla
MENU PASSWD $4$GKt0gX8x$gnTZAZgNIdJBXpY3j/LZN1lFYjc$
MENU LABEL - CLONEZILLA (Live CD)
kernel vmlinuz-clonezilla
append initrd=initrd-clonezilla.img boot=live union=aufs noswap noprompt vga=788 fetch=tftp://$IP/clonezilla/filesystem.squashfs
TEXT HELP
Lancer le live CD CLONEZILLA (Version 4.03)
ENDTEXT
wget http://sourceforge.net/projects/gparted/files/gparte d-live-stable/0.8.0-5/gparted-live-0.8.0-5.zip
unzip gparted-live-0.8.0-5.zip cp ./live/initrd.img /data/tftpboot/nbi_img/initrd-gparted.img cp ./live/vmlinuz /data/tftpboot/nbi_img/vmlinuz-gparted mkdir /data/tftpboot/nbi_img/gparted cp ./live/filesystem.squashfs /data/tftpboot/nbi_img/gparted/filesystem.squashfs
vi /data/tftpboot/nbi_img/pxelinux.cfg/default
label GParted
MENU PASSWD $4$GKt0gX8x$gnTZAZgNIdJBXpY3j/LZN1lFYjc$
MENU LABEL - GPARTED (Live CD)
kernel vmlinuz-gparted
append initrd=initrd-gparted.img boot=live config union=aufs noswap noprompt vga=788 fetch=tftp://$IP/gparted/filesystem.squashfs
TEXT HELP
Lancer le live CD GPARTED (Version 0.8.0-5)
ENDTEXT
wget http://www.memtest.org/download/4.20/memtest86+-4.20.zip unzip memtest86+-4.20.zip cp memtest.bin /data/tftpboot/nbi_img/memtest86+4.20 chmod 755 /data/tftpboot/nbi_img/memtest86+4.20
vi /data/tftpboot/nbi_img/pxelinux.cfg/default
label Memtest86+
MENU PASSWD $4$GKt0gX8x$gnTZAZgNIdJBXpY3j/LZN1lFYjc$
MENU LABEL - MEMTEST86+ (Test)
kernel memtest86+4.20
TEXT HELP
Lancer MEMTEST+86 (version 4.20)
ENDTEXT
wget http://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/2.1.0/systemrescuecd-x86-2.1.0.iso
mount -o loop systemrescuecd-x86-2.1.0.iso /mnt cd /mnt mkdir /data/tftpboot/rescuecd cp ./isolinux/rescuecd /data/tftpboot/nbi_img/kernel-rescuecd cp ./isolinux/initram.igz /data/tftpboot/nbi_img/rescuecd-initram.igz
mkdir /var/www/rescuecd/ cp ./isolinux/sysrcd.dat /var/www/rescuecd/ cp ./isolinux/sysrcd.md5 /var/www/rescuecd/
vi /data/tftpboot/nbi_img/pxelinux.cfg/default
label System Rescue CD
MENU PASSWD $4$GKt0gX8x$gnTZAZgNIdJBXpY3j/LZN1lFYjc$
MENU LABEL - RESCUE CD 2.0.1 (Live CD)
kernel kernel-rescuecd
append initrd=rescuecd-initram.igz setkmap=fr dodhcp idocache boot=live ramdisk_size=500000 vga=791 netboot=http://$IP/rescuecd/sysrcd.dat
TEXT HELP
Lancer le live CD System RescueCD (Version 2.0.1)
ENDTEXT
wget http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-4.03.tar.gz tar xvzf syslinux-4.03.tar.gz cd syslinux-4.03 cp ./modules/poweroff.com /data/tftpboot/nbi_img/ cp ./com32/modules/reboot.c32 /data/tftpboot/nbi_img/
vi /data/tftpboot/nbi_img/pxelinux.cfg/default
label Reboot
MENU LABEL - Reboot
COM32 reboot.c32
TEXT HELP
Rebooter le host...
ENDTEXT
label Shutdown
MENU LABEL - Shutdown
COMBOOT poweroff.com
TEXT HELP
Eteindre le host...
ENDTEXT
Voici à quoi ça ressemble de mon côté :