×

Creer un serveur pxe sous debian (en cours)

Creer un serveur pxe sous debian (en cours)

Attention ce tutorial n est pas encore finalisé il est avant tout en ligne pour permettre une relecture et un débogage des points signaler par *

Un serveur PXE est très utile lorsque l on possède un parc d’ordinateur. Il permet grâce à une fonction disponible sur les cartes mères de pouvoir démarrer depuis le réseau et d’ainsi lancer une iso d un utilitaire de diagnostique, un anti-virus ou de faire une réinstallation.

On peut ainsi régler facilement des problèmes surtout si l ordinateur à son lecteur de cd-rom qui ne marche plus et qu’il est impossible de charger un cd-rom au démarrage. Seul inconvénient, la lenteur d un tel procédé puisque tout passe par le réseau et suivant la configuration du pxe des fichiers sont télécharger sur internet.

Autre avantage, on n a plus besoin d’une pochette de cd-rom avec l ensemble des cds qui peuvent se rayer avec le temps.

Néanmoins ce système présente un inconvénient. Sa lenteur. En effet la plupart du temps les pxe sont configurés pour aller chercher sur le net les images des cd d installation. On perd donc beaucoup de temps avec le téléchargement et la connexion a internet devient obligatoire.

Nous allons essayé donc de monter un serveur Pxe ultra complet et utilisable même dans un réseau professionnel.

Les objectifs sont :

  • Booter sur le protocole réseau pxe
  • Avoir le choix entre une installation via iso ou netboot
  • Possibilité de booter sur une iso windows
  • Avoir à disposition des outils de dépannage
  • Créez un espace de stockage accessible pour sauver les données d un poste

I) Booter sur le protocole pxe

Installation sous debian *

le serveur pour le moment ne donne pas une seconde adresse ip lors des installations debians et unattend sinon tout le reste marche

Installation du serveur dhcp

apt-get install dhcp3-server

Il faut ensuite indiquer a notre serveur dhcp quel va être l interface a écouter

vim /etc/default/dhcp3-server

Pour mon cas c est l interface eth0 donc on met

INTERFACES="eth0"

Puis on configure le serveur dhcp pour l obtenir les adresses ip.

Par définition ma machine sous debian est en ip 192.168.1.254
Ma passerelle internet est en 192.168.1.1

voici donc ma configuration du fichier /etc/dhcp3/dhcpd.conf

authoritative;
ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.210 192.168.1.220;
option domain-name-servers 192.168.1.245;
option domain-name "admin-systeme.com";
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.1;
default-lease-time 43200;
max-lease-time 86400;

server-name "PXE";
next-server 192.168.1.245;
filename "/tftpboot/pxe/pxelinux.0";
}

on relance le serveur dhcp

/etc/init.d/dhcp3-server restart

Installation du serveur tftp

apt-get install atfpd
mkdir /tftpboot
chmod 777 /tftpboot -R

On modifie le fichier /etc/default/atftpd pour mettre

USE_INETD=false
OPTIONS="--daemon --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 /tftpboot"

Puis modifier le fichier /etc/inetd.conf et commenter la ligne du tftp avec le #

On lance le serveur tftp

/etc/init.d/atfpd start

Installation du serveur PXE

apt-get install pxe syslinux

On edite le fichier /etc/pxe.conf et on va lui mettre en debut de fichier

# which interface to use
interface=eth0
default_address=192.168.1.245

et en fin de fichier

# tftpd base dir
tftpdbase=/tftpboot

Installation d un serveur apache

On installe un serveur apache pour faciliter le téléchargement des gros fichiers sur la machine pxe. En effet apache utilisera un protocole TCP alors que si nous étions passer par TFTP nous aurions été en UDP.

apt-get install apache2

On configure maintenant un lien symbolique de /tftpboot/pxe/ vers /var/www

ln -s /tftpboot/pxe /var/www

Installation d un serveur NFS

Un serveur nfs est un serveur qui va partager des données via le réseau. On le trouve principalement dans les systeme unix. On en aura besoin pour certain type d installation.

apt-get install nfs-kernel-server

On autorise notre réseau à utiliser le serveur NFS en ajoutant au fichier /etc/hosts.allow

mountd: 192.168.1.

les droits d accès au repertoire sont dans le fichier etc/exports :

/tftpboot/pxe/    192.168.1.0/24(ro,async,no_root_squash,no_subtree_check)

Installation d un serveur Samba

apt-get install samba

puis

 mkdir -p /tftpboot/pxe/images

Ca sera le répertoire pour nos images de sauvegarde des pc clients
Editez le fichier /etc/samba/smb.conf
Afin de bypasser l’authentification dé-commentez la ligne

# security = user

et modifiez la pour arriver à cela :

security = share

En fin de fichier rajoutez

[TFTPBOOT]
        path = /tftpboot
        guest ok = yes
        browsable = yes
        writeable = no

[IMAGES]
        path = /tftpboot/pxe/images
        guest ok = yes
        browsable = yes
        writeable = yes
[ISO]
        path = /tftpboot/pxe/microsoft
        guest ok = yes
        browsable = yes
        writeable = yes

II) Installation de systèmes d exploitation en téléchargeant par internet.

Configuration et mise en place des images ubuntu et debian.

Il est temps maintenant que le système est en place que nous commencions à préparer les différentes images de distributions que nous désirons rendre accessible via le pxe ainsi que des outils de diagnostiques.

Tout d abord voyons la meilleur façons de ranger vos dossiers

/tftpboot/pxe/
/tftpboot/pxe/boot-screens/
/tftpboot/pxe/pxelinux.cfg/
/tftpboot/pxe/debian/lenny/i386/
/tftpboot/pxe/debian/lenny/amd64/
/tftpboot/pxe/debian/lenny/livecd/
/tftpboot/pxe/ubuntu/maverick/i386/
/tftpboot/pxe/ubuntu/maverick/amd64/
/tftpboot/pxe/ubuntu/maverick/livecd/
/tftpboot/pxe/fedora/14/i386/
/tftpboot/pxe/fedora/14/x86_64/
/tftpboot/pxe/fedora/14/livecd/
/tftpboot/pxe/centos/5/i386/
/tftpboot/pxe/centos/5/x86_64/
/tftpboot/pxe/centos/5/livecd/
/tftpboot/pxe/microsoft/
/tftpboot/pxe/outils/ultimatebootcd/cdrom/
/tftpboot/pxe/outils/sysresccd/cdrom/
/tftpboot/pxe/outils/clonezilla/cdrom/
/tftpboot/pxe/outils/kaspersky/cdrom/
/tftpboot/pxe/outils/bitdefender/cdrom/
/tftpboot/pxe/dos/

Voila donc une infrastructure plutôt complète. Nous aurons donc les grandes distributions linux mais aussi microsoft. Rien ne vous empêche de rajouter mac si vous le voulez.

Créons maintenant ces répertoires

cd /;mkdir -p {tftpboot/pxe/microsoft,tftpboot/pxe/centos/5/x86_64,tftpboot/pxe/centos/5/i386,tftpboot/pxe/fedora/14/x86_64,tftpboot/pxe/fedora/14/i386,tftpboot/pxe/ubuntu/maverick/amd64,tftpboot/pxe/ubuntu/maverick/i386,tftpboot/pxe/debian/lenny/amd64,tftpboot/pxe/debian/lenny/i386,tftpboot/pxe/pxelinux.cfg,tftpboot/pxe/boot-screens,/tftpboot/pxe/outils/sysresccd/cdrom,/tftpboot/pxe/centos/5/livecd,/tftpboot/pxe/fedora/14/livecd,/tftpboot/pxe/ubuntu/maverick/livecd,/tftpboot/pxe/debian/lenny/livecd,/tftpboot/pxe/outils/clonezilla/cdrom,/tftpboot/pxe/outils/kaspersky/cdrom,/tftpboot/pxe/outils/bitdefender/cdrom,/tftpboot/pxe/dos}

Ps : si vous rencontrez un message d erreur du style :
mkdir: ne peut créer le répertoire `tftpboot/pxe/outils’: Permission non accordée
c’est que vous n êtes pas connecté en root.

On télécharge les images netboot de debian et ubuntu pour commencer dans le repertoire /tmp

wget http://ftp.fr.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/netboot.tar.gz -O /tmp/netboot_debian_lenny_i386.tar.gz
wget http://ftp.fr.debian.org/debian/dists/lenny/main/installer-amd64/current/images/netboot/netboot.tar.gz -O /tmp/netboot_debian_lenny_amd64.tar.gz
wget http://fr.archive.ubuntu.com/ubuntu/dists/maverick/main/installer-i386/current/images/netboot/netboot.tar.gz -O /tmp/netboot_ubuntu_maverick_i386.tar.gz
wget http://fr.archive.ubuntu.com/ubuntu/dists/maverick/main/installer-amd64/current/images/netboot/netboot.tar.gz -O /tmp/netboot_ubuntu_maverick_adm64.tar.gz

On créé des dossiers de décompression et on y décompresse nos données.

cd /tmp;
mkdir debian_lenny_i386; tar xvfz netboot_debian_lenny_i386.tar.gz -C debian_lenny_i386
mkdir debian_lenny_amd64; tar xvfz netboot_debian_lenny_amd64.tar.gz -C debian_lenny_amd64
mkdir ubuntu_maverick_i386; tar xvfz netboot_ubuntu_maverick_i386.tar.gz -C ubuntu_maverick_i386
mkdir ubuntu_maverick_amd64; tar xvfz netboot_ubuntu_maverick_adm64.tar.gz -C ubuntu_maverick_amd64

En premier lieu nous avons besoin des fichiers pour le démarrage du pxe.
Nous allons donc nous servir dans la version debian lenny i386 et les copier dans les répertoires adéquates

cp /tmp/debian_lenny_i386/debian-installer/i386/pxelinux.0 /tftpboot/pxe
cp /tmp/debian_lenny_i386/debian-installer/i386/boot-screens/splash.png /tftpboot/pxe/boot-screens/
cp /tmp/debian_lenny_i386/debian-installer/i386/boot-screens/vesamenu.c32 /tftpboot/pxe/boot-screens/

Nous allons maintenant copier les fichiers nécessaires au démarrage d une installation debian ou ubuntu et les placer dans les repertoires respectifs

cp /tmp/debian_lenny_i386/debian-installer/i386/initrd.gz /tftpboot/pxe/debian/lenny/i386/
cp /tmp/debian_lenny_i386/debian-installer/i386/linux /tftpboot/pxe/debian/lenny/i386/
cp /tmp/debian_lenny_amd64/debian-installer/amd64/initrd.gz /tftpboot/pxe/debian/lenny/amd64/
cp /tmp/debian_lenny_amd64/debian-installer/amd64/linux /tftpboot/pxe/debian/lenny/amd64/
cp /tmp/ubuntu_maverick_i386/ubuntu-installer/i386/initrd.gz /tftpboot/pxe/ubuntu/maverick/i386/
cp /tmp/ubuntu_maverick_i386/ubuntu-installer/i386/linux /tftpboot/pxe/ubuntu/maverick/i386/
cp /tmp/ubuntu_maverick_amd64/ubuntu-installer/amd64/initrd.gz /tftpboot/pxe/ubuntu/maverick/amd64/
cp /tmp/ubuntu_maverick_amd64/ubuntu-installer/amd64/linux /tftpboot/pxe/ubuntu/maverick/amd64/

il faut maintenant creer le fichier /tftpboot/pxe/pxelinux.cfg/default

On y met :

include /boot-screens/menu.cfg
default /boot-screens/vesamenu.c32
prompt 0
timeout 0

Faisons maintenant le fichier du menu

menu hshift 13
menu width 49

menu title Selectionnez votre distribution
menu background boot-screens/splash.png
menu color title        * #FFFFFFFF *
menu color border       * #00000000 #00000000 none
menu color sel          * #ffffffff #76a1d0ff *
menu color hotsel       1;7;37;40 #ffffffff #76a1d0ff *
menu color tabmsg       * #ffffffff #00000000 *
menu vshift 12
menu rows 10
menu tabmsgrow 16
menu timeoutrow 17
menu tabmsg appuyer sur ENTRER pour demarrer ou TAB pour selectionner une menu entrée
menu autoboot Démarrage depuis le disque dur local dans # seconds

prompt 0

 label bootlocal
 menu label ^Démarrer depuis le disque local
         menu default
         localboot 0
         timeout 200           #timeout which is displayed, Wait 10 seconds unless the user types somethin
         totaltimeout 1200     #timeout which executes the default definitely, always boot after 2 minutes

 menu begin debian
       menu title Debian
       label mainmenu
               menu label ^Retour..
               menu exit
       menu begin debian-lenny
               menu title Debian Lenny
               label mainmenu
                       menu label ^Retour..
                       menu exit
               menu begin debian-lenny-i386
                       menu title Debian Lenny i386
                       label mainmenu
                               menu label ^Retour..
                               menu exit
                       default install
                       label install
                               menu label ^Installation normal
                               kernel debian/lenny/i386/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/i386/initrd.gz -- quiet
                       label expert
                               menu label ^Installation mode expert
                               kernel debian/lenny/i386/linux
                               append priority=low vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/i386/initrd.gz --
                       label rescue
                               menu label ^Rescue mode
                               kernel debian/lenny/i386/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/i386/initrd.gz rescue/enable=true -- quiet
                       label auto
                               menu label ^Installation Automatique
                               kernel debian/lenny/i386/linux
                               append auto=true priority=critical vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/i386/initrd.gz -- quiet
               menu end
               menu begin debian-lenny-amd64
                       menu title Debian Lenny amd64
                       label mainmenu
                               menu label ^Retour..
                               menu exit
                       label install
                               menu label ^Installation normal
                               kernel debian/lenny/amd64/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/amd64/initrd.gz -- quiet
                       label expert
                               menu label ^Installation mode expert
                               kernel debian/lenny/amd64/linux
                               append priority=low vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/amd64/initrd.gz --
                       label rescue
                               menu label ^Rescue mode
                               kernel debian/lenny/amd64/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/amd64/initrd.gz rescue/enable=true -- quiet
                       label auto
                               menu label ^Installation automatique
                               kernel debian/lenny/amd64/linux
                               append auto=true priority=critical vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=debian/lenny/amd64/initrd.gz -- quiet
               menu end
       menu end
 menu end

 menu begin Ubuntu
       menu title Ubuntu
       label mainmenu
               menu label ^Retour..
               menu exit
       menu begin Ubuntu Maverick 10.10
               menu title Ubuntu Maverick 10.10
               label mainmenu
                       menu label ^Retour..
                       menu exit
               menu begin Ubuntu Maverick 10.10 i386
                       menu title Ubuntu Maverick 10.10 i386
                       label mainmenu
                               menu label ^Retour..
                               menu exit
                       default install
                       label install
                               menu label ^Installation normal
                               kernel ubuntu/maverick/i386/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/i386/initrd.gz -- quiet
                       label expert
                               menu label ^Installation mode expert
                               kernel ubuntu/maverick/i386/linux
                               append priority=low vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/i386/initrd.gz --
                       label rescue
                               menu label ^Rescue mode
                               kernel ubuntu/maverick/i386/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/i386/initrd.gz rescue/enable=true -- quiet
                       label auto
                               menu label ^Installation Automatique
                               kernel ubuntu/maverick/i386/linux
                               append auto=true priority=critical vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/i386/initrd.gz -- quiet
               menu end
               menu begin ubuntu Maverick 10.10 amd64
                       menu title ubuntu Maverick 10.10 amd64
                       label mainmenu
                               menu label ^Retour..
                               menu exit
                       label install
                               menu label ^Installation normal
                               kernel ubuntu/maverick/amd64/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/amd64/initrd.gz -- quiet
                       label expert
                               menu label ^Installation mode expert
                               kernel ubuntu/maverick/amd64/linux
                               append priority=low vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/amd64/initrd.gz --
                       label rescue
                               menu label ^Rescue mode
                               kernel ubuntu/maverick/amd64/linux
                               append vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/amd64/initrd.gz rescue/enable=true -- quiet
                       label auto
                               menu label ^Installation automatique
                               kernel ubuntu/maverick/amd64/linux
                               append auto=true priority=critical vga=normal languagechooser/language-name=French countrychooser/shortlist=fr_FR console-keymaps-at/keymaps=fr-latin9 initrd=ubuntu/maverick/amd64/initrd.gz -- quiet
               menu end
       menu end
 menu end

Branchez un pc et faites un test. Normalement vous avez un menu vous proposant soit ubuntu soit debian.
Il est à noté que cette configuration à un inconvénient. Il nécessite une connexion à internet. En effet le netboot va aller télécharger la derniere version de debian ou ubuntu sur des miroirs. Donc pas d internet et cette solution est caduque. De plus elle est de part sa connexion internet excessivement lente. Il peut etre très avantageux de copier une iso complète sur votre serveur pxe de telle manière que l intégralité de l installation se fasse sans passer par internet. Mais ca nous le verrons par la suite.

Configuration et mise en place de centos via le pxe

Commencons par télécharger les noyaux netboot

wget http://mirror.centos.org/centos/5/os/i386/images/pxeboot/initrd.img -O /tftpboot/pxe/centos/5/i386/initrd.img
wget http://mirror.centos.org/centos/5/os/i386/images/pxeboot/vmlinuz -O /tftpboot/pxe/centos/5/i386/vmlinuz
wget http://mirror.centos.org/centos/5/os/x86_64/images/pxeboot/initrd.img -O /tftpboot/pxe/centos/5/x86_64/initrd.img
wget http://mirror.centos.org/centos/5/os/x86_64/images/pxeboot/vmlinuz -O /tftpboot/pxe/centos/5/x86_64/vmlinuz

Créons maintenant les fichiers Ks necessaires au boot de centos

touch /var/www/centos_5_i386.cfg
touch /var/www/centos_5_x86_64.cfg

Voici le contenu des deux fichiers :
centos_5_i386.cfg

install
url --url http://mirror.centos.org/centos/5/os/i386
lang fr_FR.UTF-8
langsupport --default en_US.UTF-8 en_US.UTF-8 fr_FR.UTF-8
keyboard fr_FR-latin1

centos_5_x86_64.cfg

install
url --url http://mirror.centos.org/centos/5/os/x86_64/
lang fr_FR.UTF-8
langsupport --default en_US.UTF-8 en_US.UTF-8 fr_FR.UTF-8
keyboard fr_FR-latin1

Rajoutons maintenant ceci en bas de notre fichier menu.cfg.

 menu begin centos
       menu title Centos
       label mainmenu
               menu label ^Back..
               menu exit
       menu begin centos 5
               menu title CentOS 5
               label mainmenu
                       menu label ^Retour..
                       menu exit
               menu begin centos 5 i386
                       menu title CentOS 5 i386
                       label mainmenu
                               menu label ^Retour..
                               menu exit
                       label install
                               menu label ^Installation normal
                               kernel centos/5/i386/vmlinuz
                               append ksdevice=eth0 console=tty0 initrd=centos/5/i386/initrd.img ks=http://192.168.1.245/centos_5_i386.cfg ramdisk_size=8192
               menu end
               menu begin centos-5-x86_64
                       menu title CentOS 5 amd64
                       label mainmenu
                               menu label ^Retour..
                               menu exit
                       label install
                               menu label ^Installation normal
                               kernel centos/5/x86_64/vmlinuz
                               append ksdevice=eth0 console=tty0 initrd=centos/5/x86_64/initrd.img ks=http://192.168.1.245/centos_5_x86_64.cfg ramdisk_size=8192
               menu end
       menu end
 menu end

Configuration et mise en place de fedora

Comme pour centos on commence par allez recuperer les netboot.

wget http://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/i386/os/images/pxeboot/initrd.img -O /tftpboot/pxe/fedora/14/i386/initrd.img
wget http://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/i386/os/images/pxeboot/vmlinuz -O /tftpboot/pxe/fedora/14/i386/vmlinuz
wget http://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/x86_64/os/images/pxeboot/initrd.img -O /tftpboot/pxe/fedora/14/x86_64/initrd.img
wget http://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/x86_64/os/images/pxeboot/vmlinuz -O /tftpboot/pxe/fedora/14/x86_64/vmlinuz

Création du fichier de configuration

touch /var/www/fedora_14_i386.cfg
touch /var/www/fedora_14_x86_64.cfg

Voici leur contenu

fedora_14_i386.cfg

install
url --url http://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/i386/os/

fedora_14_x86_64.cfg

install
url --url http://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/x86_64/os/

On met maintenant a jour le menu.cfg du pxe.

 menu begin fedora
       menu title Fedora
               label mainmenu
               menu label ^Retour..
               menu exit
       menu begin fedora 14
               menu title Fedora 14
               label mainmenu
                       menu label ^Retour..
                       menu exit
               menu begin fedora 14 i386
                       menu title Fedora 14 i386
                       label mainmenu
                               menu label ^retour..
                               menu exit
                       label install
                               menu label ^Installation normal
                               kernel fedora-9/i386/vmlinuz
                               append ksdevice=eth0 console=tty0 initrd=fedora/14/i386/initrd.img ks=http://192.168.1.245/fedora_14_i386.cfg ramdisk_size=8192
               menu end
               menu begin fedora 14 x86_64
                       menu title Fedora 14 amd64
                       label mainmenu
                               menu label ^Retour..
                               menu exit
                       label install
                               menu label ^Installallation normal
                               kernel fedora/14/x86_64/vmlinuz
                               append ksdevice=eth0 console=tty0 initrd=fedora/14/x86_64/initrd.img ks=http://192.168.245/fedora_14_x86_64.cfg ramdisk_size=8192
               menu end
       menu end
 menu end

III) Installation de systèmes d exploitation en livecd via le réseau

Remarque : Le grand avantage donc de cette solution je le répète c’est que nous n avons plus besoin d une connexion internet. Mais comme toujours nous aurons un inconvénient, nous n aurons pas la version la plus update possible.

Installation et configuration du livecd ubuntu via pxe

Pour ubuntu en faite nous allons devoir copier l intégralité des iso i386 et amd64.
On commence par télécharger les isos.

wget http://ftp.free.fr/mirrors/ftp.ubuntu.com/releases/10.10/ubuntu-10.10-desktop-i386.iso -O /tftpboot/pxe/ubuntu/maverick/livecd/maverick_i386.iso
wget http://ftp.free.fr/mirrors/ftp.ubuntu.com/releases/10.10/ubuntu-10.10-desktop-amd64.iso -O /tftpboot/pxe/ubuntu/maverick/livecd/maverick_amd64.iso

On va maintenant affiné notre arborescence

mkdir -p {/tftpboot/pxe/ubuntu/maverick/livecd/i386/cd/,/tftpboot/pxe/ubuntu/maverick/livecd/amd64/cd/}

Nous allons maintenant monter nos isos et récupérer l intégralité des données que nous copierons dans les répertoires fraichement créés.

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/ubuntu/maverick/livecd/maverick_i386.iso /tmp/iso
cp /tmp/iso/casper/vmlinuz /tftpboot/pxe/ubuntu/maverick/livecd/i386
cp /tmp/iso/casper/initrd.lz /tftpboot/pxe/ubuntu/maverick/livecd/i386
cp -R /tmp/iso/* /tftpboot/pxe/ubuntu/maverick/livecd/i386/cd
cp -R /tmp/iso/.disk /tftpboot/pxe/ubuntu/maverick/livecd/i386/cd
umount /tmp/iso

Traduction :
Je commence par créer le repertoire de montage de mes iso qui sera tmp/iso, je monte dedans l image que je viens de télécharger, je récupère les fichier wmlinuz et initrd.lz necessaire a mon pxe, puis je copie l intégralité de mon iso dans le répertoire disponible dans le tftpboot. Enfin je démonte mon iso

NB : verifiez bien que le /tmp/iso/.disk a bien été copié.

On fait la mémé chose avec la version 64bits

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/ubuntu/maverick/livecd/maverick_amd64.iso /tmp/iso
cp /tmp/iso/casper/vmlinuz /tftpboot/pxe/ubuntu/maverick/livecd/amd64
cp /tmp/iso/casper/initrd.lz /tftpboot/pxe/ubuntu/maverick/livecd/amd64
cp -R /tmp/iso/* /tftpboot/pxe/ubuntu/maverick/livecd/amd64/cd
cp -R /tmp/iso/.disk /tftpboot/pxe/ubuntu/maverick/livecd/amd64/cd
umount /tmp/iso

Maintenant rajoutons quelques lignes a notre menu.cfg afin de pouvoir demarrer sur le live cd

Dans chaque menu ubuntu i386 et amd64 vous rajoutez

label livecd
menu label ^Installation livecd
KERNEL ubuntu/maverick/livecd/i386/vmlinuz
APPEND boot=casper netboot=nfs nfsroot=192.168.1.245:/tftpboot/pxe/ubuntu/maverick/livecd/i386/cd/ initrd=ubuntu/maverick/livecd/i386/initrd.lz

et

label livecd
menu label ^Installation livecd
KERNEL ubuntu/maverick/livecd/amd64/vmlinuz
APPEND boot=casper netboot=nfs nfsroot=192.168.1.245:/tftpboot/pxe/ubuntu/maverick/livecd/amd64/cd/ initrd=ubuntu/maverick/livecd/amd64/initrd.lz

Installation et configuration du livecd debian via pxe

Nous commençons par télécharger les iso.

wget http://live.debian.net/cdimage/release/current-oldstable/amd64/iso-cd/debian-live-508-amd64-gnome-desktop.iso -O /tftpboot/pxe/debian/lenny/livecd/amd64_debian.iso
wget http://live.debian.net/cdimage/release/current-oldstable/i386/iso-cd/debian-live-508-i386-gnome-desktop.iso -O /tftpboot/pxe/debian/lenny/livecd/i386_debian.iso
wget http://cdimage.debian.org/cdimage/archive/5.0.8/i386/iso-dvd/debian-508-i386-DVD-1.iso -O /tftpboot/pxe/debian/lenny/livecd/lenny_dvd_i386.iso
wget http://cdimage.debian.org/cdimage/archive/5.0.8/amd64/iso-dvd/debian-508-amd64-DVD-1.iso -O /tftpboot/pxe/debian/lenny/livecd/lenny_dvd_amd64.iso

Création des répertoires

mkdir -p {/tftpboot/pxe/debian/lenny/livecd/i386/cd/,/tftpboot/pxe/debian/lenny/livecd/amd64/cd/}

On monte et on copie les fichiers

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/debian/lenny/livecd/i386_debian.iso /tmp/iso
cp /tmp/iso/live/vmlinuz /tftpboot/pxe/debian/lenny/livecd/i386
cp /tmp/iso/live/initrd.img /tftpboot/pxe/debian/lenny/livecd/i386
cp -R /tmp/iso/* /tftpboot/pxe/debian/lenny/livecd/i386/cd
cp -R /tmp/iso/.disk /tftpboot/pxe/debian/lenny/livecd/i386/cd
umount /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/debian/lenny/livecd/lenny_dvd_i386.iso /tmp/iso

et

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/debian/lenny/livecd/amd64_debian.iso /tmp/iso
cp /tmp/iso/live/vmlinuz /tftpboot/pxe/debian/lenny/livecd/amd64
cp /tmp/iso/live/initrd.img /tftpboot/pxe/debian/lenny/livecd/amd64
cp -R /tmp/iso/* /tftpboot/pxe/debian/lenny/livecd/amd64/cd
cp -R /tmp/iso/.disk /tftpboot/pxe/debian/lenny/livecd/amd64/cd
umount /tmp/iso

Et on fini en modifiant le menu.cfg

label livecd
menu label ^Installation livecd
KERNEL debian/lenny/livecd/i386/vmlinuz
APPEND boot=casper netboot=nfs nfsroot=192.168.1.245:/tftpboot/pxe/debian/lenny/livecd/i386/cd/ initrd=debian/lenny/livecd/i386/initrd.img

et

label livecd
menu label ^Installation livecd
KERNEL debian/lenny/livecd/amd64/vmlinuz
APPEND boot=casper netboot=nfs nfsroot=192.168.1.245:/tftpboot/pxe/debian/lenny/livecd/amd64/cd/ initrd=debian/lenny/livecd/amd64/initrd.lz

Installation de centos en livecd depuis le pxe

On continue toujours de la même manière. On commence par télécharger les iso.

wget ftp://ftp.free.fr/mirrors/ftp.centos.org/5.5/isos/i386/CentOS-5.5-i386-bin-DVD.iso -O /tftpboot/pxe/centos/5/livecd/i386.iso
wget ftp://ftp.free.fr/mirrors/ftp.centos.org/5.5/isos/x86_64/CentOS-5.5-x86_64-bin-DVD-1of2.iso  -O /tftpboot/pxe/centos/5/livecd/x86_64.iso
wget ftp://ftp.free.fr/mirrors/ftp.centos.org/5.5/isos/x86_64/CentOS-5.5-x86_64-bin-DVD-2of2.iso  -O /tftpboot/pxe/centos/5/livecd/x86_64_2.iso

Création des répertoires

mkdir -p { /tftpboot/pxe/centos/5/livecd/i386/cd/, /tftpboot/pxe/centos/5/livecd/x86_64/cd/}

On monte les iso et on copie les fichiers

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/centos/5/livecd/i386.iso /tmp/iso
cp /tmp/iso/images/pxeboot/vmlinuz /tftpboot/pxe/centos/5/livecd/i386
cp /tmp/iso/images/pxeboot/initrd.img /tftpboot/pxe/centos/5/livecd/i386
cp -R /tmp/iso/* /tftpboot/pxe/centos/5/livecd/i386/cd
umount /tmp/iso

et

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/centos/5/livecd/x86_64.iso /tmp/iso
cp /tmp/iso/images/pxeboot/vmlinuz /tftpboot/pxe/centos/5/livecd/x86_64
cp /tmp/iso/images/pxeboot/initrd.img /tftpboot/pxe/centos/5/livecd/x86_64
cp -R /tmp/iso/* /tftpboot/pxe/centos/5/livecd/x86_64/cd
umount /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/centos/5/livecd/x86_64_2.iso /tmp/iso
cp -R /tmp/iso/* /tftpboot/pxe/centos/5/livecd/x86_64/cd
umount /tmp/iso

On finalise maintenant avec le menu.cfg de votre pxe (a mettre dans la partie centos du fichier bien sur).

label livecd
menu label Installation LiveCd
kernel centos/5/livecd/i386/vmlinuz
append method=nfs:192.168.1.245:/tftpboot/pxe/centos/5/livecd/i386/cd/ lang=fr keymap=fr ip=dhcp ksdevice=eth0 noipv6 initrd=centos/5/livecd/i386/initrd.img ramdisk_size=10000

et

label livecd
menu label Installation LiveCd
kernel centos/5/livecd/x86_64/vmlinuz
append method=nfs:192.168.1.245:/tftpboot/pxe/centos/5/livecd/x86_64/cd/ lang=fr keymap=fr ip=dhcp ksdevice=eth0 noipv6 initrd=centos/5/livecd/x86_64/initrd.img ramdisk_size=10000

Installation de Fedora en livecd depuis le pxe

On télécharge les iso

wget ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/i386/iso/Fedora-14-i386-DVD.iso -O /tftpboot/pxe/fedora/14/livecd/i386.iso
wget ftp://ftp.free.fr/mirrors/fedora.redhat.com/fedora/linux/releases/14/Fedora/x86_64/iso/Fedora-14-x86_64-DVD.iso -O /tftpboot/pxe/fedora/14/livecd/x86_64.iso

Créations des répertoires

mkdir -p {/tftpboot/pxe/fedora/14/livecd/i386/cd/,/tftpboot/pxe/fedora/14/livecd/x86_64/cd/}

On copie les fichiers

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/fedora/14/livecd/i386.iso /tmp/iso
cp /tmp/iso/images/pxeboot/vmlinuz /tftpboot/pxe/fedora/14/livecd/i386
cp /tmp/iso/images/pxeboot/initrd.img /tftpboot/pxe/fedora/14/livecd/i386
cp -R /tmp/iso/* /tftpboot/pxe/fedora/14/livecd/i386/cd
umount /tmp/iso

et

mkdir /tmp/iso
mount -o loop -t iso9660 /tftpboot/pxe/fedora/14/livecd/x86_64.iso /tmp/iso
cp /tmp/iso/images/pxeboot/vmlinuz /tftpboot/pxe/fedora/14/livecd/x86_64
cp /tmp/iso/images/pxeboot/initrd.img /tftpboot/pxe/fedora/14/livecd/x86_64
cp -R /tmp/iso/* /tftpboot/pxe/fedora/14/livecd/x86_64/cd
umount /tmp/iso

Mise en place des informations dans le menu.cfg du pxe.

label livecd
menu label fedora livecd
kernel fedora/14/livecd/i386/vmlinuz
APPEND method=nfs:192.168.1.245:/tftpboot/pxe/fedora/14/livecd/i386/cd/ lang=fr keymap=fr ip=dhcp ksdevice=eth0 noipv6 initrd=fedora/14/livecd/i386/initrd.img ramdisk_size=10000

et

label livecd
menu label fedora livecd
KERNEL fedora/14/livecd/x86_64/vmlinuz
APPEND method=nfs:192.168.1.245:/tftpboot/pxe/fedora/14/livecd/x86_64/cd/ lang=fr keymap=fr ip=dhcp ksdevice=eth0 noipv6 initrd=fedora/14/livecd/x86_64/initrd.img ramdisk_size=10000

IV) Installation de windows grâce à unattended

unattended est un systeme permettant de pouvoir lancer facilement vos installations windows.

wget http://downloads.sourceforge.net/project/unattended/unattended/4.8/unattended-4.8.zip -O /tftpboot/pxe/microsoft/unattended.zip

  wget http://downloads.sourceforge.net/project/unattended/unattended/4.8/unattended-4.8-linuxboot.zip -O /tftpboot/pxe/microsoft/unattended-linuxboot.zip
  cd /tftpboot/pxe/microsoft/
  unzip unattended.zip
  unzip unattended-linuxboot.zip
  cp -R unattended-4.8/install/* /tftpboot/pxe/microsoft/

Le systeme est maintenant installé nous allons copier une iso de xp dans le répertoire os/winxp

mkdir -p /tftpboot/pxe/microsoft/os/winxp

on met maintenant dans le menu.cfg

V) Installation d’outils divers

Installation de memtest

cp /usr/lib/syslinux/chain.c32 /tftpboot/pxe/dos/
cp /usr/lib/syslinux/memdisk /tftpboot/pxe/dos/
wget http://www.memtest86.com/memtest86-3.4a.iso.gz -O /tftpboot/pxe/dos/memtest.gz
cd /tftpboot/pxe/dos
gzip -d memtest.gz
mount -o loop -t iso9660 memtest /tmp/iso
cp /tmp/iso/isolinux/memtest /tftpboot/pxe/dos/memtest
umount /tmp.iso

On modifie notre fichier menu.cfg

label memtest
        menu label ^Memtest
        kernel memdisk
        append initrd=memtest

Installation de l outil sysresccd

sysresccd est une boite a outil bien pratique pour dépanner un pc.
Nous allons donc l installer pour y avoir accès depuis notre serveur PXE. Il est interessant de voir que dans ce cas la je télécharge le .dat du cd via le serveur apache

cd /tftpboot/pxe/outils/sysresccd/
wget http://downloads.sourceforge.net/project/systemrescuecd/sysresccd-x86/2.0.0/systemrescuecd-x86-2.0.0.iso?r=http%3A%2F%2Fwww.sysresccd.org%2FDownload&ts=1295714237&use_mirror=ovh
mv systemrescuecd-x86-2.0.0.iso* systemrescuecd.iso
mount -o loop systemrescuecd.iso cdrom
cd cdrom
cp sysrcd.md5 /tftpboot/pxe/outils/sysresccd/
cp sysrcd.dat /tftpboot/pxe/outils/sysresccd/
cd isolinux
cp initram.igz /tftpboot/pxe/outils/sysresccd/
cp rescuecd /tftpboot/pxe/outils/sysresccd/

Il faut maintenant dans le menu.cfg rajoutez les lignes pour avoir accès a sysresccd que nous avons ranger dans le menu Outils

On rajoute en fin de fichier

menu begin Outils
       menu title Outils
       label mainmenu
               menu label ^Retour..
               menu exit
		 label sysresccd
				    menu label ^SysRescCD
				    kernel outils/sysresccd/rescuecd
   				 append scandelay=5 initrd=outils/sysresccd/initram.igz httpboot=http://192.168.1.245/outils/sysresccd/sysrcd.dat setkeymap=fr
   		menu end
menu end

Installation de l antivirus kaspersky live cd en pxe *

on télécharge l iso

wget http://devbuilds.kaspersky-labs.com/devbuilds/RescueDisk10/kav_rescue_10.iso -O /tftpboot/pxe/outils/kaspersky/kaspersky.iso

On monte et on copie l iso

mount -o loop -t iso9660 /tftpboot/pxe/outils/kaspersky/kaspersky.iso /tmp/iso
cp -R /tmp/iso/* /tftpboot/pxe/outils/kaspersky/cdrom
umount /tmp/iso

On termine enfin en mettant a jour notre menu.cfg

label KAV10 rescue ENG
kernel outils/kaspersky/cdrom/boot/rescue
append initrd=outils/kaspersky/cdrom/boot/rescue.igz root=/dav/ram0 cdroot=1 kav_lang=en loop=outils/kaspersky/cdrom/image.squashfs looptype=squashfs real_root=outils/kaspersky/cdrom/

Installation de bitdefender live cd en pxe *

on télécharge l iso

wget http://download.bitdefender.com/rescue_cd/bitdefender-rescue-cd.iso -O /tftpboot/pxe/outils/bitdefender/bitdefender.iso
mount -o loop -t iso9660 /tftpboot/pxe/outils/bitdefender/bitdefender.iso /tmp/iso
cp -R /tmp/iso/* /tftpboot/pxe/outils/bitdefender/cdrom
umount /tmp/iso

Puis dans le menu.cfg

label Bitdefender
menu label ^BitDefender Anti-Virus Scan
kernel outils/bitdefender/cdrom/casper/vmlinuz
append boot=casper netboot=nfs nfsroot=192.168.1.245:/tftpboot/pxe/outils/bitdefender/cdrom/ file=/cdrom/preseed/ubuntu.seed initrd=outils/bitdefender/cdrom/casper/initrd.gz ip=dhcp --

Installation de ultimatebootcd via pxe *

Comme d habitude on commence par télécharger l iso on decompresse et on copie

wget http://ubcd.mirror.fr/ubcd503.iso -O /tftpboot/pxe/outils/ultimatebootcd/ubcd503.iso
mount -o loop -t iso9660 /tftpboot/pxe/outils/ultimatebootcd/ubcd503.iso /tmp/iso
cp -R /tmp/iso/* /tftpboot/pxe/outils/ultimatebootcd
umount /tmp/iso

Installation de clonezilla

Clonezilla est un utilitaire bien pratique qui a la même fonction que norton ghost.

On télécharge l image iso de clonezilla

wget http://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable/1.2.6-59/clonezilla-live-1.2.6-59-i686.iso -O /tftpboot/pxe/outils/clonezilla/clonezilla.iso

On monte l iso et on recupere les données

mount -o loop -t iso9660 /tftpboot/pxe/outils/clonezilla/clonezilla.iso /tmp/iso
cp -R /tmp/iso/* /tftpboot/pxe/outils/clonezilla/cdrom
umount /tmp/iso

On rajoute dans le menu.cfg du pxe pour lancez clonezilla au niveau d outils.

label Clonezilla
 menu label Clonezilla
 kernel outils/clonezilla/cdrom/live/vmlinuz
 append initrd=outils/clonezilla/cdrom/live/initrd.img boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=788 nosplash fetch=http://192.168.1.245/pxe/outils/clonezilla/cdrom/live/filesystem.squashfs

7 comments

comments user
always

Bravo pour ce tuto assez complet mais il manque le contenue du fichier cfg pour unattended.

comments user
admin

Tout a fait juste… Le tuto n’est pas encore fini je suis en train de tester justement la reinstallation des windows. J’ai encore du pain sur la planche

comments user
Cid

Un grand merci et surtout bravo pour ce merveilleux tuto juste deux petite chose il manque le contenu du menu.cfg pour ultimateboot et j’aimerai savoir ou en est le devellopement de la réinstall de windows

encore merci et courage c’est fantastique ce que tu fait

comments user
fran

Salut,

Excellent ton tuto.

J’ai une petite question, pour lancer l’iso XP, que dois-je rajouter dans le menu.cfg ?

Ça marche avec d’autre iso ? (w7, 2008 srv, acronis)

Merci

comments user
jies

Des tutos comme j’aimerai en voir plus souvent, c’est nickel.
Clair, bien construit et efficace!
Encore bravo, ca faisait longtemps que je voulais comprendre comment fonctionnait tout ça, et grâce à ton tuto je peux enfin y voir plus clair.
J’ai tellement vu d’autres tutos qui partent dans tous les sens, et où c’est jamais la même chose..
Merci

comments user
admin

Merci ca fait plaisir a lire

comments user
lyen

j’ai actuellement besoin de faire ce type de projet pour mon entreprise, ( alternance )

très bon tuto je te remercie grandement!

Laisser un commentaire