installation d'un serveur pxe
Description | Installation d'un serveur pxe sous centos 7 pour permettre une installation automatisée de serveur |
---|---|
Page d'accueil | HPC Administration Module1 |
Auteur | Ndomassi TANDO (ndomassi.tando@ird.fr) |
Date de création | 20/09/2019 |
Dernière date de modification | 20/09/2019 |
Sommaire
INSTALLATION D'UN SERVEUR PXE
Pré-requis
- Un serveur DHCP
- Un serveur NFS
- Un serveur TFTP
- Un dépôt FTP, NFS ou un serveur HTTP pour stocker les fichiers d’installation
Lancer les commandes suivantes en tant que superutilisateur:
$ yum install dhcp tftp tftp-server syslinux wget vsftpd httpd xinetd nfs-utils -y
Configuration du serveur DHCP:
Démarrer le serveur à installer et noter son adresse MAC.
Il faut ensuite modifier le fichier /etc/dhcp/dhcp.conf avec les valeurs suivantes :
option domain-name "intraceraas";
default-lease-time 86400;
max-lease-time 86400;
ddns-update-style none;
allow bootp;
allow booting;
option ip-forwarding false;
option mask-supplier false;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.249;
}
group {
next-server 192.168.1.250;
filename "pxelinux.0";
host node0 {
hardware ethernet @MAC à renseigner;
fixed-address 192.168.1.100;
}
}
Redémarrer ensuite le service avec la commande :
$ service dhcpd restart
Configurer le serveur tftp:
Il faut activer le service tftp en mettant la variable disable à « no ».
Le fichier de configuration /etc/xinetd.d/tftp
doit contenir les lignes suivantes :
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -v -s /tftpboot -r blksize
per_source = 11
cps = 100 2
flags = IPv4
}
Redémarrer le service avec la commande:
$ systemctl restart xinetd
Installation des fichiers de boot réseau :
Créer le répertoire /tftpboot avec tous les droits
$ mkdir -p /tftpboot
$ chmod 777 /tftpboot
Copier les fichiers pour pouvoir démarrer au boot :
$ cp -v /usr/share/syslinux/pxelinux.0 /tftpboot
$ cp -v /usr/share/syslinux/menu.c32 /tftpboot
$ cp -v /usr/share/syslinux/memdisk /tftpboot
$ cp -v /usr/share/syslinux/mboot.c32 /tftpboot
$ cp -v /usr/share/syslinux/chain.c32 /tftpboot
$ mkdir /tftpboot/pxelinux.cfg
$ mkdir /tftpboot/netboot/
Monter l’ISO de centos 7 dans /mnt
Taper la commande:
$ mount -o loop CentOS-7.0-1406-x86_64-DVD.iso /mnt/
Copier le contenu de l’iso dans /tftpboot/centos7 :
$ cp -fr /tftpboot/centos7
$ chmod -R 755 /tftpboot/centos7
Copie des fichiers initrd.img et vmlinuz dans /tftpboot/netboot/
Taper les commandes suivantes :
$ cp /mnt/images/pxeboot/vmlinuz /tftpboot/netboot/
$ cp /mnt/images/pxeboot/initrd.img /tftpboot/netboot/
Configuration du serveur nfs :
Lancer la commande suivante pour éviter les problèmes de démarrage du service rpc :
$ dracut -f -v
Modifier le fichier /etc/exports pour permettre l’ accès à /tftpboot
aux noeuds :
$ /tftpboot 192.168.1.0/24(rw,no_root_squash,async)
Activer et démarrer les services RPC et NFS :
$ systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
systemctl start nfs-server
Configuration du serveur apache :
Créer un fichier /etc/httpd/conf.d/pxeboot.conf
et rajouter les lignes suivantes :
Alias /centos7 /tftpboot/centos7
<Directory /tftpboot/centos7>
Options Indexes FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 192.168.1.0/24
</Directory>
Redémarrer le service apache :
$ service httpd restart
Créer le fichier de configuration du serveur pxe :
Créer le fichier /tfpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 30
MENU TITLE PXE Menu
LABEL centos7_x64
MENU LABEL CentOS 7 X64
KERNEL netboot/vmlinuz
APPEND initrd=netboot/initrd.img ks=nfs:192.168.1.250:/tftpboot/ks.cfg inst.repo=http://192.168.1.150/centos7/7.2/os/x86_64
Créer le fichier kickstart /tftpboot/ks.cfg:
On crypte au préalable le mot de passe root avec la commande suivante :
$ openssl passwd -1 "thies2018"
Le kickstart est un fichier qui permet de paramétrer l’installation automatique de centos.
install
text
lang fr_FR.UTF-8
keyboard fr-latin1
skipx
network --device eth7 --bootproto dhcp --netmask 255.255.255.0
nfs --server 192.168.1.250 --dir /tftpboot/Centos7
rootpw --iscrypted $1$QJl5rL0s$ShDwIpBVfqLTD3KhKkpuf0
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
graphical
timezone Afrique/Dakar
bootloader
reboot
zerombr
clearpart --linux --initlabel
part /boot --fstype ext3 --size 500 --ondisk=sda
part / --fstype ext3 --size 50000 --ondisk=sda
part swap --size 8192 --ondisk=sda
part /scratch --fstype ext4 --size 100 --grow –ondisk=sda
%packages
@base
@core
@network-server
@fonts
@compat-libraries
@network-file-system-client
@Compatibility libraries
@development
@System administration tools
kernel-devel
rsync
ntp
libcap
rsh-server
rsh
xorg-x11-xauth
xz-lzma-compact
bzip2-devel
zlib
ncurses
ncurses-devel
tcl
%end
%post
mkdir /data
chmod -R 777 /scratch
%end
Links
- Cours liés : HPC Trainings
License
