« Installation/Cobbler » : différence entre les versions

De TartareFR
Aller à la navigation Aller à la recherche
Ligne 29 : Ligne 29 :
* Installation des paquets<pre>yum -y install cobbler pykickstart tftp</pre>
* Installation des paquets<pre>yum -y install cobbler pykickstart tftp</pre>
* Activation du service tftpd (xinetd)<pre>sed -i -e '/disable/ s/yes/no/' /etc/xinetd.d/tftp</pre>
* Activation du service tftpd (xinetd)<pre>sed -i -e '/disable/ s/yes/no/' /etc/xinetd.d/tftp</pre>
* Démarrage et activation des services concernés<pre>for service in xinetd httpd cobblerd ; do systemctl start $service ; systemctl enable $service ; done</pre>
* Démarrage et activation des services concernés: '''httpd''', '''xinetd''' et '''cobblerd'''<pre>for service in xinetd httpd cobblerd ; do systemctl start $service ; systemctl enable $service ; done</pre>


== Configuration ==
== Configuration ==

Version du 31 octobre 2014 à 08:04

Introduction

Cobbler[1] est un serveur d'installation qui permet d'installer facilement et automatiquement des systèmes d'exploitations, virtualisés ou non via PXE.

Installation

Modification du service DHCP

Si le serveur DHCPd n'est pas la même machine que le serveur cobbler, il faut déclarer le serveur Cobbler sur le serveur DHCPd:

Fichier <path>/etc/dhcp/dhcpd.conf</path>

...
 allow booting;
 allow bootp;
 filename "pxelinux.0";
 next-server 192.168.0.205;
...

On redémarre le service DHCPd

service dhcpd restart

Installation de cobbler

Sur un serveur fraichement installé en CentOS 7:

  • Mise en place du nom d'hôte
    hostnamectl set-hostname cobbler.home.net
  • Redémarrage du serveur
  • Installation du dépôt EPEL
    rpm -Uvh http://mirror.ibcp.fr/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
  • Installation des paquets
    yum -y install cobbler pykickstart tftp
  • Activation du service tftpd (xinetd)
    sed -i -e '/disable/ s/yes/no/' /etc/xinetd.d/tftp
  • Démarrage et activation des services concernés: httpd, xinetd et cobblerd
    for service in xinetd httpd cobblerd ; do systemctl start $service ; systemctl enable $service ; done

Configuration

Au niveau configuration, on va dans un premier temps s'occuper de SELinux[2].

setsebool -P httpd_can_network_connect true
setsebool -P cobbler_can_network_connect true
semanage fcontext -a -t public_content_t "/var/lib/tftpboot/.*"
restorecon -Rv /var/lib/tftpboot

Puis dans le fichier de configuration <path>/etc/cobbler/settings</path>, on va:

  • Définir un mot de passe crypté qui sera le mot de passe root pour les machines installées en PXE
  • Modifier l'adresse IP du serveur cobbler.

On commence donc par créer le mot de passe crypté à l'aide d'openssl.

openssl passwd -1

On peut donc maintenant éditer le fichier de configuration du serveur cobbler: Fichier <path>/etc/cobbler/settings</path>

default_password_crypted: <mot-de-passe-crypté>
next_server: 192.168.0.205
server: 192.168.0.205

On va maintenant télécharger les boot-loaders

cobbler get-loaders

Redémarrage du cobbler

systemctl restart cobblerd

Synchronisation

cobbler sync

Et vérification

cobbler check
No configuration problems found.  All systems go.

Cobbler est maintenant correctement configuré.

Ajout de distributions

mount -t iso9660 -o loop,ro /downloads/CentOS-5.5-x86_64-core.iso /mnt/
cobbler import --path=/mnt --name=CentOS-5-x86_64
systemctl restart cobblerd
cobbler sync

La configuration de notre cobbler est désormais correctement configuré et on peut effectuer un test d'installation d'une machine virtuelle. On crée une nouvelle machine virtuelle sans lui fournir de media sur lequel booter, on démarre la VM puis on précise que l'on veut booter via PXE, on verra ensuite une interface ou l'on précisera sur quel image on veut booter.

Trucs et astuces

Obtenir la liste des profiles

cobbler profile list
   CentOS-5-i386
   CentOS-5-x86_64
   CentOS-5-xen-i386
   CentOS-5-xen-x86_64
   CentOS-6-i386
   CentOS-6-x86_64
   CentOS-7-x86_64

Obtenir la liste des distributions

cobbler distro list
   CentOS-5-i386
   CentOS-5-x86_64
   CentOS-5-xen-i386
   CentOS-5-xen-x86_64
   CentOS-6-i386
   CentOS-6-x86_64
   CentOS-7-x86_64

Obtenir la configuration d'une distribution

cobbler distro report --name=CentOS-7-x86_64
Name                           : CentOS-7-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/CentOS-7-x86_64'}
Management Classes             : []
OS Version                     : rhel7
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

Valider les fichiers kickstart

cobbler validateks
task started: 2014-10-30_100015_validateks
task started (id=Kickstart Validation, time=Thu Oct 30 10:00:15 2014)
----------------------------
osversion: rhel5
checking url: http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-i386
running: /usr/bin/ksvalidator -v "rhel5" "http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-i386"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel6
checking url: http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-6-i386
running: /usr/bin/ksvalidator -v "rhel6" "http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-6-i386"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel5
checking url: http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-xen-i386
running: /usr/bin/ksvalidator -v "rhel5" "http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-xen-i386"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel5
checking url: http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-x86_64
running: /usr/bin/ksvalidator -v "rhel5" "http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-x86_64"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel5
checking url: http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-xen-x86_64
running: /usr/bin/ksvalidator -v "rhel5" "http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-5-xen-x86_64"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel6
checking url: http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-6-x86_64
running: /usr/bin/ksvalidator -v "rhel6" "http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-6-x86_64"
received on stdout: 
received on stderr: 
----------------------------
osversion: rhel7
checking url: http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-7-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.0.205/cblr/svc/op/ks/profile/CentOS-7-x86_64"
received on stdout: 
received on stderr: 
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***

Obtenir le fichier kickstart d'une distribution

cobbler profile getks --name=CentOS-7-x86_64

Références