Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:centos:8:junior:l116 [2021/06/02 15:34] – created admin | elearning:workbooks:centos:8:junior:l116 [2024/09/12 09:18] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version : **2021.01** | + | Version : **2024.01** |
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ======LCF210 | + | ======LCF510 |
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **LCF210 | + | * **LCF510 |
* Contenu du Module | * Contenu du Module | ||
* Présentation | * Présentation | ||
Ligne 18: | Ligne 18: | ||
* Autres Systèmes | * Autres Systèmes | ||
* Gestionnaire d' | * Gestionnaire d' | ||
- | | + | * GRUB 2 |
- | * La Commande LILO | + | |
- | * Codes Erreur de LILO | + | |
- | * Grub Legacy sous RHEL/CentOS 6 | + | |
- | * Configurer GRUB Legacy | + | |
- | * La Section Globale | + | |
- | * Une Section spécifique à un OS | + | |
- | * Configurer l' | + | |
- | * Modifier la Configuration de GRUB Legacy en Ligne de Commande | + | |
- | | + | |
* Le fichier / | * Le fichier / | ||
* Le fichier / | * Le fichier / | ||
* Les fichiers du répertoire /etc/grub.d | * Les fichiers du répertoire /etc/grub.d | ||
* Configurer l' | * Configurer l' | ||
- | * RHEL/CentOS < 7.2 | ||
- | * RHEL/CentOS >= 7.2 | ||
* Modifier la Configuration de GRUB 2 en Ligne de Commande | * Modifier la Configuration de GRUB 2 en Ligne de Commande | ||
* Chargeurs de Démarrages Alternatifs | * Chargeurs de Démarrages Alternatifs | ||
Ligne 44: | Ligne 33: | ||
* PXELINUX | * PXELINUX | ||
* Isodhpfx | * Isodhpfx | ||
- | * Initramfs | + | * Initramfs |
- | * Examiner l' | + | |
- | * Le script init | + | |
- | * La Commande dracut | + | |
- | * Initramfs sous RHEL/CentOS 7 | + | |
* Examiner l' | * Examiner l' | ||
* Le script init | * Le script init | ||
* Consulter le contenu d'un fichier dans initramfs | * Consulter le contenu d'un fichier dans initramfs | ||
- | * La Commande dracut | ||
* Processus de Démarrage du Noyau Linux | * Processus de Démarrage du Noyau Linux | ||
* Processus Init | * Processus Init | ||
- | * Démarrer RHEL/CentOS 5 avec SysVinit | + | * Systemd |
- | * Niveaux d' | + | * LAB #1 - La Commande systemctl |
- | * Inittab | + | * LAB #2 - Fichiers de Configuration |
- | * Scripts | + | * 2.1 - Fichiers |
- | * rc.sysinit sous RHEL/CentOS 5 | + | * 2.2 - Surchargement des Fichiers de Configuration par Défaut |
- | * Répertoire init.d | + | * LAB #3 - La Commande systemd-analyze |
- | * Linux Standard Base | + | * LAB #4 - Les Cibles Systemd |
- | * Codes Retour Standardisés | + | * 4.1 - Contrôler les dépendances |
- | * Scripts | + | * 4.2 - La Cible par Défaut |
- | * Répertoires rcx.d | + | * LAB #5 - Gestion des Services |
- | * rc.local | + | * 5.1 - Gestion des Instances Uniques |
- | * La Commande chkconfig | + | * 5.2 - Gestion d' |
- | * Démarrer RHEL/CentOS 6 avec Upstart | + | * 5.3 - Interdire la Modification du Statut d'un Service |
- | * Inittab | + | |
- | * Initialisation du Système | + | |
- | * Runlevels | + | |
- | * [CTL]-[ALT]-[DEL] | + | |
- | * mingetty | + | |
- | * Gestion des Services | + | |
- | * La Commande initctl | + | |
- | * Jobs | + | |
- | * Événements | + | |
- | * Etats | + | |
- | * Démarrer et Arrêter les Jobs | + | |
- | * La Commande status | + | |
- | * La Commande start | + | |
- | * La Commande stop | + | |
- | * La Commande restart | + | |
- | * Démarrer RHEL/CentOS 7 | + | |
- | * La Commande systemctl | + | |
- | * Fichiers de Configuration | + | |
- | * La Commande systemd-analyze | + | |
- | * Gestion des Services | + | |
* Arrêt Système du Système | * Arrêt Système du Système | ||
* La Commande shutdown | * La Commande shutdown | ||
Ligne 102: | Ligne 66: | ||
* Le noyau se charge en mémoire et commence à exécuter en arrière plan les programmes nécessaires au fonctionnement du système. | * Le noyau se charge en mémoire et commence à exécuter en arrière plan les programmes nécessaires au fonctionnement du système. | ||
- | <WRAP center round tip> | + | <WRAP center round tip 60%> |
**A retenir** : Il est possible de consulter le défilement des messages lors du démarrage en appuyant sur la touche < | **A retenir** : Il est possible de consulter le défilement des messages lors du démarrage en appuyant sur la touche < | ||
</ | </ | ||
Ligne 119: | Ligne 83: | ||
* Lancer le **Charger de Démarrage** du système d' | * Lancer le **Charger de Démarrage** du système d' | ||
- | ===Charger | + | ===Chargeur |
- | La première partie du Charger | + | La première partie du Chargeur |
* 446 octets pour le Charger de Démarrage, | * 446 octets pour le Charger de Démarrage, | ||
Ligne 135: | Ligne 99: | ||
Pour que EFI fonctionne, le micrologiciel (**firmware**) d'EFI doit avoir connaissance de chaque système d' | Pour que EFI fonctionne, le micrologiciel (**firmware**) d'EFI doit avoir connaissance de chaque système d' | ||
- | <WRAP center round tip> | + | <WRAP center round tip 60%> |
**A retenir** : Sous Linux c'est l' | **A retenir** : Sous Linux c'est l' | ||
</ | </ | ||
- | <WRAP center round important> | + | <WRAP center round important |
- | **Important** : L'UEFI gère parfaitement | + | **Important** : L'UEFI gère les **SSD** (//Solid State Drives//) qui utilisent le standard **NVMe** (// |
</ | </ | ||
Ligne 149: | Ligne 113: | ||
=====Gestionnaires de Démarrage===== | =====Gestionnaires de Démarrage===== | ||
- | Des gestionnaires d' | + | ====GRUB 2==== |
- | + | ||
- | * GRUB (Grand Unified Boot Loader) | + | |
- | + | ||
- | Cependant il en existe d' | + | |
- | + | ||
- | * LILO (LInux LOader) | + | |
- | * %%SysLinux%% | + | |
- | * %%LoadLin%% | + | |
- | * ... | + | |
- | + | ||
- | ====LILO==== | + | |
- | + | ||
- | LILO (//LInux LOader//) est configuré par le fichier **/ | + | |
- | + | ||
- | ===La Commande LILO=== | + | |
- | + | ||
- | La commande **lilo** peut prendre une de plusieurs options. Les options les plus importantes sont : | + | |
- | + | ||
- | ^ Option ^ Description ^ | + | |
- | | -M | Permet d' | + | |
- | | -d | Permet de réduire ou augmenter le temps d' | + | |
- | | -D | Permet de sélectionner un noyau par défaut en indiquant son label | | + | |
- | | -u | Permet de désinstaller LILO | | + | |
- | | -v | Permet d' | + | |
- | | -m | Permet de modifier le fichier map par défaut (/boot/map) | | + | |
- | | -i | Permet de spécifier un nouveau fichier à utiliser comme secteur de boot (/ | + | |
- | | -C | Permet de modifier le fichier de configuration par défaut | | + | |
- | | -q | Permet de créer le fichier /boot/map qui contient l' | + | |
- | + | ||
- | ===Codes Erreur de LILO=== | + | |
- | + | ||
- | Lors du démarrage, LILO permet d' | + | |
- | + | ||
- | ^ Affichage ^ Erreur | + | |
- | | (rien) | Aucun morceau de LILO n'a été chargé. Soit LILO n'est pas installé, soit la partition sur laquelle son secteur d' | + | |
- | | L | Le premier morceau du chargeur d' | + | |
- | | LI | Le premier morceau du chargeur d' | + | |
- | | LIL | Le second morceau du chargeur d' | + | |
- | | LIL? | Le second morceau du chargeur d' | + | |
- | | LIL- | La table de descripteurs est corrompue. Cela peut être dû à une incohérence de géométrie ou au déplacement de /boot/map sans lancer l' | + | |
- | | LILO | Tous les éléments de LILO ont été correctement chargés. | | + | |
- | + | ||
- | Si le BIOS signale une erreur lorsque LILO essaye de charger une image d' | + | |
- | + | ||
- | <WRAP center round important> | + | |
- | **Important** : LILO ne gère pas les systèmes UEFI. | + | |
- | </ | + | |
- | + | ||
- | ====Grub Legacy sous RHEL/CentOS 6==== | + | |
- | + | ||
- | <WRAP center round tip> | + | |
- | **A retenir** : Grub Legacy a été créé en **1999**. | + | |
- | </ | + | |
- | + | ||
- | Dans le cas où le Charger de Démarrage **grub** n'est pas installé, il convient de saisir la commande suivante : | + | |
- | + | ||
- | # grub-install /dev/sda [Entrée] | + | |
- | + | ||
- | où **sda** est le nom du périphérique ou grub doit s' | + | |
- | + | ||
- | Il est aussi possible d' | + | |
- | + | ||
- | # grub-install ' | + | |
- | + | ||
- | où **hd0** indique à grub le premier disque. | + | |
- | + | ||
- | Il est à noter que la première partie du Charger de Démarrage peut également être installé dans un **PBR** (// | + | |
- | + | ||
- | # grub-install /dev/sda1 [Entrée] | + | |
- | + | ||
- | ou : | + | |
- | + | ||
- | # grub-install ' | + | |
- | + | ||
- | où **(0,0)** est la nomenclature grub pour la première partition du premier disque. | + | |
- | + | ||
- | Le gestionnaire de niveau 1 a pour seul but le lancement du gestionnaire de niveau 2. Le gestionnaire de niveau 2 charge le noyau en mémoire, monte l' | + | |
- | + | ||
- | Pour désinstaller grub du MBR, utilisez une disquette DOS pour démarrer la machine puis taper la commande suivante au prompt : | + | |
- | + | ||
- | A> fdisk /mbr [Entrée] | + | |
- | + | ||
- | ===Configurer GRUB Legacy=== | + | |
- | + | ||
- | **grub** se configure grâce au fichier **/ | + | |
- | + | ||
- | < | + | |
- | [root@centos6 ~]# cat / | + | |
- | # grub.conf generated by anaconda | + | |
- | # | + | |
- | # Note that you do not have to rerun grub after making changes to this file | + | |
- | # NOTICE: | + | |
- | # all kernel and initrd paths are relative to /boot/, eg. | + | |
- | # root (hd0,0) | + | |
- | # kernel / | + | |
- | # initrd / | + | |
- | # | + | |
- | default=0 | + | |
- | timeout=5 | + | |
- | splashimage=(hd0, | + | |
- | hiddenmenu | + | |
- | title CentOS Linux (2.6.32-71.29.1.el6.i686) | + | |
- | root (hd0,0) | + | |
- | kernel / | + | |
- | initrd / | + | |
- | title centos (2.6.32-71.el6.i686) | + | |
- | root (hd0,0) | + | |
- | kernel / | + | |
- | initrd / | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important> | + | |
- | **Important** : Sous les distributions dérivées de Red Hat, par exemple Fedora, le fichier menu.lst s' | + | |
- | </ | + | |
- | + | ||
- | Ce fichier comporte plusieurs sections : | + | |
- | + | ||
- | * la section des **paramètres globaux**, | + | |
- | * une ou plusieurs sections pour chaque système d' | + | |
- | + | ||
- | ==La Section Globale== | + | |
- | + | ||
- | ^ Paramètre ^ Explication ^ | + | |
- | | default=0 | Ce paramètre désigne le numéro de l' | + | |
- | | timeout=5 | Ce paramètre indique le délai en secondes après lequel l' | + | |
- | | splashimage=(hd0, | + | |
- | | hiddenmenu | Ce paramètre cache le menu de GRUB Legacy pendant le chargement de l' | + | |
- | | color | Ce paramètre prend la forme de deux pairs de couleurs. Le premier, par exemple white/blue, définit les couleurs de l' | + | |
- | | password=motdepasse | Cette option n'est présente que dans le cas où un mot de passe a été spécifié pour protéger GRUB Legacy | | + | |
- | + | ||
- | ==Une Section spécifique à un OS== | + | |
- | + | ||
- | ^ Paramètre ^ Explication ^ | + | |
- | | title CentOS Linux (2.6.32-71.29.1.el6.i686) | Ce paramètre indique le début d'une section de configuration d'une entrée pour un système d' | + | |
- | | root (hd0,0) | Ce paramètre indique la partition contenant le noyau de Linux. Dans l' | + | |
- | | kernel / | + | |
- | | initrd | Ce paramètre stipule l' | + | |
- | | lock | Ce paramètre indique que que la section est protégée par le mot de passe définit dans les paramètres globaux | + | |
- | | rootnoverify (hd0,1) | Ce paramètre indique une section concernant un système d' | + | |
- | + | ||
- | ===Configurer l' | + | |
- | + | ||
- | Grub Legacy peut être protéger par un mot de passe en incluant la directive suivante dans le fichier / | + | |
- | + | ||
- | password --md5 <mot de passe> | + | |
- | + | ||
- | Le mot de passe doit être chiffré avec MD5 : | + | |
- | + | ||
- | < | + | |
- | [root@centos6 ~]# grub-md5-crypt | + | |
- | Password: | + | |
- | Retype password: | + | |
- | $1$VLOzG$ibdk0my4IHny/ | + | |
- | </ | + | |
- | + | ||
- | Editez ensuite le fichier **/ | + | |
- | + | ||
- | < | + | |
- | [root@centos6 ~]# cat / | + | |
- | # grub.conf generated by anaconda | + | |
- | # | + | |
- | # Note that you do not have to rerun grub after making changes to this file | + | |
- | # NOTICE: | + | |
- | # all kernel and initrd paths are relative to /boot/, eg. | + | |
- | # root (hd0,0) | + | |
- | # kernel / | + | |
- | # initrd / | + | |
- | # | + | |
- | default=0 | + | |
- | timeout=5 | + | |
- | password --md5 $1$VLOzG$ibdk0my4IHny/ | + | |
- | splashimage=(hd0, | + | |
- | hiddenmenu | + | |
- | title CentOS (2.6.32-504.1.3.el6.i686) | + | |
- | lock | + | |
- | root (hd0,0) | + | |
- | kernel / | + | |
- | initrd / | + | |
- | title CentOS (2.6.32-358.18.1.el6.i686) | + | |
- | lock | + | |
- | root (hd0,0) | + | |
- | kernel / | + | |
- | initrd / | + | |
- | title CentOS (2.6.32-358.6.1.el6.i686) | + | |
- | lock | + | |
- | root (hd0,0) | + | |
- | kernel / | + | |
- | initrd / | + | |
- | title CentOS (2.6.32-279.el6.i686) | + | |
- | lock | + | |
- | root (hd0,0) | + | |
- | kernel / | + | |
- | initrd / | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important> | + | |
- | **Important** : Notez l' | + | |
- | </ | + | |
- | + | ||
- | ===Modifier la Configuration de GRUB Legacy en Ligne de Commande=== | + | |
- | + | ||
- | Lors du démarrage de GRUB Legacy, il est possible de voir son menu en appuyant sur n' | + | |
- | + | ||
- | * la touche **e** pour accéder à l' | + | |
- | * la touche **c** pour accéder à la ligne de commande. | + | |
- | + | ||
- | En mode édition notez l' | + | |
- | + | ||
- | * **e** : éditer une ligne, | + | |
- | * **d** : supprimer une ligne, | + | |
- | * **o** : ajouter une ligne après la ligne courante, | + | |
- | * **O** : ajouter une ligne avant la ligne courante, | + | |
- | * **b** : démarrer avec la configuration modifiée, | + | |
- | * **echap** : abandonner les modifications et retourner à l' | + | |
- | + | ||
- | ====GRUB 2 sous RHEL/CentOS 7==== | + | |
GRUB 2 est une ré-écriture complète de GRUB Legacy. Il apporte des améliorations, | GRUB 2 est une ré-écriture complète de GRUB Legacy. Il apporte des améliorations, | ||
Ligne 384: | Ligne 132: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
# | # | ||
# DO NOT EDIT THIS FILE | # DO NOT EDIT THIS FILE | ||
Ligne 395: | Ligne 143: | ||
set pager=1 | set pager=1 | ||
- | if [ -s $prefix/ | + | if [ -f ${config_directory}/ |
+ | load_env -f ${config_directory}/ | ||
+ | elif [ -s $prefix/ | ||
load_env | load_env | ||
fi | fi | ||
Ligne 454: | Ligne 204: | ||
fi | fi | ||
### END / | ### END / | ||
+ | |||
+ | ### BEGIN / | ||
+ | set tuned_params="" | ||
+ | set tuned_initrd="" | ||
+ | ### END / | ||
+ | |||
+ | ### BEGIN / | ||
+ | if [ " | ||
+ | set last_boot_ok=1 | ||
+ | else | ||
+ | set last_boot_ok=0 | ||
+ | fi | ||
+ | |||
+ | # Reset boot_indeterminate after a successful boot | ||
+ | if [ " | ||
+ | set boot_indeterminate=0 | ||
+ | # Avoid boot_indeterminate causing the menu to be hidden more then once | ||
+ | elif [ " | ||
+ | set boot_indeterminate=2 | ||
+ | fi | ||
+ | set boot_success=0 | ||
+ | save_env boot_success boot_indeterminate | ||
+ | |||
+ | if [ x$feature_timeout_style = xy ] ; then | ||
+ | if [ " | ||
+ | unset menu_show_once | ||
+ | save_env menu_show_once | ||
+ | set timeout_style=menu | ||
+ | set timeout=60 | ||
+ | elif [ " | ||
+ | set orig_timeout_style=${timeout_style} | ||
+ | set orig_timeout=${timeout} | ||
+ | if [ " | ||
+ | # timeout_style=menu + timeout=0 avoids the countdown code keypress check | ||
+ | set timeout_style=menu | ||
+ | set timeout=0 | ||
+ | else | ||
+ | set timeout_style=hidden | ||
+ | set timeout=1 | ||
+ | fi | ||
+ | fi | ||
+ | fi | ||
+ | ### END / | ||
+ | |||
+ | ### BEGIN / | ||
+ | if [ -f ${prefix}/ | ||
+ | source ${prefix}/ | ||
+ | if [ -n " | ||
+ | set superusers=" | ||
+ | export superusers | ||
+ | password_pbkdf2 root ${GRUB2_PASSWORD} | ||
+ | fi | ||
+ | fi | ||
+ | ### END / | ||
### BEGIN / | ### BEGIN / | ||
- | menuentry ' | + | insmod part_msdos |
- | load_video | + | insmod |
- | set gfxpayload=keep | + | set root=' |
- | insmod gzio | + | if [ x$feature_platform_search_hint = xy ]; then |
- | insmod part_msdos | + | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, |
- | insmod | + | else |
- | set root=' | + | search --no-floppy --fs-uuid --set=root |
- | if [ x$feature_platform_search_hint = xy ]; then | + | fi |
- | | + | insmod part_msdos |
- | else | + | insmod |
- | | + | set boot=' |
- | fi | + | if [ x$feature_platform_search_hint = xy ]; then |
- | linux16 / | + | search --no-floppy --fs-uuid --set=boot --hint-bios=hd0, |
- | initrd16 / | + | else |
- | } | + | search --no-floppy --fs-uuid --set=boot 2ae4c035-9244-458c-82c5-a49ae169cdb6 |
- | menuentry ' | + | fi |
- | load_video | + | |
- | set gfxpayload=keep | + | # This section was generated by a script. Do not modify the generated file - all changes |
- | insmod gzio | + | # will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files. |
- | insmod part_msdos | + | # |
- | insmod | + | # The blscfg command parses the BootLoaderSpec files stored in / |
- | set root=' | + | # populates the boot menu. Please refer to the Boot Loader Specification documentation |
- | if [ x$feature_platform_search_hint = xy ]; then | + | # for the files format: https://www.freedesktop.org/ |
- | | + | |
- | else | + | set default_kernelopts="root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 |
- | | + | |
- | fi | + | insmod blscfg |
- | linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=b35de665-5ec8-4226-a533-58a1b567ac91 ro vconsole.keymap=fr crashkernel=auto | + | blscfg |
- | initrd16 | + | |
- | } | + | |
- | menuentry ' | + | |
- | load_video | + | |
- | insmod gzio | + | |
- | insmod part_msdos | + | |
- | insmod xfs | + | |
- | set root=' | + | |
- | if [ x$feature_platform_search_hint = xy ]; then | + | |
- | search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0, | + | |
- | else | + | |
- | search --no-floppy --fs-uuid --set=root e8d3bd48-1386-411c-9675-41c3f8f1a309 | + | |
- | fi | + | |
- | linux16 / | + | |
- | initrd16 / | + | |
- | } | + | |
- | if [ " | + | |
### END / | ### END / | ||
Ligne 511: | Ligne 298: | ||
### BEGIN / | ### BEGIN / | ||
### END / | ### END / | ||
+ | |||
+ | ### BEGIN / | ||
+ | ### END / | ||
### BEGIN / | ### BEGIN / | ||
Ligne 527: | Ligne 317: | ||
</ | </ | ||
- | Prenons le cas des paramètres de Grub Legacy et comparons-les aux paramètres de GRUB 2 : | + | Notez que ce fichier ne doit pas être modifié manuellement. En effet, il est généré par la commande **grub2-mkconfig**. La commande grub2-mkconfig prend en argument l' |
- | + | ||
- | ^ Grub Legacy ^ GRUB 2 ^ | + | |
- | | title | Menuentry | | + | |
- | | root (hd0,0) | set root=hd(0, | + | |
- | | kernel | linux | | + | |
- | | initrd | initrd | | + | |
- | | lock | Ce paramètre n' | + | |
- | | rootnoverify (hd0,1) | Ce paramètre n' | + | |
- | + | ||
- | Notez que ce fichier ne doit pas être modifié manuellement. En effet, il est généré par la commande **grub2-mkconfig** | + | |
* grub2-mkconfig -o / | * grub2-mkconfig -o / | ||
Ligne 547: | Ligne 327: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
# this device map was generated by anaconda | # this device map was generated by anaconda | ||
(hd0) /dev/sda | (hd0) /dev/sda | ||
Ligne 558: | Ligne 338: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
GRUB_TIMEOUT=5 | GRUB_TIMEOUT=5 | ||
GRUB_DISTRIBUTOR=" | GRUB_DISTRIBUTOR=" | ||
Ligne 564: | Ligne 344: | ||
GRUB_DISABLE_SUBMENU=true | GRUB_DISABLE_SUBMENU=true | ||
GRUB_TERMINAL_OUTPUT=" | GRUB_TERMINAL_OUTPUT=" | ||
- | GRUB_CMDLINE_LINUX=" | + | GRUB_CMDLINE_LINUX=" |
GRUB_DISABLE_RECOVERY=" | GRUB_DISABLE_RECOVERY=" | ||
+ | GRUB_ENABLE_BLSCFG=true | ||
</ | </ | ||
- | + | <WRAP center round important | |
- | <WRAP center round important> | + | **Important** : Notez que toute modification de ce fichier nécessite l' |
- | **Important** : Notez que toute modification de ce fichier nécessite l' | + | |
</ | </ | ||
Ligne 576: | Ligne 356: | ||
^ Directive | ^ Directive | ||
- | | GRUB_DEFAULT | Entrée du menu sélectionner par défaut | | ||
| GRUB_TIMEOUT | Durée de l' | | GRUB_TIMEOUT | Durée de l' | ||
| GRUB_DISTRIBUTOR | Ligne de commande qui génère le texte de l' | | GRUB_DISTRIBUTOR | Ligne de commande qui génère le texte de l' | ||
- | | GRUB_CMDLINE_LINUX_DEFAULT | + | | GRUB_DEFAULT |
+ | | GRUB_DISABLE_SUBMENU | Active ou désactive les sous-menus de GRUB2 | | ||
+ | | GRUB_TERMINAL_OUTPUT | Spécifie | ||
| GRUB_CMDLINE_LINUX | Paramètres passés au noyau peu importe le type de démarrage | | | GRUB_CMDLINE_LINUX | Paramètres passés au noyau peu importe le type de démarrage | | ||
- | | GRUB_TERMINAL | + | | GRUB_DISABLE_RECOVERY |
- | | GRUB_GFXMODE | Indique la résolution utilisée lors d'un démarrage graphique | | + | | GRUB_BLSCFG |
- | | GRUB_DISABLE_LINUX_UUID | Si **true**, cette directive empêche l' | + | |
- | | GRUB_DISABLE_LINUX_RECOVERY | Si **true**, cette directive empêche | + | |
- | | GRUB_INIT_TUNE | + | |
- | | GRUB_BADRAM | Permet | + | |
===Les fichiers du répertoire / | ===Les fichiers du répertoire / | ||
Ligne 593: | Ligne 370: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | total 68 | + | total 92 |
- | -rwxr-xr-x. 1 root root | + | -rwxr-xr-x. 1 root root |
- | -rwxr-xr-x. 1 root root 992 Oct 17 2014 00_tuned | + | -rwxr-xr-x. 1 root root |
- | -rwxr-xr-x. 1 root root 10114 Mar 26 09:27 10_linux | + | -rwxr-xr-x. 1 root root 232 Mar 2 15:51 01_users |
- | -rwxr-xr-x. 1 root root 10275 Mar 26 09:27 20_linux_xen | + | -rwxr-xr-x. 1 root root 832 Mar 2 15:51 08_fallback_counting |
- | -rwxr-xr-x. 1 root root 2559 Mar 26 09:27 20_ppc_terminfo | + | -rwxr-xr-x. 1 root root 14088 Mar 2 15:51 10_linux |
- | -rwxr-xr-x. 1 root root 11169 Mar 26 09:27 30_os-prober | + | -rwxr-xr-x. 1 root root 830 Mar 2 15:51 10_reset_boot_success |
- | -rwxr-xr-x. 1 root root 214 Mar 26 09:27 40_custom | + | -rwxr-xr-x. 1 root root 889 Mar 2 15:51 12_menu_auto_hide |
- | -rwxr-xr-x. 1 root root 216 Mar 26 09:27 41_custom | + | -rwxr-xr-x. 1 root root 11696 Mar 2 15:51 20_linux_xen |
- | -rw-r--r--. 1 root root 483 Mar 26 09:27 README | + | -rwxr-xr-x. 1 root root 2559 Mar 2 15:51 20_ppc_terminfo |
+ | -rwxr-xr-x. 1 root root 10670 Mar 2 15:51 30_os-prober | ||
+ | -rwxr-xr-x. 1 root root 1412 Mar 2 15:51 30_uefi-firmware | ||
+ | -rwxr-xr-x. 1 root root 214 Mar 2 15:51 40_custom | ||
+ | -rwxr-xr-x. 1 root root 216 Mar 2 15:51 41_custom | ||
+ | -rw-r--r--. 1 root root 483 Mar 2 15:51 README | ||
</ | </ | ||
Ligne 613: | Ligne 395: | ||
* Ces deux fichiers sont fournis en tant que modèles à personnaliser. | * Ces deux fichiers sont fournis en tant que modèles à personnaliser. | ||
- | ===Configurer l' | + | ===Le Fichier / |
- | ==RHEL/CentOS < 7.2== | + | Le fichier **/boot/ |
- | + | ||
- | Pour configurer | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | [root@centos7 | + | # GRUB Environment Block |
+ | saved_entry=de79af4f226d480fa7d3fec4cabbf97a-4.18.0-240.22.1.el8_3.x86_64 | ||
+ | kernelopts=root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet | ||
+ | boot_success=1 | ||
+ | boot_indeterminate=0 | ||
+ | ########################################################################################################################################## | ||
+ | ########################################################################################################################################## | ||
+ | ########################################################################################################################################## | ||
+ | ########################################################################################################################################## | ||
+ | ########################################################################################################################################## | ||
+ | ############################################################ | ||
</ | </ | ||
- | |||
- | Créez deux mots de passe hashés au format **[[https:// | ||
- | |||
- | < | ||
- | [root@centos7 ~]# grub2-mkpasswd-pbkdf2 | ||
- | Enter password: pass123 | ||
- | Reenter password: pass123 | ||
- | PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.0298C1C613A451C46FBC95BB2AC7A41BCEC1C61512EF785BD81E3B65DFF9D57ED4ADF8906C3EF33C22C06FBDD366E1C118FC41110BD646A4D49EF86EFD0573BF.E14A45900096D773BE99BEA9AB8D4FA81431458952798B997D4FC9E0850426F6798979371B8EBD331DB33AE8FEAE25E6773156D42F21B884DBA405546782B3BD | ||
- | </ | ||
- | |||
- | Editez le fichier **/ | ||
- | |||
- | <file txt / | ||
- | #!/bin/sh -e | ||
- | cat <<EOF | ||
- | set superusers=" | ||
- | password_pbkdf2 root | ||
- | grub.pbkdf2.sha512.10000.0298C1C613A451C46FBC95BB2AC7A41BCEC1C61512EF785BD81E3B65DFF9D57ED4ADF8906C3EF33C22C06FBDD366E1C118FC41110BD646A4D49EF86EFD0573BF.E14A45900096D773BE99BEA9AB8D4FA81431458952798B997D4FC9E0850426F6798979371B8EBD331DB33AE8FEAE25E6773156D42F21B884DBA405546782B3BD | ||
- | EOF | ||
- | </ | ||
- | |||
- | Il est aussi possible d' | ||
- | |||
- | <file txt / | ||
- | #!/bin/sh -e | ||
- | cat <<EOF | ||
- | set superusers=" | ||
- | password root pass123 | ||
- | EOF | ||
- | </ | ||
- | |||
- | Sous RHEL/ | ||
- | |||
- | < | ||
- | [root@centos7 ~]# grub2-mkconfig -o / | ||
- | Generating grub configuration file ... | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | done | ||
- | </ | ||
- | |||
- | <WRAP center round todo> | ||
- | **A faire** : Redémarrez votre VM. Constatez que GRUB 2 demande un nom d' | ||
- | </ | ||
- | |||
- | ==RHEL/ | ||
- | |||
- | Depuis la version 7.2 de RHEL/centOS le fichier **/ | ||
- | |||
- | < | ||
- | [root@centos7 ~]# cat / | ||
- | #!/bin/sh -e | ||
- | cat << EOF | ||
- | if [ -f \${prefix}/ | ||
- | source \${prefix}/ | ||
- | if [ -n " | ||
- | set superusers=" | ||
- | export superusers | ||
- | password_pbkdf2 root \${GRUB2_PASSWORD} | ||
- | fi | ||
- | fi | ||
- | EOF | ||
- | </ | ||
- | |||
- | Ce script est évidement présent dans le fichier **grub.cfg** : | ||
- | |||
- | < | ||
- | ### BEGIN / | ||
- | if [ -f ${prefix}/ | ||
- | source ${prefix}/ | ||
- | if [ -n ${GRUB2_PASSWORD} ]; then | ||
- | set superusers=" | ||
- | export superusers | ||
- | password_pbkdf2 root ${GRUB2_PASSWORD} | ||
- | fi | ||
- | fi | ||
- | ### END / | ||
- | </ | ||
- | |||
- | Ce script : | ||
- | |||
- | * teste si le fichier **/ | ||
- | * teste si la variable $GRUB2_PASSWORD est fixée puis si c'est le cas, | ||
- | * assigne le mot de passe à root. | ||
- | |||
- | Pour créer le contenu du fichier **/ | ||
- | |||
- | < | ||
- | [root@centos7 ~]# grub2-setpassword | ||
- | Enter password: pass123 | ||
- | Confirm password: pass123 | ||
- | </ | ||
- | |||
- | Consultez maintenant le fichier **/ | ||
- | |||
- | < | ||
- | [root@centos7 ~]# cat / | ||
- | GRUB2_PASSWORD=grub.pbkdf2.sha512.10000.3DD268A626FC781A0693D381A5F1BBDE6C834D1D904F023AED8CEF2985304FEC9F0C1C8B975156F5DF534F4B10BCCDC5C187B0C12F55E970A244D9EF2EF962DD.9BB2011598B8E5EFD9A464ED96C0FECB8DCD8FD6942E5114E035AD8A9E2DCFF32A9DC1C222B4226A462B32E7B6D80247F96D79133F18F6524544984837EF4D06 | ||
- | </ | ||
- | |||
- | <WRAP center round todo> | ||
- | **A faire** : Redémarrez votre VM. Appuyez sur la touche **e** au début du processus de démarrage. Constatez que GRUB 2 demande un nom d' | ||
- | </ | ||
- | |||
- | Pour pouvoir protéger le démarrage du système, il convient d' | ||
- | |||
- | < | ||
- | [root@centos7 ~]# cat / | ||
- | ... | ||
- | ### BEGIN / | ||
- | menuentry ' | ||
- | load_video | ||
- | set gfxpayload=keep | ||
- | insmod gzio | ||
- | insmod part_msdos | ||
- | insmod xfs | ||
- | set root=' | ||
- | if [ x$feature_platform_search_hint = xy ]; then | ||
- | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, | ||
- | else | ||
- | search --no-floppy --fs-uuid --set=root 2d947276-66e8-41f4-8475-b64b67d7a249 | ||
- | fi | ||
- | linux16 / | ||
- | initrd16 / | ||
- | } | ||
- | ... | ||
- | </ | ||
- | |||
- | < | ||
- | [root@centos7 ~]# vi / | ||
- | ... | ||
- | ### BEGIN / | ||
- | menuentry ' | ||
- | load_video | ||
- | set gfxpayload=keep | ||
- | insmod gzio | ||
- | insmod part_msdos | ||
- | insmod xfs | ||
- | set root=' | ||
- | if [ x$feature_platform_search_hint = xy ]; then | ||
- | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, | ||
- | else | ||
- | search --no-floppy --fs-uuid --set=root 2d947276-66e8-41f4-8475-b64b67d7a249 | ||
- | fi | ||
- | linux16 / | ||
- | initrd16 / | ||
- | } | ||
- | ... | ||
- | </ | ||
- | |||
- | <WRAP center round todo> | ||
- | **A faire** : Redémarrez votre VM. Constatez que GRUB 2 demande un nom d' | ||
- | </ | ||
- | |||
===Modifier la Configuration de GRUB 2 en Ligne de Commande=== | ===Modifier la Configuration de GRUB 2 en Ligne de Commande=== | ||
Ligne 795: | Ligne 427: | ||
* **Crtl-X** : démarrer avec la configuration modifiée, | * **Crtl-X** : démarrer avec la configuration modifiée, | ||
* **echap** : abandonner les modifications et retourner à l' | * **echap** : abandonner les modifications et retourner à l' | ||
- | |||
- | <WRAP center round important> | ||
- | **Important** : Certaines distributions, | ||
- | </ | ||
====Chargeurs de Démarrages Alternatifs==== | ====Chargeurs de Démarrages Alternatifs==== | ||
Ligne 838: | Ligne 466: | ||
Un Chargeur de Démarrage hybride, appelé **isodhpfx.bin**, | Un Chargeur de Démarrage hybride, appelé **isodhpfx.bin**, | ||
+ | ====Initramfs==== | ||
- | ====Initramfs sous RHEL/CentOS 6==== | + | Le fichier Initramfs //%%INITial Ram File System%%// est une archive |
- | + | ||
- | Un fichier Initramfs //%%INITial Ram File System%%// est une image d'un système minimal initialisée au démarrage du système. | + | |
- | + | ||
- | Ce fichier utilise le système de fichier **cramFS** qui est un système de fichier compressé | + | |
- | + | ||
- | L' | + | |
- | + | ||
- | ===Examiner l' | + | |
- | + | ||
- | Pour examiner une image initramfs, il convient d' | + | |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | [root@centos6 | + | [root@centos8 |
- | </ | + | [root@centos8 tmp]# ls |
+ | cpio.list | ||
+ | custom | ||
+ | dateref | ||
+ | incremental.tar | ||
+ | mbr.save | ||
+ | systemd-private-9af7a2f7444849578f55b306bfd9f820-chronyd.service-iQiNzF | ||
+ | tblpart.save | ||
+ | test.cpio | ||
+ | test.print | ||
+ | test.tar | ||
+ | tmp.iso | ||
+ | vg0_backup | ||
- | Ensuite il convient d' | + | [root@centos8 tmp]# mv custom custom.gz |
- | < | + | [root@centos8 |
- | [root@centos6 ~]# cd /tmp | + | |
- | [root@centos6 | + | |
- | [root@centos6 tmp]# cd initrd | + | |
- | [root@centos6 initrd]# cpio -cid -I ../custom | + | |
- | 59631 blocs | + | |
- | </ | + | |
- | Installez maintenant le paquet **tree** : | + | [root@centos8 tmp]# mkdir initramfs |
- | < | + | [root@centos8 tmp]# cd initramfs |
- | [root@centos6 initrd]# yum install tree | + | |
- | </ | + | |
- | Utilisez maintenant la commande **tree** pour examiner le contenu de l' | + | [root@centos8 |
- | + | 216 blocks | |
- | < | + | [root@centos8 |
- | [root@centos6 initrd]# tree | more | + | |
- | . | + | |
- | ├── bin | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | │ | + | |
- | ├── cmdline | + | |
- | --Plus-- | + | |
- | </ | + | |
- | + | ||
- | Comme vous pouvez le constater, l' | + | |
- | + | ||
- | < | + | |
- | [root@centos6 initrd]# ls | + | |
- | bin dev emergency | + | |
- | cmdline | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round todo> | + | |
- | **A faire** : Utilisez le manuel de la commande **cpio** pour comprendre les options utilisées. | + | |
- | </ | + | |
- | + | ||
- | ===Le script init=== | + | |
- | + | ||
- | Le script **init** est lancé lors du chargement de l' | + | |
- | + | ||
- | < | + | |
- | [root@centos6 initrd]# more init | + | |
- | #!/bin/sh | + | |
- | # | + | |
- | # Licensed under the GPLv2 | + | |
- | # | + | |
- | # Copyright 2008-2009, Red Hat, Inc. | + | |
- | # Harald Hoyer < | + | |
- | # Jeremy Katz < | + | |
- | + | ||
- | wait_for_loginit() | + | |
- | { | + | |
- | if getarg rdinitdebug; | + | |
- | set +x | + | |
- | exec 0<>/ | + | |
- | # wait for loginit | + | |
- | i=0 | + | |
- | while [ $i -lt 10 ]; do | + | |
- | j=$(jobs) | + | |
- | [ -z " | + | |
- | [ -z " | + | |
- | sleep 0.1 | + | |
- | i=$(($i+1)) | + | |
- | done | + | |
- | [ $i -eq 10 ] && kill %1 >/ | + | |
- | + | ||
- | while pidof -x / | + | |
- | for pid in $(pidof -x / | + | |
- | kill $HARD $pid >/ | + | |
- | done | + | |
- | --Plus--(8%) | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round todo> | + | |
- | **A faire** : Passez en revue le contenu du script. | + | |
- | </ | + | |
- | + | ||
- | ===La Commande dracut=== | + | |
- | + | ||
- | La commande **dracut** permet de créer facilement une image initramfs. Les options de la commande sont : | + | |
- | + | ||
- | < | + | |
- | [root@centos6 initrd]# dracut --help | + | |
- | Usage: / | + | |
- | Creates initial ramdisk images for preloading modules | + | |
- | + | ||
- | -f, --force | + | |
- | -m, --modules [LIST] | + | |
- | call when building the initramfs. Modules are located | + | |
- | in / | + | |
- | -o, --omit [LIST] | + | |
- | -a, --add [LIST] | + | |
- | -d, --drivers [LIST] | + | |
- | exclusively include in the initramfs. | + | |
- | --add-drivers [LIST] | + | |
- | modules to add to the initramfs. | + | |
- | --filesystems [LIST] | + | |
- | modules to exclusively include in the generic | + | |
- | initramfs. | + | |
- | -k, --kmoddir [DIR] | + | |
- | modules | + | |
- | --fwdir [DIR] | + | |
- | firmwares, separated by : | + | |
- | --kernel-only | + | |
- | --no-kernel | + | |
- | --strip | + | |
- | --nostrip | + | |
- | --mdadmconf | + | |
- | --nomdadmconf | + | |
- | --lvmconf | + | |
- | --nolvmconf | + | |
- | -h, --help | + | |
- | --debug | + | |
- | -v, --verbose | + | |
- | -c, --conf [FILE] | + | |
- | | + | |
- | -l, --local | + | |
- | | + | |
- | / | + | |
- | | + | |
- | -H, --hostonly | + | |
- | | + | |
- | -i, --include [SOURCE] [TARGET] | + | |
- | Include the files in the SOURCE directory into the | + | |
- | | + | |
- | -I, --install [LIST] | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | Le fichier de configuration de dracut est **/ | + | |
- | + | ||
- | < | + | |
- | [root@centos6 initrd]# cat / | + | |
- | # Sample dracut config file | + | |
- | + | ||
- | # Specific list of dracut modules to use | + | |
- | # | + | |
- | + | ||
- | # Dracut modules to omit | + | |
- | # | + | |
- | + | ||
- | # Dracut modules to add to the default | + | |
- | # | + | |
- | + | ||
- | # additional kernel modules to the default | + | |
- | add_drivers+="" | + | |
- | + | ||
- | # list of kernel filesystem modules to be included in the generic initramfs | + | |
- | # | + | |
- | + | ||
- | # build initrd only to boot current hardware | + | |
- | # | + | |
- | # | + | |
- | + | ||
- | # install local / | + | |
- | mdadmconf=" | + | |
- | + | ||
- | # install local / | + | |
- | lvmconf=" | + | |
- | </ | + | |
- | + | ||
- | Exécutez maintenant la commande suivante afin de générer le fichier **initramfs** : | + | |
- | + | ||
- | # dracut -v initramfs [Entrée] | + | |
- | + | ||
- | Notez la présence de votre nouvelle image **/ | + | |
- | + | ||
- | Déplacez votre fichier initramfs au répertoire /boot : | + | |
- | + | ||
- | < | + | |
- | [root@centos6 initrd]# mv initramfs /boot | + | |
- | </ | + | |
- | + | ||
- | Editez maintenant votre fichier **/ | + | |
- | + | ||
- | < | + | |
- | ... | + | |
- | splashimage=(hd0, | + | |
- | hiddenmenu | + | |
- | title CentOS Linux (initramfs) | + | |
- | root (hd0,0) | + | |
- | kernel / | + | |
- | initrd / | + | |
- | title CentOS Linux (2.6.32-71.29.1.el6.i686) | + | |
- | ... | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | <WRAP center round todo> | + | |
- | **A faire** : **Re-démarrez votre machine pour tester votre configuration.** | + | |
- | </ | + | |
- | + | ||
- | ====Initramfs sous RHEL/CentOS 7==== | + | |
- | + | ||
- | Le fichier Initramfs //%%INITial Ram File System%%// est une archive au format cpio compressé : | + | |
- | + | ||
- | < | + | |
- | [root@centos7 ~]# cp / | + | |
- | [root@centos7 ~]# cd /tmp | + | |
- | [root@centos7 tmp]# ls | + | |
- | custom | + | |
- | [root@centos7 tmp]# mv custom custom.gz | + | |
- | [root@centos7 tmp]# gunzip custom.gz | + | |
- | [root@centos7 tmp]# mkdir initramfs | + | |
- | [root@centos7 tmp]# cd initramfs | + | |
- | [root@centos7 | + | |
- | 113591 | + | |
- | [root@centos7 | + | |
bin dev etc init lib lib64 proc root run sbin shutdown | bin dev etc init lib lib64 proc root run sbin shutdown | ||
- | [root@centos7 initramfs]# ls -l | ||
- | total 4 | ||
- | lrwxrwxrwx. | ||
- | drwxr-xr-x. | ||
- | drwxr-xr-x. 11 root root 520 Dec 4 11:00 etc | ||
- | lrwxrwxrwx. | ||
- | lrwxrwxrwx. | ||
- | lrwxrwxrwx. | ||
- | drwxr-xr-x. | ||
- | drwxr-xr-x. | ||
- | drwxr-xr-x. | ||
- | lrwxrwxrwx. | ||
- | -rwxr-xr-x. | ||
- | drwxr-xr-x. | ||
- | drwxr-xr-x. | ||
- | drwxr-xr-x. | ||
- | drwxr-xr-x. | ||
- | drwxr-xr-x. | ||
</ | </ | ||
Ligne 1117: | Ligne 506: | ||
< | < | ||
- | [root@centos7 initramfs]# cd .. | + | [root@centos8 |
- | [root@centos7 | + | Image: custom: |
- | Image: custom: | + | ======================================================================== |
+ | Early CPIO image | ||
+ | ======================================================================== | ||
+ | drwxr-xr-x | ||
+ | -rw-r--r-- | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x | ||
+ | -rw-r--r-- | ||
======================================================================== | ======================================================================== | ||
- | Version: dracut-033-502.el7_4.1 | + | Version: dracut-049-95.git20200804.el8_3.4 |
- | Arguments: -f | + | Arguments: -f --kver ' |
dracut modules: | dracut modules: | ||
bash | bash | ||
+ | systemd | ||
+ | systemd-initrd | ||
nss-softokn | nss-softokn | ||
+ | rngd | ||
i18n | i18n | ||
+ | network-legacy | ||
network | network | ||
ifcfg | ifcfg | ||
drm | drm | ||
plymouth | plymouth | ||
+ | prefixdevname | ||
kernel-modules | kernel-modules | ||
- | qemu | + | kernel-modules-extra |
+ | kernel-network-modules | ||
resume | resume | ||
rootfs-block | rootfs-block | ||
Ligne 1140: | Ligne 543: | ||
udev-rules | udev-rules | ||
biosdevname | biosdevname | ||
- | systemd | + | dracut-systemd |
usrmount | usrmount | ||
base | base | ||
fs-lib | fs-lib | ||
+ | memstrack | ||
+ | microcode_ctl-fw_dir_override | ||
shutdown | shutdown | ||
======================================================================== | ======================================================================== | ||
- | drwxr-xr-x | + | drwxr-xr-x |
- | crw-r--r-- | + | crw-r--r-- |
- | crw-r--r-- | + | crw-r--r-- |
- | crw-r--r-- | + | crw-r--r-- |
- | lrwxrwxrwx | + | crw-r--r-- |
- | drwxr-xr-x | + | crw-r--r-- |
- | drwxr-xr-x | + | lrwxrwxrwx |
- | drwxr-xr-x | + | drwxr-xr-x |
- | drwxr-xr-x | + | drwxr-xr-x |
- | -rw-r--r-- | + | -rw-r--r-- |
- | -rw-r--r-- | + | drwxr-xr-x |
- | -rw-r--r-- | + | drwxr-xr-x |
+ | -rw-r--r-- | ||
--More-- | --More-- | ||
</ | </ | ||
- | |||
- | Comme vous pouvez le constater, l' | ||
===Le script init=== | ===Le script init=== | ||
- | Le script **init** est lancé lors du chargement de l' | + | RHEL/ |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | ... | + | lrwxrwxrwx |
- | lrwxrwxrwx. | + | |
- | ... | + | |
</ | </ | ||
Ligne 1179: | Ligne 581: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
include ld.so.conf.d/ | include ld.so.conf.d/ | ||
</ | </ | ||
- | |||
- | ===La Commande dracut=== | ||
- | |||
- | La commande **dracut** permet de créer facilement une image initramfs. Les options de la commande sont : | ||
- | |||
- | < | ||
- | [root@centos7 tmp]# dracut --help | ||
- | Usage: / | ||
- | |||
- | Version: 033-463.el7 | ||
- | |||
- | Creates initial ramdisk images for preloading modules | ||
- | |||
- | --kver [VERSION] | ||
- | -f, --force | ||
- | -a, --add [LIST] | ||
- | --rebuild | ||
- | -m, --modules [LIST] | ||
- | call when building the initramfs. Modules are located | ||
- | in / | ||
- | -o, --omit [LIST] | ||
- | --force-add [LIST] | ||
- | to the default set of modules, when -H is specified. | ||
- | -d, --drivers [LIST] | ||
- | | ||
- | --add-drivers [LIST] | ||
- | | ||
- | --omit-drivers [LIST] Specify a space-separated list of kernel | ||
- | | ||
- | --filesystems [LIST] | ||
- | | ||
- | | ||
- | -k, --kmoddir [DIR] | ||
- | | ||
- | --fwdir [DIR] | ||
- | | ||
- | --kernel-only | ||
- | --no-kernel | ||
- | --print-cmdline | ||
- | --early-microcode | ||
- | --no-early-microcode | ||
- | --kernel-cmdline [PARAMETERS] Specify default kernel command line parameters | ||
- | --strip | ||
- | --nostrip | ||
- | --prelink | ||
- | --noprelink | ||
- | --hardlink | ||
- | --nohardlink | ||
- | --prefix [DIR] Prefix initramfs files with [DIR] | ||
- | --noprefix | ||
- | --mdadmconf | ||
- | --nomdadmconf | ||
- | --lvmconf | ||
- | --nolvmconf | ||
- | --fscks [LIST] | ||
- | --nofscks | ||
- | --ro-mnt | ||
- | -h, --help | ||
- | --debug | ||
- | --profile | ||
- | -L, --stdlog [0-6] Specify logging level (to standard error) | ||
- | 0 - suppress any messages | ||
- | 1 - only fatal errors | ||
- | 2 - all errors | ||
- | 3 - warnings | ||
- | 4 - info | ||
- | 5 - debug info (here starts lots of output) | ||
- | 6 - trace info (and even more) | ||
- | -v, --verbose | ||
- | -q, --quiet | ||
- | -c, --conf [FILE] | ||
- | | ||
- | --confdir [DIR] | ||
- | from. Default: / | ||
- | --tmpdir [DIR] Temporary directory to be used instead of default | ||
- | / | ||
- | -l, --local | ||
- | | ||
- | / | ||
- | | ||
- | -H, --hostonly | ||
- | booting the local host instead of a generic host. | ||
- | -N, --no-hostonly | ||
- | --hostonly-cmdline | ||
- | in the initramfs | ||
- | --no-hostonly-cmdline Do not store kernel command line arguments needed | ||
- | in the initramfs | ||
- | --hostonly-i18n | ||
- | to the host configuration (default). | ||
- | --no-hostonly-i18n | ||
- | --persistent-policy [POLICY] | ||
- | Use [POLICY] to address disks and partitions. | ||
- | POLICY can be any directory name found in /dev/disk. | ||
- | E.g. " | ||
- | --fstab | ||
- | --add-fstab [FILE] | ||
- | --mount "[DEV] [MP] [FSTYPE] [FSOPTS]" | ||
- | Mount device [DEV] on mountpoint [MP] with filesystem | ||
- | [FSTYPE] and options [FSOPTS] in the initramfs | ||
- | --add-device " | ||
- | -i, --include [SOURCE] [TARGET] | ||
- | Include the files in the SOURCE directory into the | ||
- | | ||
- | If SOURCE is a file, it will be installed to TARGET | ||
- | in the final initramfs. | ||
- | -I, --install [LIST] | ||
- | | ||
- | --install-optional [LIST] | ||
- | | ||
- | --gzip | ||
- | This will be done by default, unless another | ||
- | | ||
- | --bzip2 | ||
- | Make sure your kernel has bzip2 decompression support | ||
- | | ||
- | --lzma | ||
- | Make sure your kernel has lzma support compiled in, | ||
- | | ||
- | --xz Compress the generated initramfs using xz. | ||
- | Make sure that your kernel has xz support compiled | ||
- | in, otherwise you will not be able to boot. | ||
- | --lzo Compress the generated initramfs using lzop. | ||
- | Make sure that your kernel has lzo support compiled | ||
- | in, otherwise you will not be able to boot. | ||
- | --lz4 Compress the generated initramfs using lz4. | ||
- | Make sure that your kernel has lz4 support compiled | ||
- | in, otherwise you will not be able to boot. | ||
- | --compress [COMPRESSION] Compress the generated initramfs with the | ||
- | | ||
- | knows how to decompress the generated initramfs, | ||
- | | ||
- | --no-compress | ||
- | | ||
- | --list-modules | ||
- | -M, --show-modules | ||
- | | ||
- | --keep | ||
- | --printsize | ||
- | --sshkey [SSHKEY] | ||
- | --logfile [FILE] | ||
- | |||
- | If [LIST] has multiple arguments, then you have to put these in quotes. | ||
- | |||
- | For example: | ||
- | |||
- | # dracut --add-drivers " | ||
- | |||
- | </ | ||
- | |||
- | Le fichier de configuration de dracut est **/ | ||
- | |||
- | < | ||
- | # PUT YOUR CONFIG HERE OR IN separate files named *.conf | ||
- | # in / | ||
- | # SEE man dracut.conf(5) | ||
- | |||
- | # Sample dracut config file | ||
- | |||
- | # | ||
- | # | ||
- | |||
- | # Exact list of dracut modules to use. Modules not listed here are not going | ||
- | # to be included. | ||
- | # add_dracutmodules option instead. | ||
- | # | ||
- | |||
- | # dracut modules to omit | ||
- | # | ||
- | |||
- | # dracut modules to add to the default | ||
- | # | ||
- | |||
- | # additional kernel modules to the default | ||
- | add_drivers+=" | ||
- | |||
- | # list of kernel filesystem modules to be included in the generic initramfs | ||
- | # | ||
- | |||
- | # build initrd only to boot current hardware | ||
- | # | ||
- | # | ||
- | |||
- | # install local / | ||
- | # | ||
- | |||
- | # install local / | ||
- | # | ||
- | |||
- | # A list of fsck tools to install. If it's not specified, module' | ||
- | # default is used, currently: " | ||
- | # xfs_repair e2fsck jfs_fsck reiserfsck btrfsck" | ||
- | # opportunistic, | ||
- | # | ||
- | |||
- | # inhibit installation of any fsck tools | ||
- | # | ||
- | |||
- | # mount / and /usr read-only by default | ||
- | # | ||
- | |||
- | # set the directory for temporary files | ||
- | # default: /var/tmp | ||
- | # | ||
- | </ | ||
- | |||
- | Exécutez maintenant la commande suivante afin de générer le fichier **initramfs** : | ||
- | |||
- | < | ||
- | [root@centos7 tmp]# dracut -v initramfs | ||
- | Executing: / | ||
- | dracut module ' | ||
- | dracut module ' | ||
- | *** Including module: bash *** | ||
- | *** Including module: nss-softokn *** | ||
- | *** Including module: i18n *** | ||
- | *** Including module: network *** | ||
- | *** Including module: ifcfg *** | ||
- | *** Including module: drm *** | ||
- | *** Including module: plymouth *** | ||
- | *** Including module: kernel-modules *** | ||
- | *** Including module: qemu *** | ||
- | *** Including module: resume *** | ||
- | *** Including module: rootfs-block *** | ||
- | *** Including module: terminfo *** | ||
- | *** Including module: udev-rules *** | ||
- | Skipping udev rule: 91-permissions.rules | ||
- | *** Including module: biosdevname *** | ||
- | *** Including module: systemd *** | ||
- | *** Including module: usrmount *** | ||
- | *** Including module: base *** | ||
- | *** Including module: fs-lib *** | ||
- | *** Including module: shutdown *** | ||
- | *** Including modules done *** | ||
- | *** Installing kernel module dependencies and firmware *** | ||
- | *** Installing kernel module dependencies and firmware done *** | ||
- | *** Resolving executable dependencies *** | ||
- | *** Resolving executable dependencies done*** | ||
- | *** Hardlinking files *** | ||
- | *** Hardlinking files done *** | ||
- | *** Stripping files *** | ||
- | *** Stripping files done *** | ||
- | *** Generating early-microcode cpio image contents *** | ||
- | *** Constructing GenuineIntel.bin **** | ||
- | *** Store current command line parameters *** | ||
- | *** Creating image file *** | ||
- | *** Creating microcode section *** | ||
- | *** Created microcode section *** | ||
- | *** Creating image file done *** | ||
- | *** Creating initramfs image file '/ | ||
- | </ | ||
- | |||
- | Notez la présence de votre nouvelle image **/ | ||
- | |||
- | < | ||
- | [root@centos7 initrd]# ls -l / | ||
- | -rw-------. 1 root root 16373488 Jun 10 10:23 / | ||
- | </ | ||
- | |||
- | Déplacez votre fichier initramfs au répertoire /boot : | ||
- | |||
- | < | ||
- | [root@centos7 initrd]# mv initramfs /boot | ||
- | </ | ||
- | |||
- | Ouvrez votre fichier **/ | ||
- | |||
- | < | ||
- | ... | ||
- | ### BEGIN / | ||
- | menuentry ' | ||
- | load_video | ||
- | set gfxpayload=keep | ||
- | insmod gzio | ||
- | insmod part_msdos | ||
- | insmod xfs | ||
- | set root=' | ||
- | if [ x$feature_platform_search_hint = xy ]; then | ||
- | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, | ||
- | else | ||
- | search --no-floppy --fs-uuid --set=root e8d3bd48-1386-411c-9675-41c3f8f1a309 | ||
- | fi | ||
- | linux16 / | ||
- | initrd16 / | ||
- | } | ||
- | ... | ||
- | </ | ||
- | |||
- | Créez maintenant le fichier **/ | ||
- | |||
- | < | ||
- | #!/bin/sh -e | ||
- | cat << EOF | ||
- | menuentry ' | ||
- | load_video | ||
- | set gfxpayload=keep | ||
- | insmod gzio | ||
- | insmod part_msdos | ||
- | insmod xfs | ||
- | set root=' | ||
- | if [ x$feature_platform_search_hint = xy ]; then | ||
- | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, | ||
- | else | ||
- | search --no-floppy --fs-uuid --set=root e8d3bd48-1386-411c-9675-41c3f8f1a309 | ||
- | fi | ||
- | linux16 / | ||
- | initrd16 /initramfs | ||
- | } | ||
- | EOF | ||
- | </ | ||
- | |||
- | Rendez ce fichier exécutable : | ||
- | |||
- | < | ||
- | [root@centos7 initrd]# chmod +x / | ||
- | </ | ||
- | |||
- | Avant de continuer, supprimer le fichier **/ | ||
- | |||
- | < | ||
- | #!/bin/sh | ||
- | exec tail -n +3 $0 | ||
- | # This file provides an easy way to add custom menu entries. | ||
- | # menu entries you want to add after this comment. | ||
- | # the 'exec tail' line above. | ||
- | </ | ||
- | |||
- | Mettez à jour grub afin que celui-ci prend en compte le nouveau fichier : | ||
- | |||
- | < | ||
- | [root@centos7 initrd]# grub2-mkconfig -o / | ||
- | Generating grub configuration file ... | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | Found linux image: / | ||
- | Found initrd image: / | ||
- | done | ||
- | </ | ||
- | |||
- | Controlez le fichier / | ||
- | |||
- | < | ||
- | ... | ||
- | ### BEGIN / | ||
- | menuentry ' | ||
- | load_video | ||
- | set gfxpayload=keep | ||
- | insmod gzio | ||
- | insmod part_msdos | ||
- | insmod xfs | ||
- | set root=' | ||
- | if [ x = xy ]; then | ||
- | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, | ||
- | else | ||
- | ... | ||
- | </ | ||
- | |||
- | <WRAP center round todo> | ||
- | **A faire** : **Re-démarrez votre machine pour tester votre configuration.** | ||
- | </ | ||
====Processus de Démarrage du Noyau Linux==== | ====Processus de Démarrage du Noyau Linux==== | ||
Ligne 1558: | Ligne 599: | ||
La fonction **init_post()** essaie ensuite d' | La fonction **init_post()** essaie ensuite d' | ||
- | * /sbin/init | + | * / |
* /etc/init | * /etc/init | ||
* /bin/init | * /bin/init | ||
- | * / | + | * / |
Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché. | Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché. | ||
- | ====Processus Init==== | + | =====Systemd===== |
- | Le premier processus lancé par le noyau est **Init**. L' | + | Les systèmes de démarrage antérieurs à Systemd, |
- | | + | **Systemd** essaie, par contre, de démarrer autant de services en parallèle que possible. Ceci est rendu possible car la majorité d'architectures matérielles modernes sont multi-cœurs. Si un service dépend d'un autre qui n'est pas encore démarré ce premier est mis en attente dans une mémoire tampon. Qui plus est, les services qui ne sont pas nécessaires au démarrage |
- | | + | |
- | * l' | + | |
- | * la mise à l'heure du système, | + | |
- | * la définition des consoles textes, | + | |
- | * la définition du nom de la machine, | + | |
- | * la détection des périphériques USB, | + | |
- | * la mise en place du support RAID et LVM, | + | |
- | * l' | + | |
- | * le montages des systèmes de fichiers, | + | |
- | * le re-montage du système de fichiers racine | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | * la définition des variables d' | + | |
- | =====Démarrer RHEL/CentOS 5 avec SysVinit===== | + | Au lieu de parler de scripts de démarrage et de niveaux d' |
- | ====Niveaux | + | * **.automount** - active la fonctionalité |
+ | * **.device** - expose une périphérique dans systemd. | ||
+ | * **.mount** - contrôle quand et comment les systèmes de fichiers sont montés. | ||
+ | * **.path** - active un service quand il y a un accès à un fichier ou répertoire | ||
+ | * **.service** - démarre, arrête, redémarre ou recharge un service. | ||
+ | * **.scope** - gère des services. | ||
+ | * **.slice** - regroupe des Unités dans une arborescence afin de limiter des ressources en utilisant des CGroups. | ||
+ | * **.snapshot** - un état sauvegardé du gestionnaire Systemd. | ||
+ | * **.socket** - permet aux Unités d' | ||
+ | * **.swap** - encapsule une périphérique ou un fichier swap. | ||
+ | * **.timer** - déclenche l' | ||
+ | * **.target** - regroupe des Unités multiples afin qu' | ||
- | Il existe 8 niveaux d' | + | Une Cible est en quelque sorte une **grande étape** dans le démarrage du système |
- | ^ RUNLEVEL ^ Description ^ | + | * **halt.target** - arrête le système. |
- | | 0 | Arrêt de la machine | | + | * **poweroff.target** - arrête le système et coupe le courant. |
- | | 1 | Mode mono-utilisateur pour la maintenance | | + | * **shutdown.target** |
- | | 6 | Redémarrage | + | * **rescue.target** - démarre le système en mode single-user (seul root peut s'y connecter). Tous les systèmes |
- | | S ou s | Mode mono-utilisateur avec seul la partition racine montée | | + | * **emergency.target** - démarre le système en mode single-user (seul root peut s'y connecter). Uniquement le système de fichiers racine est monté en mode lecture seule. Le réseau n'est pas démarré. |
+ | * **multi-user.target** - démarre le système en mode multi-utilisateur avec tous les systèmes de fichiers montés et le service network démarré. | ||
+ | * **graphical.target** - démarre le système en multi-user.target puis démarre l' | ||
+ | * **hibernate.target** - sauvegarde l' | ||
+ | * **reboot.target** - redémarre le système. | ||
- | Les autres quatre RUNLEVELS sont définis par chaque distribution. Par exemple, sous %%RedHat%%, ils sont : | + | **Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d' |
- | ^ RUNLEVEL ^ Description ^ | + | < |
- | | 2 | Mode multi-utilisateur sans NFS | | + | [root@centos8 ~]# ls -l / |
- | | 3 | Mode multi-utilisateur | | + | lrwxrwxrwx. 1 root root 15 Apr 7 16:55 / |
- | | 4 | Non-utilisé | | + | lrwxrwxrwx. 1 root root 13 Apr 7 16:55 / |
- | | 5 | Mode multi-utilisateur avec session graphique | | + | lrwxrwxrwx. 1 root root 17 Apr 7 16:55 / |
+ | lrwxrwxrwx. 1 root root 17 Apr 7 16:55 / | ||
+ | lrwxrwxrwx. 1 root root 17 Apr 7 16:55 / | ||
+ | lrwxrwxrwx. 1 root root 16 Apr 7 16:55 / | ||
+ | lrwxrwxrwx. 1 root root 13 Apr 7 16:55 / | ||
- | Il existe aussi 3 pseudo-niveaux d' | + | / |
+ | total 0 | ||
- | Pour connaître le niveau d' | + | / |
+ | total 0 | ||
- | < | + | /usr/ |
- | [root@centos5 ~]# runlevel | + | total 0 |
- | N 5 | + | |
- | </code> | + | |
- | La lettre N indique que le système n'a pas changé de niveau d' | + | / |
+ | total 0 | ||
- | Pour modifier le niveau d' | + | / |
+ | total 0 | ||
+ | </ | ||
- | ^ Option ^ Description ^ | + | ====LAB #1 - La Commande systemctl==== |
- | | Q ou q | Demande à Init de relire le fichier / | + | |
- | | -t | Permet de modifier le temps accordé par Init aux processus entre l' | + | |
- | ====Inittab==== | + | Pour visualiser la liste des Unités, il convient d' |
- | + | ||
- | Le fichier | + | |
< | < | ||
- | [root@centos5 | + | [root@centos8 |
- | # | + | UNIT LOAD |
- | # inittab | + | proc-sys-fs-binfmt_misc.automount |
- | # the system in a certain run-level. | + | sys-devices-pci0000: |
- | # | + | sys-devices-pci0000: |
- | # Author: Miquel van Smoorenburg, | + | sys-devices-pci0000: |
- | # | + | sys-devices-pci0000: |
- | # | + | sys-devices-pci0000: |
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000:00-0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-platform-serial8250-tty-ttyS0.device | ||
+ | sys-devices-platform-serial8250-tty-ttyS1.device | ||
+ | sys-devices-platform-serial8250-tty-ttyS2.device | ||
+ | sys-devices-platform-serial8250-tty-ttyS3.device | ||
+ | sys-devices-virtual-block-dm\x2d0.device | ||
+ | sys-devices-virtual-block-dm\x2d1.device | ||
+ | sys-devices-virtual-net-virbr0.device | ||
+ | sys-devices-virtual-net-virbr0\x2dnic.device | ||
+ | sys-module-configfs.device | ||
+ | sys-subsystem-net-devices-enp0s3.device | ||
+ | sys-subsystem-net-devices-virbr0.device | ||
+ | sys-subsystem-net-devices-virbr0\x2dnic.device | ||
+ | -.mount | ||
+ | boot.mount | ||
+ | dev-hugepages.mount | ||
+ | dev-mqueue.mount | ||
+ | run-user-1000.mount | ||
+ | sys-kernel-config.mount | ||
+ | sys-kernel-debug.mount | ||
+ | sys-kernel-tracing.mount | ||
+ | var-lib-nfs-rpc_pipefs.mount | ||
+ | cups.path | ||
+ | systemd-ask-password-plymouth.path | ||
+ | systemd-ask-password-wall.path | ||
+ | init.scope | ||
+ | session-96.scope | ||
+ | atd.service | ||
+ | auditd.service | ||
+ | avahi-daemon.service | ||
+ | chronyd.service | ||
+ | crond.service | ||
+ | cups.service | ||
+ | dbus.service | ||
+ | dracut-shutdown.service | ||
+ | firewalld.service | ||
+ | lines 1-57 | ||
+ | </ | ||
- | # Default runlevel. The runlevels used by RHS are: | + | Pour consulter la liste des Unités inactifs, utilisez la commande suivante |
- | # 0 - halt (Do NOT set initdefault to this) | + | |
- | # 1 - Single user mode | + | |
- | # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) | + | |
- | # 3 - Full multiuser mode | + | |
- | # 4 - unused | + | |
- | # 5 - X11 | + | |
- | # 6 - reboot (Do NOT set initdefault to this) | + | |
- | # | + | |
- | id: | + | |
- | # System | + | < |
- | si:: | + | [root@centos8 ~]# systemctl list-units --all | grep inactive | more |
- | + | ● boot.automount | |
- | l0: | + | proc-fs-nfsd.mount |
- | l1: | + | proc-sys-fs-binfmt_misc.mount |
- | l2: | + | sys-fs-fuse-connections.mount loaded |
- | l3: | + | ● sysroot.mount not-found inactive dead sysroot.mount |
- | l4: | + | tmp.mount |
- | l5: | + | var-lib-machines.mount |
- | l6: | + | |
- | + | ● apparmor.service | |
- | # Trap CTRL-ALT-DELETE | + | |
- | ca:: | + | |
- | + | ● display-manager.service | |
- | # When our UPS tells us power has failed, assume we have a few minutes | + | |
- | # of power left. | + | |
- | # This does, of course, assume you have powerd installed and your | + | |
- | # UPS connected | + | |
- | pf:: | + | |
- | + | dracut-pre-mount.service | |
- | # If power was restored before the shutdown kicked in, cancel it. | + | |
- | pr: | + | |
- | + | | |
- | + | | |
- | # Run gettys in standard runlevels | + | emergency.service |
- | 1: | + | initrd-cleanup.service |
- | 2: | + | initrd-parse-etc.service |
- | 3: | + | initrd-switch-root.service |
- | 4: | + | |
- | 5: | + | ● ip6tables.service |
- | 6: | + | ● ipset.service |
- | + | ● iptables.service | |
- | # Run xdm in runlevel 5 | + | iscsi-onboot.service |
- | x: | + | |
+ | iscsid.service | ||
+ | iscsiuio.service | ||
+ | | ||
+ | libvirt-guests.service | ||
+ | libvirtd.service | ||
+ | loadmodules.service | ||
+ | ● lvm2-activation.service | ||
+ | | ||
+ | | ||
+ | | ||
+ | ● network.service | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ● ntpd.service | ||
+ | ● ntpdate.service | ||
+ | | ||
+ | | ||
+ | rescue.service | ||
+ | rpc-gssd.service | ||
+ | --More-- | ||
</ | </ | ||
- | Dans l' | + | Les points noirs au début de certaines lignes dans la sortie |
- | + | ||
- | ^ Champ ^ Nom ^ Description ^ | + | |
- | | 1 | Identifiant | Identifiant unique de la ligne composé de 1 à 4 caractères | | + | |
- | | 2 | RUNLEVELS | Liste des niveaux d' | + | |
- | | 3 | Action | Méthode utilisé pour lancer la commande se trouvant dans le champ 4 | | + | |
- | | 4 | Commande | Commande | + | |
- | + | ||
- | Le champ **action** prend une des directives suivantes : | + | |
- | + | ||
- | ^ Directive ^ Description ^ | + | |
- | | respawn | Le processus est relancé en cas d'arrêt de celui-ci | | + | |
- | | mingetty | Assure la gestion du terminal texte | | + | |
- | | once | Le processus n'est exécuté qu'une fois | | + | |
- | | wait | Le processus n'est exécuté qu'une fois. Init attend la fin du processus avant de passer à la ligne suivante | | + | |
- | | boot | Le processus est exécuté au démarrage de la machine. Le champ RUNLEVELS est sans importance | | + | |
- | | bootwait | Le processus est exécuté au démarrage de la machine. Le champ RUNLEVELS est sans importance. Init attend la fin du processus avant de passer à la ligne suivante | | + | |
- | | off | Revient à commenter la ligne | | + | |
- | | ondemand | La même chose que respawn mais la commande est exécuté dans un des 3 pseudo-niveaux d' | + | |
- | | initdefault | Définit | + | |
- | | sysinit | La commande est exécutée au démarrage da la machine avant les lignes boot et bootwait | | + | |
- | | powerfail | La commande est exécutée quand init reçoit un signal SIGPWR d'un onduleur | | + | |
- | | powerwait | La commande est exécutée quand init reçoit un signal SIGPWR d'un onduleur. Init attend la fin du processus avant de passer à la ligne suivante | | + | |
- | | powerokwait | La commande est exécutée si Init reçoit un signal de rétablissement du courant | | + | |
- | | powerfailnow | La commande est exécutée quand Init reçoit un signal comme quoi la batterie de l'onduleur est presque vide | | + | |
- | | ctrlaltdel | La commande est exécutée quand Init reçoit un signal SIGINT. Ce signal est envoyé par la combinaison de touches [CTRL] [ALT] [SUPPR] | | + | |
- | | kbrequest | La commande est exécutée suivant des séquences de touches saisies au clavier | | + | |
- | + | ||
- | L'analyse de notre fichier d' | + | |
- | + | ||
- | ^ Ligne ^ Description ^ | + | |
- | | id: | + | |
- | | si:: | + | |
- | | l0: | + | |
- | | l1: | + | |
- | | l2: | + | |
- | | l3: | + | |
- | | l4: | + | |
- | | l5: | + | |
- | | l6: | + | |
- | | ca:: | + | |
- | | pf:: | + | |
- | | pr: | + | |
- | | 1: | + | |
- | | 2: | + | |
- | | 3: | + | |
- | | 4: | + | |
- | | 5: | + | |
- | | 6: | + | |
- | | x: | + | |
- | + | ||
- | ====Scripts de Démarrage==== | + | |
- | + | ||
- | Naviguez à **/etc/rc.d** et saisissez la commande **ls** | + | |
< | < | ||
- | [root@centos5 | + | [root@centos8 |
- | [root@centos5 rc.d]# ls | + | Unit ntpd.service could not be found. |
- | init.d | + | |
- | rc rc1.d rc3.d rc5.d rc.local | + | |
</ | </ | ||
- | ===rc.sysinit sous RHEL/CentOS 5=== | + | Pour consulter la liste des Unités ainsi que leurs statuts, utilisez la commande suivante |
- | + | ||
- | D' | + | |
- | + | ||
- | ====Répertoire init.d==== | + | |
- | + | ||
- | Le répertoire **/ | + | |
< | < | ||
- | [root@centos5 rc.d]# ls init.d/* | + | [root@centos8 ~]# systemctl list-unit-files | more |
- | init.d/ | + | UNIT FILE STATE |
- | init.d/ | + | proc-sys-fs-binfmt_misc.automount |
- | init.d/atd init.d/ | + | -.mount generated |
- | init.d/ | + | boot.mount |
- | init.d/ | + | dev-hugepages.mount |
- | init.d/avahi-daemon | + | dev-mqueue.mount |
- | init.d/ | + | proc-fs-nfsd.mount |
- | init.d/ | + | proc-sys-fs-binfmt_misc.mount static |
- | init.d/ | + | sys-fs-fuse-connections.mount static |
- | init.d/ | + | sys-kernel-config.mount static |
+ | sys-kernel-debug.mount | ||
+ | tmp.mount disabled | ||
+ | var-lib-machines.mount | ||
+ | var-lib-nfs-rpc_pipefs.mount | ||
+ | cups.path enabled | ||
+ | systemd-ask-password-console.path static | ||
+ | systemd-ask-password-plymouth.path | ||
+ | systemd-ask-password-wall.path | ||
+ | session-96.scope | ||
+ | arp-ethers.service | ||
+ | atd.service | ||
+ | auditd.service | ||
+ | auth-rpcgss-module.service | ||
+ | autovt@.service | ||
+ | avahi-daemon.service | ||
+ | blk-availability.service | ||
+ | chrony-dnssrv@.service | ||
+ | chrony-wait.service | ||
+ | chronyd.service | ||
+ | cockpit-motd.service | ||
+ | cockpit-wsinstance-http-redirect.service | ||
+ | cockpit-wsinstance-http.service | ||
+ | cockpit-wsinstance-https-factory@.service | ||
+ | cockpit-wsinstance-https@.service | ||
+ | cockpit.service | ||
+ | console-getty.service | ||
+ | container-getty@.service | ||
+ | cpupower.service | ||
+ | crond.service | ||
+ | cups-browsed.service | ||
+ | cups.service | ||
+ | dbus-org.fedoraproject.FirewallD1.service | ||
+ | dbus-org.freedesktop.Avahi.service | ||
+ | dbus-org.freedesktop.hostname1.service | ||
+ | dbus-org.freedesktop.import1.service | ||
+ | dbus-org.freedesktop.locale1.service | ||
+ | dbus-org.freedesktop.login1.service | ||
+ | dbus-org.freedesktop.machine1.service | ||
+ | dbus-org.freedesktop.nm-dispatcher.service | ||
+ | dbus-org.freedesktop.portable1.service | ||
+ | dbus-org.freedesktop.timedate1.service | ||
+ | dbus.service | ||
+ | debug-shell.service | ||
+ | dm-event.service | ||
+ | dnf-makecache.service | ||
+ | dnsmasq.service | ||
+ | dracut-cmdline.service | ||
+ | --More-- | ||
</ | </ | ||
- | ====Linux Standard Base==== | + | Pour visualiser les Unités d'un type spécifique, |
- | **[[http:// | + | < |
+ | [root@centos8 ~]# systemctl list-unit-files -t mount | ||
+ | UNIT FILE | ||
+ | -.mount | ||
+ | boot.mount generated | ||
+ | dev-hugepages.mount | ||
+ | dev-mqueue.mount static | ||
+ | proc-fs-nfsd.mount | ||
+ | proc-sys-fs-binfmt_misc.mount static | ||
+ | sys-fs-fuse-connections.mount static | ||
+ | sys-kernel-config.mount | ||
+ | sys-kernel-debug.mount | ||
+ | tmp.mount | ||
+ | var-lib-machines.mount | ||
+ | var-lib-nfs-rpc_pipefs.mount static | ||
- | Les scripts init qui sont conformes au standard LSB doivent fournir : | + | 12 unit files listed. |
+ | </ | ||
- | * au moins les actions | + | Dans la colonne STATE on voit les mots **static** et **generated**. |
- | | + | |
- | | + | |
- | Les scripts init conforment au standard LSB peuvent aussi fournir : | + | * STATE = static |
+ | * Ceci implique que l' | ||
- | * les actions **reload** et **try-restart**, | + | * STATE = generated |
- | * des messages de journalisation | + | * Ceci implique que le fichier a été généré automatiquement |
- | + | ||
- | Les fonctions proposées par défaut par LSB sont contenues dans le fichier **/lib/lsb/init-functions** : | + | |
< | < | ||
- | [root@centos5 | + | [root@centos8 |
- | #!/bin/sh | + | -rwxr-xr-x. 1 root root 46096 Apr 7 16:56 /lib/systemd/system-generators/systemd-fstab-generator |
- | + | ||
- | # LSB initscript functions, as defined in the LSB Spec 1.1.0 | + | |
- | # | + | |
- | # Lawrence Lim < | + | |
- | # Updated to the latest LSB 3.1 spec | + | |
- | # http:// | + | |
- | + | ||
- | start_daemon () { | + | |
- | /etc/redhat-lsb/ | + | |
- | } | + | |
- | + | ||
- | killproc () { | + | |
- | /etc/redhat-lsb/lsb_killproc " | + | |
- | } | + | |
- | + | ||
- | pidofproc () { | + | |
- | / | + | |
- | } | + | |
- | + | ||
- | log_success_msg () { | + | |
- | / | + | |
- | } | + | |
- | + | ||
- | log_failure_msg () { | + | |
- | / | + | |
- | } | + | |
- | + | ||
- | log_warning_msg () { | + | |
- | / | + | |
- | } | + | |
</ | </ | ||
- | Ces fonctions sont des scripts se trouvant dans le répertoire **/ | + | Il existe aussi d' |
< | < | ||
- | [root@centos5 | + | [root@centos8 |
- | total 16 | + | total 508 |
- | -rwxr-xr-x. 1 root root | + | -rwxr-xr-x. 1 root root 504 Jan 4 11:25 kdump-dep-generator.sh |
- | -rwxr-xr-x. 1 root root 243 22 févr. | + | -r-xr-xr-x. 1 root root 134976 Aug 17 2020 lvm2-activation-generator |
- | -rwxr-xr-x. 1 root root | + | -rwxr-xr-x. 1 root root 67792 Jul 20 2020 nfs-server-generator |
- | -rwxr-xr-x. 1 root root 650 22 févr. | + | -rwxr-xr-x. 1 root root 38216 Jul 20 2020 rpc-pipefs-generator |
+ | -rwxr-xr-x. 1 root root 743 Apr 23 2020 selinux-autorelabel-generator.sh | ||
+ | -rwxr-xr-x. 1 root root 33504 Apr 7 16:56 systemd-cryptsetup-generator | ||
+ | -rwxr-xr-x. 1 root root | ||
+ | -rwxr-xr-x. 1 root root 46096 Apr 7 16:56 systemd-fstab-generator | ||
+ | -rwxr-xr-x. 1 root root 17064 Apr 7 16:56 systemd-getty-generator | ||
+ | -rwxr-xr-x. 1 root root 29432 Apr 7 16:56 systemd-gpt-auto-generator | ||
+ | -rwxr-xr-x. 1 root root | ||
+ | -rwxr-xr-x. 1 root root 12368 Apr 7 16:56 systemd-rc-local-generator | ||
+ | -rwxr-xr-x. 1 root root 12408 Apr 7 16:56 systemd-system-update-generator | ||
+ | -rwxr-xr-x. 1 root root 33544 Apr 7 16:56 systemd-sysv-generator | ||
+ | -rwxr-xr-x. 1 root root 17024 Apr 7 16:56 systemd-veritysetup-generator | ||
</ | </ | ||
- | L' | + | Les options |
< | < | ||
- | [root@centos5 | + | [root@centos8 |
- | #!/bin/bash | + | systemctl [OPTIONS...] {COMMAND} ... |
- | . / | + | Query or send control commands to the systemd manager. |
- | LSB=LSB-1.1 killproc $* | + | |
- | exit $? | + | --version |
- | [root@centos ~]# | + | --system |
- | [root@centos ~]# cat /etc/redhat-lsb/lsb_pidofproc | + | --user |
- | #!/bin/bash | + | -H --host=[USER@]HOST |
+ | Operate on remote host | ||
+ | -M --machine=CONTAINER | ||
+ | Operate on local container | ||
+ | -t --type=TYPE | ||
+ | | ||
+ | -p --property=NAME | ||
+ | -a --all Show all properties/all units currently in memory, | ||
+ | including dead/empty ones. To list all units installed on | ||
+ | the system, use the ' | ||
+ | | ||
+ | -l --full | ||
+ | -r --recursive | ||
+ | | ||
+ | | ||
+ | queueing a new job | ||
+ | | ||
+ | | ||
+ | -i --ignore-inhibitors | ||
+ | When shutting down or sleeping, ignore inhibitors | ||
+ | | ||
+ | -s --signal=SIGNAL | ||
+ | | ||
+ | | ||
+ | -q --quiet | ||
+ | | ||
+ | | ||
+ | | ||
+ | --no-reload | ||
+ | | ||
+ | | ||
+ | | ||
+ | Do not ask for system passwords | ||
+ | | ||
+ | | ||
+ | reboot | ||
+ | -f --force | ||
+ | When shutting down, execute action immediately | ||
+ | | ||
+ | | ||
+ | directory | ||
+ | -n --lines=INTEGER | ||
+ | -o --output=STRING | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | . / | + | lines 1-57 |
- | + | ||
- | pidofproc $* | + | |
- | exit $? | + | |
</ | </ | ||
- | Le fichier **/ | + | ====LAB #2 - Fichiers de Configuration==== |
- | < | + | ===2.1 - Fichiers de Configuration par Défaut=== |
- | ... | + | |
- | # A function to stop a program. | + | |
- | killproc() { | + | |
- | local RC killlevel= base pid pid_file= delay try binary= | + | |
- | RC=0; delay=3; try=0 | + | Les fichiers de configuration des Cibles et fichiers de configuration des Unités installés par des paquets se trouvent dans le répertoire **/usr/lib/systemd/system** : |
- | # Test syntax. | + | |
- | if [ " | + | |
- | echo $" | + | |
- | return 1 | + | |
- | fi | + | |
- | if [ " | + | |
- | pid_file=$2 | + | |
- | shift 2 | + | |
- | fi | + | |
- | if [ " | + | |
- | if [ -z $pid_file ]; then | + | |
- | echo $"-b option can be used only with -p" | + | |
- | echo $" | + | |
- | return 1 | + | |
- | fi | + | |
- | binary=$2 | + | |
- | shift 2 | + | |
- | fi | + | |
- | if [ " | + | |
- | delay=$(echo $2 | awk -v RS=' ' -v IGNORECASE=1 ' | + | |
- | if [ " | + | |
- | echo $" | + | |
- | return 1 | + | |
- | fi | + | |
- | shift 2 | + | |
- | ... | + | |
- | </ | + | |
- | et | + | < |
+ | [root@centos8 ~]# pkg-config systemd --variable=systemdsystemunitdir | ||
+ | / | ||
+ | </ | ||
- | <file> | + | <code> |
- | ... | + | [root@centos8 ~]# ls -l / |
- | pidofproc() { | + | total 1464 |
- | local RC pid pid_file= | + | -rw-r--r--. 1 root root 275 Apr 26 2020 arp-ethers.service |
+ | -rw-r--r--. 1 root root 222 May 11 2019 atd.service | ||
+ | -rw-r--r--. 1 root root 1512 Apr 23 2020 auditd.service | ||
+ | -rw-r--r--. 1 root root 628 Jul 20 2020 auth-rpcgss-module.service | ||
+ | lrwxrwxrwx. 1 root root 14 Apr 7 16:55 autovt@.service -> getty@.service | ||
+ | -rw-r--r--. 1 root root 1044 Nov 16 2020 avahi-daemon.service | ||
+ | -rw-r--r--. 1 root root 870 Nov 16 2020 avahi-daemon.socket | ||
+ | -rw-r--r--. 1 root root 956 Apr 7 16:54 basic.target | ||
+ | drwxr-xr-x. 2 root root 6 Apr 7 16:55 basic.target.wants | ||
+ | -r--r--r--. 1 root root 408 Aug 17 2020 blk-availability.service | ||
+ | -rw-r--r--. 1 root root 419 Jun 22 2018 bluetooth.target | ||
+ | -rw-r--r--. 1 root root 455 Apr 7 16:54 boot-complete.target | ||
+ | -rw-r--r--. 1 root root 209 Nov 19 2019 chrony-dnssrv@.service | ||
+ | -rw-r--r--. 1 root root 138 Nov 19 2019 chrony-dnssrv@.timer | ||
+ | -rw-r--r--. 1 root root 491 Nov 19 2019 chronyd.service | ||
+ | -rw-r--r--. 1 root root 472 May 10 2019 chrony-wait.service | ||
+ | -rw-r--r--. 1 root root 222 Aug 24 2020 cockpit-motd.service | ||
+ | -rw-r--r--. 1 root root 835 Aug 24 2020 cockpit.service | ||
+ | -rw-r--r--. 1 root root 373 Aug 24 2020 cockpit.socket | ||
+ | -rw-r--r--. 1 root root 251 Aug 24 2020 cockpit-wsinstance-http-redirect.service | ||
+ | -rw-r--r--. 1 root root 233 Aug 24 2020 cockpit-wsinstance-http-redirect.socket | ||
+ | -rw-r--r--. 1 root root 221 Aug 24 2020 cockpit-wsinstance-http.service | ||
+ | -rw-r--r--. 1 root root 165 Aug 24 2020 cockpit-wsinstance-https-factory@.service | ||
+ | -rw-r--r--. 1 root root 244 Aug 24 2020 cockpit-wsinstance-https-factory.socket | ||
+ | -rw-r--r--. 1 root root 215 Aug 24 2020 cockpit-wsinstance-http.socket | ||
+ | -rw-r--r--. 1 root root 264 Aug 24 2020 cockpit-wsinstance-https@.service | ||
+ | -rw-r--r--. 1 root root 478 Aug 24 2020 cockpit-wsinstance-https@.socket | ||
+ | -rw-r--r--. 1 root root 1082 Apr 7 16:55 console-getty.service | ||
+ | -rw-r--r--. 1 root root 1263 Apr 7 16:55 container-getty@.service | ||
+ | -rw-r--r--. 1 root root 294 Apr 8 15:21 cpupower.service | ||
+ | -rw-r--r--. 1 root root 356 Nov 8 2019 crond.service | ||
+ | -rw-r--r--. 1 root root 465 Jun 22 2018 cryptsetup-pre.target | ||
+ | -rw-r--r--. 1 root root 412 Jun 22 2018 cryptsetup.target | ||
+ | lrwxrwxrwx. 1 root root 13 Apr 7 16:55 ctrl-alt-del.target -> reboot.target | ||
+ | -rw-r--r--. 1 root root 234 Oct 4 2017 cups-browsed.service | ||
+ | -r--r--r--. 1 root root 142 Jun 15 2020 cups.path | ||
+ | -r--r--r--. 1 root root 248 Jun 15 2020 cups.service | ||
+ | -r--r--r--. 1 root root 136 Jun 15 2020 cups.socket | ||
+ | lrwxrwxrwx. 1 root root 25 Apr 7 16:55 dbus-org.freedesktop.hostname1.service -> systemd-hostnamed.service | ||
+ | lrwxrwxrwx. 1 root root 23 Apr 7 16:55 dbus-org.freedesktop.import1.service -> systemd-importd.service | ||
+ | lrwxrwxrwx. 1 root root 23 Apr 7 16:55 dbus-org.freedesktop.locale1.service -> systemd-localed.service | ||
+ | lrwxrwxrwx. 1 root root 22 Apr 7 16:55 dbus-org.freedesktop.login1.service -> systemd-logind.service | ||
+ | lrwxrwxrwx. 1 root root 24 Apr 7 16:55 dbus-org.freedesktop.machine1.service -> systemd-machined.service | ||
+ | lrwxrwxrwx. 1 root root 25 Apr 7 16:55 dbus-org.freedesktop.portable1.service -> systemd-portabled.service | ||
+ | lrwxrwxrwx. 1 root root 25 Apr 7 16:55 dbus-org.freedesktop.timedate1.service -> systemd-timedated.service | ||
+ | -rw-r--r--. 1 root root 380 Apr 7 12:08 dbus.service | ||
+ | -rw-r--r--. 1 root root 102 Apr 7 12:08 dbus.socket | ||
+ | drwxr-xr-x. 2 root root 6 Apr 7 16:55 dbus.target.wants | ||
+ | -rw-r--r--. 1 root root 1084 Apr 7 16:55 debug-shell.service | ||
+ | lrwxrwxrwx. 1 root root 16 Apr 7 16:55 default.target -> graphical.target | ||
+ | drwxr-xr-x. 2 root root 6 Apr 7 16:55 default.target.wants | ||
+ | -rw-r--r--. 1 root root 750 Jun 22 2018 dev-hugepages.mount | ||
+ | -rw-r--r--. 1 root root 665 Jun 22 2018 dev-mqueue.mount | ||
+ | -r--r--r--. 1 root root 345 Aug 17 2020 dm-event.service | ||
+ | -r--r--r--. 1 root root 248 Aug 17 2020 dm-event.socket | ||
+ | -rw-r--r--. 1 root root 457 Jun 2 2020 dnf-makecache.service | ||
+ | --More-- | ||
+ | </ | ||
- | # Test syntax. | + | Certains fichiers de configuration |
- | if [ " | + | |
- | echo $" | + | |
- | return 1 | + | |
- | fi | + | |
- | if [ " | + | |
- | pid_file=$2 | + | |
- | shift 2 | + | |
- | fi | + | |
- | fail_code=3 # " | + | |
- | + | ||
- | # First try "/ | + | |
- | __pids_var_run " | + | |
- | RC=$? | + | |
- | if [ -n " | + | |
- | echo $pid | + | |
- | return 0 | + | |
- | fi | + | |
- | + | ||
- | [ -n " | + | |
- | __pids_pidof " | + | |
- | } | + | |
- | ... | + | |
- | </ | + | |
- | + | ||
- | ===Codes Retour Standardisés=== | + | |
- | + | ||
- | Les codes retour standardisés | + | |
- | + | ||
- | ^ Code Retour ^ Description ^ | + | |
- | | 0 | Le programme fonctionne et le service est correctement démarré | | + | |
- | | 1 | Le programme est mort et le fichier pid dans /var/run existe | | + | |
- | | 2 | Le programme est mort et le fichier verrou dans /var/lock existe | | + | |
- | | 3 | Le programme ne fonctionne pas et le service | + | |
- | | 4 | Le statut du programme ou du service est inconnu | | + | |
- | | 5 - 99 | Réservés pour LSB | | + | |
- | | 100-149 | Réserves pour la distribution | | + | |
- | | 150-199 | Réservés pour l' | + | |
- | | 200-254 | Réservés | | + | |
- | + | ||
- | ===Scripts=== | + | |
- | + | ||
- | LSB stipule un format //rigide// de script qui commence par une section délimitée par deux clauses : | + | |
- | + | ||
- | * **### BEGIN INIT INFO**, | + | |
- | * **### END INIT INFO**. | + | |
- | + | ||
- | Par exemple | + | |
< | < | ||
- | [root@centos5 | + | [root@centos8 |
- | # | + | total 0 |
- | # | + | |
- | # sshd Start up the OpenSSH server daemon | + | |
- | # | + | |
- | # chkconfig: 2345 55 25 | + | |
- | # description: | + | |
- | # This service starts up the OpenSSH server daemon. | + | |
- | # | + | |
- | # processname: | + | |
- | # config: / | + | |
- | # config: / | + | |
- | # config: / | + | |
- | # config: / | + | |
- | # pidfile: / | + | |
- | + | ||
- | ### BEGIN INIT INFO | + | |
- | # Provides: sshd | + | |
- | # Required-Start: | + | |
- | # Required-Stop: | + | |
- | # Should-Start: | + | |
- | # Should-Stop: | + | |
- | # Default-Start: | + | |
- | # Default-Stop: | + | |
- | # Short-Description: | + | |
- | # Description: | + | |
- | # This service starts up the OpenSSH server daemon. | + | |
- | ### END INIT INFO | + | |
- | + | ||
- | # source function library | + | |
- | . / | + | |
- | + | ||
- | # pull in sysconfig settings | + | |
- | [ -f / | + | |
- | --Plus--(20%) | + | |
</ | </ | ||
- | Les lignes se trouvant entre les deux clauses ont un format spécifique | + | Les fichiers de configuration des Unités crées par les utilisateurs doivent être mis dans le répertoire **/ |
< | < | ||
- | # {MotClef}: valeur1 | + | [root@centos8 ~]# pkg-config systemd --variable=systemduserunitdir |
+ | / | ||
</ | </ | ||
- | <WRAP center round important> | + | <WRAP center round important |
- | **Important** : Notez qu'à part la deuxième ligne de la description, | + | **Important** : De cette façon les fichiers dans **/ |
</ | </ | ||
- | Les Mots Clefs sont : | + | Prenons le cas du service **sshd** qui est configuré par le fichier **/ |
- | ^ Mot Clef ^ Description ^ | + | < |
- | | Provides | Indique le service -(//boot facilities// en anglais) démarré par le script. Le nom doit être unique. | | + | [root@centos8 ~]# cat /usr/lib/systemd/system/sshd.service |
- | | Required-start | Indique d' | + | [Unit] |
- | | Required-Stop | Indique d' | + | Description=OpenSSH server daemon |
- | | Should-Start | Indique d' | + | Documentation=man: |
- | | Should-Stop | Indique d' | + | After=network.target sshd-keygen.target |
- | | Default-Start | Indique les niveaux d' | + | Wants=sshd-keygen.target |
- | | Default-Stop | Indique les niveaux d' | + | |
- | | Short-Description | Indique une description du service en **une seule ligne**. | | + | |
- | | Description | Indique une description multi-lignes du service. | | + | |
- | Il existe des groupements de services, appelés en anglais des //Virtual Facilities//. Les plus importants sont : | + | [Service] |
+ | Type=notify | ||
+ | EnvironmentFile=-/etc/crypto-policies/back-ends/opensshserver.config | ||
+ | EnvironmentFile=-/ | ||
+ | ExecStart=/ | ||
+ | ExecReload=/ | ||
+ | KillMode=process | ||
+ | Restart=on-failure | ||
+ | RestartSec=42s | ||
- | ^ Virtual Facility ^ Description ^ | + | [Install] |
- | | $local_fs | Tous les systèmes de fichiers locaux doivent être montés. | | + | WantedBy=multi-user.target |
- | | $network | La carte Ethernet doit fonctionner | | + | |
- | | $named | Les daemons, si présents, responsables de la résolution des noms tels DNS, NIS+ ou LDAP doivent être démarrés. | | + | |
- | | $portmap | Les daemons qui fournissent le // | + | |
- | | $remote_fs | Tous les systèmes de fichiers doivent être montés. | | + | |
- | | $syslog | Syslog, Syslog-ng ou Rsyslog doit être démarré. | | + | |
- | | $time | L' | + | |
- | + | ||
- | ====Répertoires rcx.d==== | + | |
- | + | ||
- | Les répertoires **rc0.d** à **rc6.d** contiennent des liens vers les scripts du répertoire **init.d**. | + | |
- | + | ||
- | Pour mieux comprendre, saisissez les commandes suivantes : | + | |
- | + | ||
- | < | + | |
- | [root@centos5 rc.d]# for rep in rc[345].d; do echo "dans $rep :"; ls $rep/S*; done | + | |
- | dans rc3.d : | + | |
- | rc3.d/ | + | |
- | rc3.d/ | + | |
- | rc3.d/ | + | |
- | rc3.d/ | + | |
- | rc3.d/ | + | |
- | dans rc4.d : | + | |
- | rc4.d/ | + | |
- | rc4.d/ | + | |
- | rc4.d/ | + | |
- | rc4.d/ | + | |
- | rc4.d/ | + | |
- | dans rc5.d : | + | |
- | rc5.d/ | + | |
- | rc5.d/ | + | |
- | rc5.d/ | + | |
- | rc5.d/ | + | |
- | rc5.d/ | + | |
</ | </ | ||
- | <WRAP center round important> | + | Dans le fichier on peut noter la présence des lignes suivantes |
- | **Important** : Notez que chaque répertoire correspondant à un niveau d' | + | |
- | </ | + | |
- | Rappelez la commande précédente | + | * **Description=OpenSSH server daemon**, |
+ | * Cette directive est utilisée pour donner une courte description des fonctionnalités de l' | ||
+ | * **Documentation=man: | ||
+ | * Cette directive stipule les chapitres des manuels | ||
+ | | ||
+ | * Cette directive indique les cibles qui devraient être atteintes et les Unités qui devraient être démarrées avant l' | ||
+ | * **Wants=sshd-keygen.target**, | ||
+ | * Cette directive stipule une dépendance douce. Autrement dit, Systemd essayera de démarrer l' | ||
- | < | + | Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** : |
- | [root@centos5 rc.d]# for rep in rc[345].d; do echo "dans $rep :"; ls $rep/K*; done | + | |
- | dans rc3.d : | + | |
- | rc3.d/ | + | |
- | rc3.d/ | + | |
- | rc3.d/ | + | |
- | rc3.d/ | + | |
- | dans rc4.d : | + | |
- | rc4.d/ | + | |
- | rc4.d/ | + | |
- | rc4.d/ | + | |
- | rc4.d/ | + | |
- | dans rc5.d : | + | |
- | rc5.d/ | + | |
- | rc5.d/ | + | |
- | rc5.d/ | + | |
- | rc5.d/ | + | |
- | </ | + | |
- | <WRAP center round important> | + | |
- | **Important** : Ici le principe est le même sauf que la lettre | + | |
- | </ | + | |
+ | * Cette directive définit l' | ||
+ | | ||
+ | * Cette directive indique la commande necéssaire pour redémarrer le service, | ||
+ | * **KillMode=process**, | ||
+ | * Cette directive indique comment les processus du service doivent | ||
+ | | ||
+ | * Cette ligne indique que le service doit être re-démarré en cas d' | ||
+ | * **RestartSec=42s**, | ||
+ | * Cette directive stipule le temps d' | ||
- | ===rc.local=== | + | Dernièrement on note la présence de la ligne suivante dans la section **[Install]** : |
- | Le script rc.local est lancé dans les niveaux d' | + | * **WantedBy=multi-user.target**, |
+ | | ||
- | ====La Commande chkconfig==== | + | Pour consulter **l' |
- | + | ||
- | Pour avoir une vue globale | + | |
< | < | ||
- | [root@centos5 rc.d]# chkconfig | + | [root@centos8 ~]# systemctl show sshd |
- | NetworkManager 0: | + | Type=notify |
- | abrtd 0: | + | Restart=on-failure |
- | acpid 0: | + | NotifyAccess=main |
- | atd 0: | + | RestartUSec=42s |
- | auditd | + | TimeoutStartUSec=1min 30s |
- | autofs | + | TimeoutStopUSec=1min 30s |
- | avahi-daemon | + | RuntimeMaxUSec=infinity |
- | bluetooth | + | WatchdogUSec=0 |
- | certmonger | + | WatchdogTimestamp=Thu 2021-06-03 15:09:54 EDT |
- | cgconfig | + | WatchdogTimestampMonotonic=12502561 |
- | cgred 0: | + | PermissionsStartOnly=no |
- | cpuspeed | + | RootDirectoryStartOnly=no |
- | crond 0: | + | RemainAfterExit=no |
- | cups 0: | + | GuessMainPID=yes |
- | dnsmasq | + | MainPID=902 |
- | firstboot | + | ControlPID=0 |
- | haldaemon | + | FileDescriptorStoreMax=0 |
- | httpd 0: | + | NFileDescriptorStore=0 |
- | ip6tables | + | StatusErrno=0 |
- | iptables | + | Result=success |
- | irqbalance | + | UID=[not set] |
- | kdump 0: | + | GID=[not set] |
- | lvm2-monitor | + | NRestarts=0 |
- | mdmonitor | + | ExecMainStartTimestamp=Thu 2021-06-03 15:09:54 EDT |
- | messagebus | + | ExecMainStartTimestampMonotonic=12446178 |
- | microcode_ctl | + | ExecMainExitTimestampMonotonic=0 |
- | netconsole | + | ExecMainPID=902 |
- | netfs 0: | + | ExecMainCode=0 |
- | network | + | ExecMainStatus=0 |
- | nfs 0: | + | ExecStart={ path=/ |
- | nfslock | + | ExecReload={ path=/ |
- | nscd 0: | + | Slice=system.slice |
- | nslcd 0: | + | ControlGroup=/ |
- | ntpd 0: | + | MemoryCurrent=6270976 |
- | ntpdate | + | CPUUsageNSec=[not set] |
- | oddjobd | + | EffectiveCPUs= |
- | portreserve | + | EffectiveMemoryNodes= |
- | postfix | + | TasksCurrent=1 |
- | psacct | + | IPIngressBytes=18446744073709551615 |
- | rdisc 0: | + | IPIngressPackets=18446744073709551615 |
- | restorecond | + | IPEgressBytes=18446744073709551615 |
- | rpcbind | + | IPEgressPackets=18446744073709551615 |
- | rpcgssd | + | Delegate=no |
- | rpcidmapd | + | CPUAccounting=no |
- | rpcsvcgssd | + | CPUWeight=[not set] |
- | rsyslog | + | StartupCPUWeight=[not set] |
- | saslauthd | + | CPUShares=[not set] |
- | smartd | + | StartupCPUShares=[not set] |
- | snmpd 0: | + | CPUQuotaPerSecUSec=infinity |
- | snmptrapd | + | CPUQuotaPeriodUSec=infinity |
- | sshd | + | AllowedCPUs= |
- | sssd | + | AllowedMemoryNodes= |
- | sysstat | + | IOAccounting=no |
- | udev-post | + | IOWeight=[not set] |
- | vboxadd | + | StartupIOWeight=[not set] |
- | vboxadd-service 0: | + | BlockIOAccounting=no |
- | vboxadd-x11 | + | BlockIOWeight=[not set] |
- | wpa_supplicant 0: | + | lines 1-57 |
- | ypbind | + | |
</ | </ | ||
- | ===Options de la commande=== | + | Pour consulter |
- | + | ||
- | Les options de la commande | + | |
< | < | ||
- | [root@centos5 | + | [root@centos8 |
- | chkconfig version 1.3.47 - Copyright (C) 1997-2000 Red Hat, Inc. | + | sshd.service |
- | Ce logiciel peut être librement distribué selon les termes de la licence publique GNU (GPL). | + | ● ├─system.slice |
- | + | ● ├─sshd-keygen.target | |
- | utilisation : | + | ● │ ├─sshd-keygen@ecdsa.service |
- | | + | ● │ ├─sshd-keygen@ed25519.service |
- | | + | ● │ └─sshd-keygen@rsa.service |
- | chkconfig | + | ● └─sysinit.target |
- | chkconfig [--level < | + | ● |
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● │ ├─-.mount | ||
+ | ● │ ├─boot.mount | ||
+ | ● │ └─systemd-remount-fs.service | ||
+ | ● | ||
+ | ● | ||
</ | </ | ||
- | Les options les plus importantes sont : | + | ===2.2 - Surchargement des Fichiers de Configuration par Défaut=== |
- | ^ Option ^ Description ^ | + | Les fichiers |
- | | - -add (nom) | Permet d' | + | |
- | | - -del (nom) | Permet | + | |
- | | %%- -level [niveau] (nom) [on|off|reset]%% | + | |
- | + | ||
- | =====Démarrer RHEL/CentOS 6 avec Upstart===== | + | |
- | + | ||
- | **Upstart** est un processus Init mieux adapté aux exigences | + | |
- | + | ||
- | ====Inittab==== | + | |
- | + | ||
- | Sous Upstart, le fichier / | + | |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | # inittab is only used by upstart for the default runlevel. | + | /etc/systemd/ |
- | # | + | |
- | # ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. | + | |
- | # | + | |
- | # System initialization is started by /etc/init/rcS.conf | + | |
- | # | + | |
- | # Individual runlevels are started by /etc/init/rc.conf | + | |
- | # | + | |
- | # Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf | + | |
- | # | + | |
- | # Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf, | + | |
- | # with configuration in /etc/sysconfig/init. | + | |
- | # | + | |
- | # For information on how to write upstart event handlers, or how | + | |
- | # upstart works, see init(5), init(8), and initctl(8). | + | |
- | # | + | |
- | # Default runlevel. The runlevels used are: | + | |
- | # 0 - halt (Do NOT set initdefault to this) | + | |
- | # 1 - Single user mode | + | |
- | # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) | + | |
- | # 3 - Full multiuser mode | + | |
- | # 4 - unused | + | |
- | # 5 - X11 | + | |
- | # 6 - reboot (Do NOT set initdefault to this) | + | |
- | # | + | |
- | id: | + | |
</ | </ | ||
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | # inittab is only used by upstart for the default runlevel. | + | total 4 |
- | # | + | drwxr-xr-x. 2 root root 31 May 8 2020 basic.target.wants |
- | # ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. | + | lrwxrwxrwx. 1 root root 41 May 8 2020 dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/ |
- | # | + | lrwxrwxrwx. 1 root root 44 Jun 3 14:02 dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/ |
- | # System initialization is started by /etc/init/rcS.conf | + | lrwxrwxrwx. 1 root root 57 May 8 2020 dbus-org.freedesktop.nm-dispatcher.service |
- | # | + | lrwxrwxrwx. 1 root root 41 May 8 2020 dbus-org.freedesktop.timedate1.service -> /usr/lib/systemd/system/timedatex.service |
- | # Individual runlevels are started by /etc/init/rc.conf | + | lrwxrwxrwx. 1 root root 37 May 8 2020 default.target -> /lib/systemd/system/ |
- | # | + | drwxr-xr-x. 2 root root 32 May 8 2020 getty.target.wants |
- | # Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf | + | drwxr-xr-x. 2 root root 4096 Jun 3 14:02 multi-user.target.wants |
- | # | + | drwxr-xr-x. 2 root root 48 May |
- | # Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf, | + | drwxr-xr-x. 2 root root 33 Apr 19 12:07 nfs-blkmap.service.requires |
- | # with configuration in /etc/sysconfig/init. | + | drwxr-xr-x. 2 root root |
- | # | + | drwxr-xr-x. 2 root root |
- | # For information on how to write upstart event handlers, or how | + | drwxr-xr-x. |
- | # upstart works, see init(5), init(8), and initctl(8). | + | drwxr-xr-x. 2 root root |
- | # | + | drwxr-xr-x. 2 root root 52 Apr 19 12:07 remote-fs.target.wants |
- | # Default runlevel. The runlevels used are: | + | drwxr-xr-x. 2 root root |
- | # | + | drwxr-xr-x. 2 root root |
- | # | + | drwxr-xr-x. 2 root root |
- | # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) | + | drwxr-xr-x. 2 root root 260 Jun 3 14:02 sockets.target.wants |
- | # 3 - Full multiuser mode | + | drwxr-xr-x. 2 root root 235 Apr 19 12:07 sysinit.target.wants |
- | # | + | lrwxrwxrwx. 1 root root 39 May 8 2020 syslog.service -> / |
- | # | + | lrwxrwxrwx. 1 root root 9 May 11 2019 systemd-timedated.service -> /dev/null |
- | # | + | drwxr-xr-x. 2 root root 34 May 8 2020 timers.target.wants |
- | # | + | |
- | id: | + | |
</ | </ | ||
- | Sous Upstart, les définitions des autres valeurs habituellement incluses dans / | + | ====LAB #3 - La Commande systemd-analyze==== |
+ | |||
+ | Pour avoir une évaluation du temps de démarrage, il convient d' | ||
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | total 68 | + | Startup finished in 1.665s (kernel) + 6.977s (initrd) + 8.458s (userspace) = 17.101s |
- | -rw-r--r--. | + | multi-user.target reached after 5.528s in userspace |
- | -rw-r--r--. 1 root root 130 12 mars 2014 init-system-dbus.conf | + | |
- | -rw-r--r--. 1 root root 463 22 juil. 2014 kexec-disable.conf | + | |
- | -rw-r--r--. 1 root root 560 22 juil. 2014 plymouth-shutdown.conf | + | |
- | -rw-r--r--. 1 root root 357 22 juil. 2014 prefdm.conf | + | |
- | -rw-r--r--. 1 root root 505 22 juil. 2014 quit-plymouth.conf | + | |
- | -rw-r--r--. 1 root root 417 22 juil. 2014 rc.conf | + | |
- | -rw-r--r--. 1 root root 1046 22 juil. 2014 rcS.conf | + | |
- | -rw-r--r--. 1 root root 430 22 juil. 2014 rcS-emergency.conf | + | |
- | -rw-r--r--. 1 root root 725 22 juil. 2014 rcS-sulogin.conf | + | |
- | -rw-r--r--. 1 root root 2915 23 nov. 2013 readahead-collector.conf | + | |
- | -rw-r--r--. 1 root root 1559 23 nov. 2013 readahead.conf | + | |
- | -rw-r--r--. 1 root root 726 23 nov. 2013 readahead-disable-services.conf | + | |
- | -rw-r--r--. 1 root root 1302 22 juil. 2014 serial.conf | + | |
- | -rw-r--r--. 1 root root 791 22 juil. 2014 splash-manager.conf | + | |
- | -rw-r--r--. 1 root root 473 22 juil. 2014 start-ttys.conf | + | |
- | -rw-r--r--. 1 root root 335 22 juil. 2014 tty.conf | + | |
</ | </ | ||
- | ===Initialisation du Système=== | + | L'option |
- | + | ||
- | L'initialisation du système est configurée dans le fichier | + | |
< | < | ||
- | [root@centos6 init]# cat / | + | [root@centos8 ~]# systemd-analyze blame |
- | # rcS - runlevel compatibility | + | 4.080s dracut-initqueue.service |
- | # | + | |
- | # This task runs the old sysv-rc startup scripts. | + | 1.727s tuned.service |
- | + | 1.415s initrd-switch-root.service | |
- | start on startup | + | |
- | + | | |
- | stop on runlevel | + | |
- | + | 850ms sssd.service | |
- | task | + | 791ms vdo.service |
- | + | 713ms firewalld.service | |
- | # Note: there can be no previous runlevel here, if we have one it's bad | + | 622ms lvm2-monitor.service |
- | # information (we enter rc1 not rcS for maintenance). Run /etc/rc.d/rc | + | 605ms polkit.service |
- | # without information so that it defaults to previous=N runlevel=S. | + | 508ms chronyd.service |
- | console output | + | 434ms avahi-daemon.service |
- | exec /etc/rc.d/rc.sysinit | + | 426ms systemd-logind.service |
- | post-stop script | + | 417ms netcf-transaction.service |
- | if [ " | + | 410ms dracut-pre-udev.service |
- | [ -f / | + | 295ms libvirtd.service |
- | [ -z " | + | 275ms dnf-makecache.service |
- | for t in $(cat / | + | 243ms systemd-udevd.service |
- | case $t in | + | 221ms systemd-journald.service |
- | -s|single|S|s) runlevel=" | + | 196ms systemd-tmpfiles-setup.service |
- | [1-9]) | + | 151ms dracut-pre-pivot.service |
- | esac | + | 139ms sysroot.mount |
- | done | + | 139ms systemd-update-utmp-runlevel.service |
- | exec telinit $runlevel | + | 122ms systemd-vconsole-setup.service |
- | fi | + | 110ms lvm2-pvscan@8:25.service |
- | end script | + | 98ms systemd-udev-trigger.service |
+ | 82ms gssproxy.service | ||
+ | 81ms cups.service | ||
+ | 79ms initrd-parse-etc.service | ||
+ | 77ms NetworkManager.service | ||
+ | 72ms lvm2-pvscan@8: | ||
+ | 69ms systemd-user-sessions.service | ||
+ | 68ms lvm2-pvscan@8: | ||
+ | 67ms unbound-anchor.service | ||
+ | 66ms rsyslog.service | ||
+ | 62ms boot.mount | ||
+ | 56ms sshd.service | ||
+ | 54ms smartd.service | ||
+ | 54ms systemd-fsck@dev-disk-by\x2duuid-2ae4c035\x2d9244\x2d458c\x2d82c5\x2da49ae169cdb6.service | ||
+ | 53ms user@1000.service | ||
+ | 52ms auditd.service | ||
+ | 51ms plymouth-quit.service | ||
+ | 49ms rngd-wake-threshold.service | ||
+ | 46ms import-state.service | ||
+ | 46ms systemd-tmpfiles-setup-dev.service | ||
+ | 43ms ksmtuned.service | ||
+ | 42ms plymouth-quit-wait.service | ||
+ | 42ms var-lib-nfs-rpc_pipefs.mount | ||
+ | 42ms rpc-statd-notify.service | ||
+ | 38ms plymouth-switch-root.service | ||
+ | 37ms systemd-remount-fs.service | ||
+ | 37ms plymouth-start.service | ||
+ | 33ms dev-disk-by\x2duuid-c8bb3f47\x2dd67f\x2d4b21\x2db781\x2d766899dc83d4.swap | ||
+ | 33ms systemd-tmpfiles-clean.service | ||
+ | 31ms dev-hugepages.mount | ||
+ | lines 1-57 | ||
</ | </ | ||
- | ===Runlevels=== | + | L' |
- | + | ||
- | La gestion des Runlevels est configurée dans le fichier | + | |
< | < | ||
- | [root@centos6 init]# cat / | + | [root@centos8 ~]# systemd-analyze critical-chain sshd.service |
- | # rc - System V runlevel compatibility | + | The time after the unit is active or started |
- | # | + | The time the unit takes to start is printed after the " |
- | # This task runs the old sysv-rc runlevel scripts. It | + | |
- | # is usually | + | |
- | + | ||
- | start on runlevel [0123456] | + | |
- | + | ||
- | stop on runlevel [!$RUNLEVEL] | + | |
- | task | + | sshd.service +56ms |
- | + | └─network.target @3.799s | |
- | export RUNLEVEL | + | |
- | console output | + | |
- | exec /etc/rc.d/rc $RUNLEVEL | + | └─firewalld.service @3.004s +713ms |
+ | └─polkit.service @2.397s +605ms | ||
+ | └─basic.target @2.392s | ||
+ | └─sockets.target @2.392s | ||
+ | └─sssd-kcm.socket @2.391s | ||
+ | └─sysinit.target @2.379s | ||
+ | └─systemd-update-utmp.service @2.370s +8ms | ||
+ | └─auditd.service @2.317s +52ms | ||
+ | └─systemd-tmpfiles-setup.service @2.118s +196ms | ||
+ | └─import-state.service @2.070s +46ms | ||
+ | └─local-fs.target @2.069s | ||
+ | └─boot.mount @2.006s +62ms | ||
+ | └─systemd-fsck@dev-disk-by\x2duuid-2ae4c035\x2d9244\x2d458c\x2d82c5\x2da49ae169cdb6.service @1.943s +54ms | ||
+ | └─local-fs-pre.target @1.942s | ||
+ | └─lvm2-monitor.service @1.319s +622ms | ||
+ | └─dm-event.socket @1.317s | ||
+ | └─-.mount | ||
+ | └─system.slice | ||
+ | | ||
</ | </ | ||
- | ===[CTL]-[ALT]-[DEL]=== | + | Les options de la commande |
- | + | ||
- | Le comportement associé avec la combinaison de touches [CTL]-[ALT]-[DEL] est configuré dans le fichier | + | |
< | < | ||
- | [root@centos6 init]# cat / | + | [root@centos7 ~]# systemd-analyze |
- | # control-alt-delete - emergency keypress handling | + | systemd-analyze [OPTIONS...] {COMMAND} ... |
- | # | + | |
- | # This task is run whenever the Control-Alt-Delete key combination is | + | |
- | # pressed. | + | |
- | start on control-alt-delete | + | Process systemd profiling information |
- | exec / | + | |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | When generating a dependency graph, filter only origins | ||
+ | or destinations, | ||
+ | | ||
+ | services, which finished TIMESPAN earlier, than the | ||
+ | latest in the branch. The unit of TIMESPAN is seconds | ||
+ | unless specified with a different unit, i.e. 50ms | ||
+ | | ||
+ | |||
+ | Commands: | ||
+ | time Print time spent in the kernel before reaching userspace | ||
+ | blame Print list of running units ordered by time to init | ||
+ | critical-chain | ||
+ | plot Output SVG graphic showing service initialization | ||
+ | dot | ||
+ | set-log-level LEVEL Set logging threshold for systemd | ||
+ | dump Output state serialization of service manager | ||
</ | </ | ||
- | ===mingetty=== | + | ====LAB #4 - Les Cibles Systemd==== |
- | Le génération des terminaux getty est spécifiée dans les fichiers **/ | + | Chaque Cible est décrite par un fichier de configuration |
< | < | ||
- | [root@centos6 init]# cat /etc/init/tty.conf | + | [root@centos8 ~]# cat /usr/lib/systemd/ |
- | # tty - getty | + | # SPDX-License-Identifier: |
# | # | ||
- | # This service maintains a getty on the sepcified device. | + | # This file is part of systemd. |
- | + | ||
- | stop on runlevel [016] | + | |
- | + | ||
- | respawn | + | |
- | instance $TTY | + | |
- | exec / | + | |
- | [root@centos rc.d]# cat / | + | |
- | # Automatically start a configured serial console | + | |
- | # | + | |
- | # How this works: | + | |
- | # | + | |
- | # On boot, a udev helper examines / | + | |
- | # primary console (last console on the commandline in grub), | + | |
- | # ' | + | |
- | # triggers this script. It waits for the runlevel to finish, ensures | + | |
- | # the proper port is in / | + | |
# | # | ||
- | # If your serial console | + | # |
- | # on serial even if it's not the console, create your own event by copying | + | # |
- | # / | + | # the Free Software Foundation; either version 2.1 of the License, or |
+ | # (at your option) any later version. | ||
- | start on fedora.serial-console-available DEV=* and stopped rc RUNLEVEL=[2345] | + | [Unit] |
- | stop on runlevel [016] | + | Description=Graphical Interface |
- | + | Documentation=man: | |
- | instance $DEV | + | Requires=multi-user.target |
- | respawn | + | Wants=display-manager.service |
- | pre-start exec / | + | Conflicts=rescue.service rescue.target |
- | exec / | + | After=multi-user.target rescue.service rescue.target display-manager.service |
+ | AllowIsolate=yes | ||
</ | </ | ||
- | La configuration des terminaux fait partie du fichier | + | Dans ce fichier |
- | < | + | * **Requires=multi-user.target**, |
- | [root@centos6 init]# cat / | + | * Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n' |
- | # color => new RH6.0 bootup | + | * **After=multi-user.target rescue.service rescue.target display-manager.service**, |
- | # verbose => old-style bootup | + | * Cette ligne indique le **multi-user.target** et **rescue.target** doivent d'abord être atteints et que les services **rescue.service** et **display-manager.service** doivent d'abord être démarrés, |
- | # anything else => new style bootup without ANSI colors or positioning | + | * **Conflicts=rescue.service rescue.target**, |
- | BOOTUP=color | + | * Cette ligne indique la Cible et le service en conflits avec le **graphical.target**, |
- | # column to start " | + | * **Wants=display-manager.service**, |
- | RES_COL=60 | + | * Cette ligne indique quel service doit être démarré. |
- | # terminal sequence to move to that column. You could change this | + | |
- | # to something like "tput hpa ${RES_COL}" | + | |
- | MOVE_TO_COL=" | + | |
- | # terminal sequence to set color to a 'success' | + | |
- | SETCOLOR_SUCCESS=" | + | |
- | # terminal sequence to set color to a ' | + | |
- | SETCOLOR_FAILURE=" | + | |
- | # terminal sequence to set color to a ' | + | |
- | SETCOLOR_WARNING=" | + | |
- | # terminal sequence to reset to the default color. | + | |
- | SETCOLOR_NORMAL=" | + | |
- | # Set to anything other than 'no' to allow hotkey interactive startup... | + | |
- | PROMPT=yes | + | |
- | # Set to 'yes' to allow probing for devices with swap signatures | + | |
- | AUTOSWAP=no | + | |
- | # What ttys should gettys be started on? | + | |
- | ACTIVE_CONSOLES=/dev/tty[1-6] | + | |
- | # Set to '/ | + | |
- | # Set to '/ | + | |
- | SINGLE=/ | + | |
- | </ | + | |
- | ====Gestion des Services==== | + | ===4.1 - Contrôler les dépendances d'une Cible=== |
- | Sous Upstart, les services sont appelés des **jobs**. | + | Les dépendances d'une Cible peuvent être consultées en utilisant la commande |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | control-alt-delete.conf rcS-sulogin.conf | + | multi-user.target |
- | init-system-dbus.conf readahead-collector.conf | + | ● ├─atd.service |
- | kexec-disable.conf | + | ● ├─auditd.service |
- | plymouth-shutdown.conf | + | ● ├─avahi-daemon.service |
- | prefdm.conf serial.conf | + | ● ├─chronyd.service |
- | quit-plymouth.conf | + | ● ├─crond.service |
- | rc.conf start-ttys.conf | + | ● ├─cups.path |
- | rcS.conf tty.conf | + | ● ├─cups.service |
- | rcS-emergency.conf | + | ● ├─dbus.service |
+ | ● ├─dnf-makecache.timer | ||
+ | ● ├─firewalld.service | ||
+ | ● ├─irqbalance.service | ||
+ | ● ├─kdump.service | ||
+ | ● ├─ksm.service | ||
+ | ● ├─ksmtuned.service | ||
+ | ● ├─libstoragemgmt.service | ||
+ | ● ├─libvirtd.service | ||
+ | ● ├─mcelog.service | ||
+ | ● ├─mdmonitor.service | ||
+ | ● ├─netcf-transaction.service | ||
+ | ● ├─NetworkManager.service | ||
+ | ● ├─plymouth-quit-wait.service | ||
+ | ● ├─plymouth-quit.service | ||
+ | ● ├─rpcbind.service | ||
+ | ● ├─rsyslog.service | ||
+ | ● ├─smartd.service | ||
+ | ● ├─sshd.service | ||
+ | ● ├─sssd.service | ||
+ | ● ├─systemd-ask-password-wall.path | ||
+ | ● ├─systemd-logind.service | ||
+ | ● ├─systemd-update-utmp-runlevel.service | ||
+ | ● ├─systemd-user-sessions.service | ||
+ | ● ├─tuned.service | ||
+ | ● ├─vdo.service | ||
+ | ● ├─basic.target | ||
+ | ● │ ├─-.mount | ||
+ | ● │ ├─microcode.service | ||
+ | ● │ ├─paths.target | ||
+ | ● │ ├─slices.target | ||
+ | ● │ │ ├─-.slice | ||
+ | ● │ │ └─system.slice | ||
+ | ● │ ├─sockets.target | ||
+ | ● │ │ ├─avahi-daemon.socket | ||
+ | ● │ │ ├─cups.socket | ||
+ | ● │ │ ├─dbus.socket | ||
+ | ● │ │ ├─dm-event.socket | ||
+ | ● │ │ ├─iscsid.socket | ||
+ | ● │ │ ├─iscsiuio.socket | ||
+ | ● │ │ ├─libvirtd-ro.socket | ||
+ | ● │ │ ├─libvirtd.socket | ||
+ | ● │ │ ├─rpcbind.socket | ||
+ | ● │ │ ├─sssd-kcm.socket | ||
+ | ● │ │ ├─systemd-coredump.socket | ||
+ | ● │ │ ├─systemd-initctl.socket | ||
+ | ● │ │ ├─systemd-journald-dev-log.socket | ||
+ | ● │ │ ├─systemd-journald.socket | ||
+ | ● │ │ ├─systemd-udevd-control.socket | ||
+ | lines 1-57 | ||
</ | </ | ||
- | Pour créer un fichier job, il convient | + | Les points noirs au début |
- | <file txt testjob.conf> | + | * **Vert** implique que le service, la cible ou l' |
- | description "Un job pour tester Upstart" | + | * **Blanc** implique |
- | author "Linux E-Learning" | + | * **Rouge** implique que le service, la cible ou l' |
- | start on runlevel [2345] | + | |
- | exec echo Le job test a été lancé | + | |
- | </ | + | |
- | ===La Commande initctl=== | + | Pour visualiser |
- | + | ||
- | Pour obtenir une liste de tous les jobs et leurs états, il convient | + | |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | rc stop/ | + | 0 loaded units listed. Pass --all to see loaded but inactive units, too. |
- | tty (/dev/tty3) start/ | + | To show all installed unit files use ' |
- | tty (/dev/tty2) start/ | + | |
- | tty (/dev/tty6) start/ | + | |
- | tty (/dev/tty5) start/ | + | |
- | tty (/dev/tty4) start/ | + | |
- | plymouth-shutdown stop/ | + | |
- | control-alt-delete stop/ | + | |
- | rcS-emergency stop/ | + | |
- | readahead-collector stop/ | + | |
- | kexec-disable stop/ | + | |
- | quit-plymouth stop/ | + | |
- | testjob stop/ | + | |
- | rcS stop/ | + | |
- | prefdm start/ | + | |
- | init-system-dbus stop/ | + | |
- | readahead stop/ | + | |
- | splash-manager stop/ | + | |
- | start-ttys stop/ | + | |
- | readahead-disable-services stop/ | + | |
- | rcS-sulogin stop/ | + | |
- | serial stop/ | + | |
</ | </ | ||
- | ==Option de la Commande initctl== | + | Les dépendances sont créés sous la forme de liens symboliques dans les répertoires |
- | + | ||
- | Les options de la commande | + | |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | Usage: initctl [OPTION]... COMMAND [OPTION]... [ARG]... | + | total 0 |
- | + | lrwxrwxrwx. 1 root root 35 May 8 2020 atd.service -> / | |
- | Options: | + | lrwxrwxrwx. 1 root root 38 May 8 2020 auditd.service -> / |
- | --system | + | lrwxrwxrwx. 1 root root 44 Jun 3 14:02 avahi-daemon.service -> / |
- | --dest=NAME | + | lrwxrwxrwx. 1 root root 39 May 8 2020 chronyd.service -> / |
- | -q, --quiet | + | lrwxrwxrwx. 1 root root 37 May 8 2020 crond.service -> / |
- | -v, --verbose | + | lrwxrwxrwx. 1 root root 33 Jun 3 14:02 cups.path -> / |
- | --help display this help and exit | + | lrwxrwxrwx. 1 root root 36 Jun 3 14:02 cups.service |
- | --version | + | lrwxrwxrwx. 1 root root 43 May 8 2020 dnf-makecache.timer -> / |
- | + | lrwxrwxrwx. 1 root root 41 May 8 2020 firewalld.service -> / | |
- | For a list of commands, try `initctl help'. | + | lrwxrwxrwx. 1 root root 42 May 8 2020 irqbalance.service |
- | + | lrwxrwxrwx. 1 root root 37 May 8 2020 kdump.service | |
- | Report bugs at <https://launchpad.net/upstart/+bugs> | + | lrwxrwxrwx. 1 root root 35 Apr 19 12:07 ksm.service |
+ | lrwxrwxrwx. 1 root root 40 Apr 19 12:07 ksmtuned.service -> / | ||
+ | lrwxrwxrwx. 1 root root 46 May 8 2020 libstoragemgmt.service | ||
+ | lrwxrwxrwx. 1 root root 40 Apr 19 12:07 libvirtd.service | ||
+ | lrwxrwxrwx. 1 root root 38 May 8 2020 mcelog.service | ||
+ | lrwxrwxrwx. 1 root root 41 May 8 2020 mdmonitor.service | ||
+ | lrwxrwxrwx. 1 root root 49 Apr 19 12:07 netcf-transaction.service | ||
+ | lrwxrwxrwx. 1 root root 46 May 8 2020 NetworkManager.service | ||
+ | lrwxrwxrwx. 1 root root 41 Apr 19 12:07 nfs-client.target -> / | ||
+ | lrwxrwxrwx. 1 root root 40 May 8 2020 remote-fs.target | ||
+ | lrwxrwxrwx. 1 root root 39 Apr 19 12:07 rpcbind.service -> / | ||
+ | lrwxrwxrwx. 1 root root 39 May 8 2020 rsyslog.service -> / | ||
+ | lrwxrwxrwx. 1 root root 38 May 8 2020 smartd.service -> / | ||
+ | lrwxrwxrwx. 1 root root 36 May 8 2020 sshd.service -> /usr/lib/ | ||
+ | lrwxrwxrwx. 1 root root 36 May 8 2020 sssd.service -> /usr/lib/ | ||
+ | lrwxrwxrwx. 1 root root 37 May 8 2020 tuned.service -> / | ||
+ | lrwxrwxrwx. 1 root root 35 May 8 2020 vdo.service -> / | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 0 | ||
+ | lrwxrwxrwx. 1 root root 15 Apr 7 12:08 dbus.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 15 Apr 7 16:55 getty.target -> ../ | ||
+ | lrwxrwxrwx. 1 root root 24 Oct 6 2020 plymouth-quit.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 29 Oct 6 2020 plymouth-quit-wait.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 33 Apr 7 16:55 systemd-ask-password-wall.path -> ../ | ||
+ | lrwxrwxrwx. 1 root root 25 Apr 7 16:55 systemd-logind.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 39 Apr 7 16:55 systemd-update-utmp-runlevel.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 32 Apr 7 16:55 systemd-user-sessions.service -> ../ | ||
</ | </ | ||
- | ===Jobs=== | + | ===4.2 - La Cible par Défaut=== |
- | Il existe trois types de jobs sous Upstart : | + | ==Consulter la Cible par Défaut== |
- | | + | Pour consulter la cible par défaut, il convient d' |
- | * **service** | + | |
- | * un service job peut fonctionner en arrière plan | + | |
- | * **abstract** | + | |
- | * un abstract job est un service qui fonctionnent jusqu' | + | |
- | ===Événements=== | + | < |
+ | [root@centos8 ~]# systemctl get-default | ||
+ | multi-user.target | ||
+ | </ | ||
- | Un événement ou //event// en anglais est un signal envoyé vers un job pour déclencher une action. Par exemple | + | La Cible par défaut est représentée par le lien symbolique **/etc/systemd/system/default.target** |
- | * **starting** | + | < |
- | * **started** | + | [root@centos8 ~]# ls -l / |
- | | + | lrwxrwxrwx. 1 root root 37 May 8 2020 / |
- | * **stopped** | + | </ |
- | ===Etats=== | + | ==Modifier la Cible par Défaut== |
- | L' | + | Pour modifier la Cible par défaut avec une prise en compte lors du **prochain** démarrage, il convient |
- | * **waiting** - l' | + | < |
- | * **starting** | + | [root@centos8 ~]# systemctl set-default graphical.target |
- | * **pre-start** - la section pre-start est chargée | + | Removed / |
- | * **spawned** - une section script est sur le point de démarrer | + | Created symlink / |
- | * **post-start** | + | [root@centos8 ~]# ls -l / |
- | | + | lrwxrwxrwx. 1 root root 40 Jun 6 08:11 / |
- | * **pre-stop** | + | [root@centos8 ~]# systemctl set-default multi-user.target |
- | * **stopping** | + | Removed / |
- | * **killed** | + | Created symlink / |
- | | + | [root@centos8 ~]# ls -l / |
- | + | lrwxrwxrwx. 1 root root 41 Jun 6 08:11 / | |
- | ===Démarrer et Arrêter les Jobs=== | + | </ |
- | + | ||
- | Compte tenu de la compatibilité avec le système SysVinit, les commandes traditionnellement utilisées avec ce dernier sont compris par Upstart. Ceci étant Upstart fournit ses propres commandes pour le contrôle des jobs. | + | |
- | ==La Commande status== | + | ==Modifier la Cible en Cours== |
- | Pour voir le status d'un job spécifique, | + | Il est possible de modifier la cible actuellement en cours en utilisant |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | testjob stop/ | + | [root@centos8 ~]# systemctl list-units --type target | egrep " |
+ | rescue.target | ||
+ | [root@centos8 ~]# runlevel | ||
+ | 3 1 | ||
+ | [root@centos8 ~]# who -r | ||
+ | | ||
</ | </ | ||
- | |||
- | ==Options de la Commande status== | ||
- | |||
- | Les options de la commande **status** sont : | ||
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | Usage: status | + | [root@centos8 ~]# systemctl list-units --type target | egrep " |
- | Query status of job. | + | multi-user.target |
+ | [root@centos8 ~]# runlevel | ||
+ | 1 3 | ||
+ | [root@centos8 ~]# who -r | ||
+ | | ||
+ | </ | ||
- | Options: | + | ====LAB #5 - Gestion des Services==== |
- | | + | |
- | --dest=NAME | + | |
- | -q, --quiet | + | |
- | -v, --verbose | + | |
- | --help | + | |
- | --version | + | |
- | JOB is the name of the job that is to be queried, this may be followed by zero | + | ===5.1 - Gestion des Instances Uniques=== |
- | or more environment variables to distguish between job instances. | + | |
+ | Commencez par installer le paquet **httpd** : | ||
- | Report bugs at <https:// | + | <code> |
+ | [root@centos8 ~]# dnf install httpd | ||
</ | </ | ||
- | ==La Commande start== | + | Pour obtenir le détail sur un service donné, il convient d' |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | testjob start/ | + | ● httpd.service - The Apache HTTP Server |
- | [root@centos ~]# cat /var/log/testjob.log | + | Loaded: loaded (/usr/lib/systemd/ |
- | Le job test a été lancé le Tue Jun 30 15:26:10 CEST 2015 | + | Active: inactive (dead) |
+ | Docs: man: | ||
</ | </ | ||
- | ==Options | + | Dans le cas du service httpd ci-dessus, on peut constater que le statut est **disabled**. Le statut peut être une de 2 valeurs : |
- | Les options | + | * **disabled** - le service ne démarrera pas lors du prochain démarrage du système. |
+ | * **enabled** - le service démarrera lors du prochain démarrage du système. | ||
+ | |||
+ | Il est possible | ||
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | Usage: start [OPTION]... JOB [KEY=VALUE]... | + | disabled |
- | Start job. | + | |
- | + | ||
- | Options: | + | |
- | -n, --no-wait | + | |
- | --system | + | |
- | --dest=NAME | + | |
- | -q, --quiet | + | |
- | -v, --verbose | + | |
- | --help | + | |
- | --version | + | |
- | + | ||
- | JOB is the name of the job that is to be started, this may be followed by zero | + | |
- | or more environment variables to be defined in the new job. | + | |
- | + | ||
- | The environment may also serve to distinguish between job instances, and thus | + | |
- | decide whether a new instance will be started or an error returned if an | + | |
- | existing instance is already running. | + | |
- | + | ||
- | Report bugs at < | + | |
</ | </ | ||
- | ==La Commande stop== | + | Pour rendre le statut |
- | + | ||
- | Pour arrêter un job, utilisez la commande | + | |
- | + | ||
- | ==Options de la Commande stop== | + | |
- | + | ||
- | Les options de la commande **stop** sont : | + | |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | Usage: stop [OPTION]... JOB [KEY=VALUE]... | + | Created symlink / |
- | Stop job. | + | |
- | + | ||
- | Options: | + | |
- | -n, --no-wait | + | |
- | --system | + | |
- | --dest=NAME | + | |
- | -q, --quiet | + | |
- | -v, --verbose | + | |
- | --help | + | |
- | --version | + | |
- | + | ||
- | JOB is the name of the job that is to be stopped, this may be followed by zero | + | |
- | or more environment variables to be passed to the job's pre-stop and post-stop | + | |
- | processes. | + | |
- | + | ||
- | The environment also serves to distinguish between job instances, and thus | + | |
- | decide which of multiple instances will be stopped. | + | |
- | Report bugs at < | + | [root@centos8 ~]# systemctl is-enabled httpd.service |
+ | enabled | ||
+ | [root@centos8 ~]# systemctl status httpd.service | ||
+ | ● httpd.service - The Apache HTTP Server | ||
+ | | ||
+ | | ||
+ | Docs: man: | ||
</ | </ | ||
- | ==La Commande restart== | + | Dans le cas du service httpd ci-dessus, on peut maintenant constater que l' |
- | Pour redémarrer | + | * **inactive (dead)** - le service est arrêté. |
+ | * **active(running** - le service est démarré avec un ou plusieurs processus. | ||
+ | * **active(exited)** - le service a terminé une configuration unique. | ||
+ | * **active(waiting)** - le service est démarré mais en attente d'un évènement. | ||
+ | * **activating** - le service est en cours d' | ||
+ | * **deactivating** - le service est en cours de désactivation. | ||
+ | * **failed** - le service a rencontré une erreur fatale. | ||
- | ==Options | + | Il est possible |
- | + | ||
- | Les options de la commande **restart** sont : | + | |
< | < | ||
- | [root@centos6 | + | [root@centos8 |
- | Usage: restart [OPTION]... JOB [KEY=VALUE]... | + | inactive |
- | Restart job. | + | |
- | + | ||
- | Options: | + | |
- | -n, --no-wait | + | |
- | --system | + | |
- | --dest=NAME | + | |
- | -q, --quiet | + | |
- | -v, --verbose | + | |
- | --help | + | |
- | --version | + | |
- | + | ||
- | JOB is the name of the job that is to be restarted, this may be followed by | + | |
- | zero or more environment variables to be defined in the job after restarting. | + | |
- | + | ||
- | The environment also serves to distinguish between job instances, and thus | + | |
- | decide which of multiple instances will be restarted. | + | |
- | + | ||
- | Report bugs at < | + | |
</ | </ | ||
- | <WRAP center round important> | + | Pour rendre l'état **active(running)**, utilisez |
- | Il est aussi possible d'utiliser les commandes **initctl start**, **initctl stop** et **initctl restart** pour gérer les jobs. | + | |
- | </ | + | |
- | + | ||
- | =====Démarrer RHEL/CentOS 7===== | + | |
- | + | ||
- | RHEL/CentOS 7, comme beaucoup d' | + | |
- | + | ||
- | Au lieu de parler de scripts de démarrage et de niveaux d' | + | |
- | + | ||
- | * un automount - (.automount), | + | |
- | * une périphérique - //Device// - (.device), | + | |
- | * un montage d'un périphérique - //Mount// - (.mount), | + | |
- | * un chemin - //Path// - (.path) | + | |
- | * un socket - //Socket// - (.socket), | + | |
- | * un service - //Service// - (.service), | + | |
- | * une instantanée - // | + | |
- | * une cible - //Target// - (.target). | + | |
- | + | ||
- | <WRAP center round important> | + | |
- | **Important** : Dans le contexte d'une Unité, le type **cible** regroupe des Unités multiples afin qu' | + | |
- | </ | + | |
- | + | ||
- | ====La Commande systemctl==== | + | |
- | + | ||
- | Pour visualiser la liste des Unités, il convient d' | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | UNIT | + | |
- | proc-sys-fs-binfmt_misc.automount | + | |
- | sys-devices-pci0000: | + | |
- | sys-devices-pci0000: | + | |
- | sys-devices-pci0000: | + | |
- | sys-devices-pci0000: | + | |
- | sys-devices-pci0000: | + | |
- | sys-devices-pci0000: | + | |
- | sys-devices-pci0000: | + | |
- | sys-devices-platform-serial8250-tty-ttyS0.device | + | |
- | sys-devices-platform-serial8250-tty-ttyS1.device | + | |
- | sys-devices-platform-serial8250-tty-ttyS2.device | + | |
- | sys-devices-platform-serial8250-tty-ttyS3.device | + | |
- | sys-module-configfs.device | + | |
- | sys-module-fuse.device | + | |
- | sys-subsystem-net-devices-enp0s3.device | + | |
- | -.mount | + | |
- | boot.mount | + | |
- | dev-hugepages.mount | + | |
- | dev-mqueue.mount | + | |
- | proc-fs-nfsd.mount | + | |
- | run-media-trainee-VBOXADDITIONS_4.3.28_100309.mount | + | |
- | run-user-1000-gvfs.mount | + | |
- | sys-fs-fuse-connections.mount | + | |
- | sys-kernel-config.mount | + | |
- | sys-kernel-debug.mount | + | |
- | var-lib-nfs-rpc_pipefs.mount | + | |
- | brandbot.path | + | |
- | cups.path | + | |
- | systemd-ask-password-plymouth.path | + | |
- | systemd-ask-password-wall.path | + | |
- | session-1.scope | + | |
- | abrt-ccpp.service | + | |
- | abrt-oops.service | + | |
- | abrt-xorg.service | + | |
- | abrtd.service | + | |
- | accounts-daemon.service | + | |
- | alsa-state.service | + | |
- | atd.service | + | |
- | auditd.service | + | |
- | avahi-daemon.service | + | |
- | bluetooth.service | + | |
- | chronyd.service | + | |
- | colord.service | + | |
- | crond.service | + | |
- | cups.service | + | |
- | dbus.service | + | |
- | firewalld.service | + | |
- | gdm.service | + | |
- | gssproxy.service | + | |
- | iscsi-shutdown.service | + | |
- | kdump.service | + | |
- | kmod-static-nodes.service | + | |
- | ksm.service | + | |
- | ksmtuned.service | + | |
- | libstoragemgmt.service | + | |
- | libvirtd.service | + | |
- | lvm2-lvmetad.service | + | |
</ | </ | ||
- | Pour consulter la liste des Unités inactifs, utilisez la commande suivante | + | Vérifiez ensuite l' |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | proc-sys-fs-binfmt_misc.mount | + | active |
- | File System | + | |
- | systemd-ask-password-console.path | + | |
- | ole Directory Watch | + | |
- | abrt-vmcore.service | + | |
- | alsa-restore.service | + | |
- | alsa-store.service | + | |
- | apparmor.service | + | |
- | auth-rpcgss-module.service | + | |
- | S | + | |
- | brandbot.service | + | |
- | cpupower.service | + | |
- | gs | + | |
- | dm-event.service | + | |
- | dmraid-activation.service | + | |
- | dracut-shutdown.service | + | |
- | ebtables.service | + | |
- | emergency.service | + | |
- | exim.service | + | |
- | getty@tty1.service | + | |
- | hypervkvpd.service | + | |
- | hypervvssd.service | + | |
- | ip6tables.service | + | |
- | iptables.service | + | |
- | irqbalance.service | + | |
- | iscsi.service | + | |
- | s | + | |
- | iscsid.service | + | |
- | iscsiuio.service | + | |
- | --More-- | + | |
- | </ | + | |
- | Pour consulter la liste des fichiers Unités, utilisez la commande suivante | + | [root@centos8 ~]# systemctl status httpd.service |
+ | ● httpd.service - The Apache HTTP Server | ||
+ | | ||
+ | | ||
+ | Docs: man: | ||
+ | Main PID: 34382 (httpd) | ||
+ | | ||
+ | Tasks: 213 (limit: 23719) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | < | + | Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... |
- | [root@centos7 ~]# systemctl list-unit-files | more | + | Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. |
- | UNIT FILE | + | Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: |
- | proc-sys-fs-binfmt_misc.automount | + | |
- | dev-hugepages.mount | + | |
- | dev-mqueue.mount static | + | |
- | proc-fs-nfsd.mount static | + | |
- | proc-sys-fs-binfmt_misc.mount | + | |
- | sys-fs-fuse-connections.mount | + | |
- | sys-kernel-config.mount | + | |
- | sys-kernel-debug.mount | + | |
- | tmp.mount | + | |
- | var-lib-nfs-rpc_pipefs.mount | + | |
- | brandbot.path | + | |
- | cups.path | + | |
- | systemd-ask-password-console.path | + | |
- | systemd-ask-password-plymouth.path | + | |
- | systemd-ask-password-wall.path | + | |
- | session-1.scope | + | |
- | session-8.scope | + | |
- | abrt-ccpp.service | + | |
- | abrt-oops.service | + | |
- | abrt-pstoreoops.service | + | |
- | abrt-vmcore.service | + | |
- | abrt-xorg.service | + | |
- | abrtd.service | + | |
- | accounts-daemon.service | + | |
- | alsa-restore.service | + | |
- | alsa-state.service | + | |
- | alsa-store.service | + | |
- | anaconda-direct.service | + | |
- | --More-- | + | |
</ | </ | ||
- | ===Options de la Commande systemctl=== | + | Pour arrêter une Unité |
- | + | ||
- | Les options | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | systemctl | + | [root@centos8 ~]# systemctl status httpd.service |
+ | ● httpd.service - The Apache HTTP Server | ||
+ | | ||
+ | | ||
+ | Docs: man: | ||
+ | Process: 34382 ExecStart=/ | ||
+ | Main PID: 34382 (code=exited, | ||
+ | | ||
- | Query or send control commands to the systemd manager. | + | Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... |
- | + | Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. | |
- | -h --help | + | Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configured, listening on: port 80 |
- | | + | Jun 06 23:58:02 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... |
- | -t --type=TYPE | + | Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. |
- | | + | Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server. |
- | -p --property=NAME | + | |
- | -a --all Show all loaded units/ | + | |
- | ones. To list all units installed on the system, use | + | |
- | the ' | + | |
- | | + | |
- | -l --full | + | |
- | | + | |
- | pending | + | |
- | | + | |
- | cancelled | + | |
- | | + | |
- | When queueing a new job, ignore all its dependencies | + | |
- | | + | |
- | -i --ignore-inhibitors | + | |
- | When shutting down or sleeping, ignore inhibitors | + | |
- | | + | |
- | -s --signal=SIGNAL | + | |
- | -H --host=[USER@]HOST | + | |
- | Show information for remote host | + | |
- | -P --privileged | + | |
- | -q --quiet | + | |
- | | + | |
- | | + | |
- | | + | |
- | configuration | + | |
- | | + | |
- | | + | |
- | | + | |
- | Do not ask for system passwords | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | -f --force | + | |
- | When shutting down, execute action immediately | + | |
- | | + | |
- | -n --lines=INTEGER | + | |
- | -o --output=STRING | + | |
- | verbose, export, json, json-pretty, | + | |
- | | + | |
- | + | ||
- | Unit Commands: | + | |
- | list-units | + | |
- | list-sockets | + | |
- | start [NAME...] Start (activate) one or more units | + | |
- | stop [NAME...] Stop (deactivate) one or more units | + | |
- | reload | + | |
- | restart [NAME...] Start or restart one or more units | + | |
- | | + | |
- | reload-or-restart | + | |
- | | + | |
- | reload-or-try-restart [NAME...] Reload one or more units if possible, | + | |
- | otherwise restart if active | + | |
- | isolate | + | |
- | kill [NAME...] Send signal to processes of a unit | + | |
- | | + | |
- | is-failed [NAME...] | + | |
- | status [NAME...|PID...] | + | |
- | show [NAME...|JOB...] | + | |
- | units/jobs or the manager | + | |
- | set-property [NAME] [ASSIGNMENT...] | + | |
- | Sets one or more properties of a unit | + | |
- | help [NAME...|PID...] | + | |
- | reset-failed [NAME...] | + | |
- | units | + | |
- | list-dependencies [NAME] | + | |
- | or wanted by this unit or by which this | + | |
- | unit is required or wanted | + | |
- | + | ||
- | Unit File Commands: | + | |
- | list-unit-files | + | |
- | enable [NAME...] Enable one or more unit files | + | |
- | disable | + | |
- | reenable [NAME...] | + | |
- | preset [NAME...] | + | |
- | based on preset configuration | + | |
- | is-enabled [NAME...] | + | |
- | + | ||
- | mask [NAME...] | + | |
- | unmask [NAME...] | + | |
- | link [PATH...] | + | |
- | the search path | + | |
- | get-default | + | |
- | set-default NAME Set the default target | + | |
- | + | ||
- | Job Commands: | + | |
- | list-jobs | + | |
- | cancel [JOB...] | + | |
- | + | ||
- | Snapshot Commands: | + | |
- | snapshot [NAME] | + | |
- | delete [NAME...] Remove one or more snapshots | + | |
- | + | ||
- | Environment Commands: | + | |
- | show-environment | + | |
- | set-environment [NAME=VALUE...] Set one or more environment variables | + | |
- | unset-environment | + | |
- | + | ||
- | Manager Lifecycle Commands: | + | |
- | daemon-reload | + | |
- | daemon-reexec | + | |
- | + | ||
- | System Commands: | + | |
- | default | + | |
- | rescue | + | |
- | emergency | + | |
- | halt Shut down and halt the system | + | |
- | poweroff | + | |
- | reboot | + | |
- | kexec Shut down and reboot the system with kexec | + | |
- | exit Request user instance exit | + | |
- | switch-root [ROOT] [INIT] | + | |
- | suspend | + | |
- | hibernate | + | |
- | hybrid-sleep | + | |
- | lines 95-123/123 (END) | + | |
</ | </ | ||
- | ====Fichiers de Configuration==== | + | Pour désactiver un service au prochain démarrage du système, utilisez l' |
- | Les Cibles et les Unités sont configurées par des fichiers se trouvant dans le répertoire **/ | + | < |
+ | [root@centos8 ~]# systemctl disable httpd.service | ||
+ | Removed | ||
+ | [root@centos8 ~]# systemctl status httpd.service | ||
+ | ● httpd.service - The Apache HTTP Server | ||
+ | | ||
+ | | ||
+ | Docs: man:httpd.service(8) | ||
- | < | + | Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... |
- | [root@centos7 ~]# ls -l / | + | Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. |
- | total 12 | + | Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configured, listening on: port 80 |
- | drwxr-xr-x. 2 root root 54 Mar 8 13:57 basic.target.wants | + | Jun 06 23:58:02 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... |
- | drwxr-xr-x. 2 root root 30 Mar 8 13:53 bluetooth.target.wants | + | Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. |
- | lrwxrwxrwx. 1 root root 41 Mar 8 13:53 dbus-org.bluez.service -> /usr/lib/systemd/ | + | Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server. |
- | lrwxrwxrwx. | + | |
- | lrwxrwxrwx. 1 root root 44 Mar 8 13:48 dbus-org.freedesktop.Avahi.service -> / | + | |
- | lrwxrwxrwx. 1 root root 44 Mar 8 13:57 dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/ | + | |
- | lrwxrwxrwx. | + | |
- | lrwxrwxrwx. 1 root root 57 Mar 8 13:49 dbus-org.freedesktop.nm-dispatcher.service -> / | + | |
- | lrwxrwxrwx. 1 root root 36 Mar 8 14:05 default.target -> / | + | |
- | drwxr-xr-x. 2 root root 85 Mar 8 13:47 default.target.wants | + | |
- | lrwxrwxrwx. 1 root root 35 Mar 8 13:54 display-manager.service -> / | + | |
- | drwxr-xr-x. 2 root root 31 Mar 8 13:47 getty.target.wants | + | |
- | drwxr-xr-x. 2 root root | + | |
- | drwxr-xr-x. 2 root root 4096 Jun 4 10:00 multi-user.target.wants | + | |
- | drwxr-xr-x. 2 root root 29 Mar 8 13:48 nfs.target.wants | + | |
- | drwxr-xr-x. 2 root root 25 Mar 8 13:50 printer.target.wants | + | |
- | drwxr-xr-x. 2 root root | + | |
- | drwxr-xr-x. 2 root root 4096 Mar 8 13:50 sockets.target.wants | + | |
- | drwxr-xr-x. 2 root root 35 Mar 8 13:57 spice-vdagentd.target.wants | + | |
- | drwxr-xr-x. 2 root root 4096 Mar 8 13:49 sysinit.target.wants | + | |
- | drwxr-xr-x. 2 root root 83 Mar 8 13:49 system-update.target.wants | + | |
</ | </ | ||
- | ainsi que par des fichiers se trouvant dans le répertoire **/ | + | ===5.2 - Gestion d' |
- | < | + | Systemd permet |
- | [root@centos7 ~]# ls -l / | + | |
- | total 1208 | + | |
- | -rw-r--r--. 1 root root 275 Mar 24 04:56 abrt-ccpp.service | + | |
- | -rw-r--r--. 1 root root 380 Mar 24 04:56 abrtd.service | + | |
- | -rw-r--r--. 1 root root 361 Mar 24 04:56 abrt-oops.service | + | |
- | -rw-r--r--. 1 root root 266 Mar 24 04:56 abrt-pstoreoops.service | + | |
- | -rw-r--r--. 1 root root 262 Mar 24 04:56 abrt-vmcore.service | + | |
- | -rw-r--r--. 1 root root 311 Mar 24 04:56 abrt-xorg.service | + | |
- | -rw-r--r--. 1 root root 421 Jun 10 2014 accounts-daemon.service | + | |
- | -rw-r--r--. 1 root root 501 Mar 5 20:37 alsa-restore.service | + | |
- | -rw-r--r--. 1 root root 558 Mar 5 20:37 alsa-state.service | + | |
- | -rw-r--r--. 1 root root 412 Mar 5 20:37 alsa-store.service | + | |
- | -rw-r--r--. 1 root root 645 Mar 26 11:43 anaconda-direct.service | + | |
- | -rw-r--r--. 1 root root 185 Mar 26 11:43 anaconda-nm-config.service | + | |
- | -rw-r--r--. 1 root root 660 Mar 26 11:43 anaconda-noshell.service | + | |
- | -rw-r--r--. 1 root root 387 Mar 26 11:43 anaconda.service | + | |
- | -rw-r--r--. 1 root root 684 Mar 26 11:43 anaconda-shell@.service | + | |
- | -rw-r--r--. 1 root root 322 Mar 26 11:43 anaconda-sshd.service | + | |
- | -rw-r--r--. 1 root root 312 Mar 26 11:43 anaconda.target | + | |
- | drwxr-xr-x. 2 root root 4096 Jun 4 15:33 anaconda.target.wants | + | |
- | -rw-r--r--. 1 root root 498 Mar 26 11:43 anaconda-tmux@.service | + | |
- | -rw-r--r--. 1 root root 275 Jun 10 2014 arp-ethers.service | + | |
- | -rw-r--r--. 1 root root 205 Oct 7 2014 atd.service | + | |
- | -rw-r-----. 1 root root 669 Mar 5 22:59 auditd.service | + | |
- | -rw-r--r--. 1 root root 663 Mar 6 05:17 auth-rpcgss-module.service | + | |
- | lrwxrwxrwx. 1 root root 14 Jun 4 09:52 autovt@.service -> getty@.service | + | |
- | -rw-r--r--. 1 root root 1044 Mar 5 23:03 avahi-daemon.service | + | |
- | -rw-r--r--. 1 root root 874 Mar 5 23:03 avahi-daemon.socket | + | |
- | -rw-r--r--. 1 root root 546 May 12 21:44 basic.target | + | |
- | drwxr-xr-x. 2 root root 4096 Jun 4 10:07 basic.target.wants | + | |
- | --More-- | + | |
- | </ | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | total 1208 | + | # This is a template for httpd instances. |
- | -rw-r--r--. 1 root root 275 Mar 24 04:56 abrt-ccpp.service | + | # See httpd@.service(8) for more information. |
- | -rw-r--r--. 1 root root 380 Mar 24 04:56 abrtd.service | + | |
- | -rw-r--r--. 1 root root 361 Mar 24 04:56 abrt-oops.service | + | |
- | -rw-r--r--. 1 root root 266 Mar 24 04:56 abrt-pstoreoops.service | + | |
- | -rw-r--r--. 1 root root 262 Mar 24 04:56 abrt-vmcore.service | + | |
- | -rw-r--r--. 1 root root 311 Mar 24 04:56 abrt-xorg.service | + | |
- | -rw-r--r--. 1 root root 421 Jun 10 2014 accounts-daemon.service | + | |
- | -rw-r--r--. 1 root root 501 Mar 5 20:37 alsa-restore.service | + | |
- | -rw-r--r--. 1 root root 558 Mar 5 20:37 alsa-state.service | + | |
- | -rw-r--r--. 1 root root 412 Mar 5 20:37 alsa-store.service | + | |
- | -rw-r--r--. 1 root root 645 Mar 26 11:43 anaconda-direct.service | + | |
- | -rw-r--r--. 1 root root 185 Mar 26 11:43 anaconda-nm-config.service | + | |
- | -rw-r--r--. 1 root root 660 Mar 26 11:43 anaconda-noshell.service | + | |
- | -rw-r--r--. 1 root root 387 Mar 26 11:43 anaconda.service | + | |
- | -rw-r--r--. 1 root root 684 Mar 26 11:43 anaconda-shell@.service | + | |
- | -rw-r--r--. 1 root root 322 Mar 26 11:43 anaconda-sshd.service | + | |
- | -rw-r--r--. 1 root root 312 Mar 26 11:43 anaconda.target | + | |
- | drwxr-xr-x. 2 root root 4096 Jun 4 15:33 anaconda.target.wants | + | |
- | -rw-r--r--. 1 root root 498 Mar 26 11:43 anaconda-tmux@.service | + | |
- | -rw-r--r--. 1 root root 275 Jun 10 2014 arp-ethers.service | + | |
- | -rw-r--r--. 1 root root 205 Oct 7 2014 atd.service | + | |
- | -rw-r-----. 1 root root 669 Mar 5 22:59 auditd.service | + | |
- | -rw-r--r--. 1 root root 663 Mar 6 05:17 auth-rpcgss-module.service | + | |
- | lrwxrwxrwx. 1 root root 14 Jun 4 09:52 autovt@.service -> getty@.service | + | |
- | -rw-r--r--. 1 root root 1044 Mar 5 23:03 avahi-daemon.service | + | |
- | -rw-r--r--. 1 root root 874 Mar 5 23:03 avahi-daemon.socket | + | |
- | -rw-r--r--. 1 root root 546 May 12 21:44 basic.target | + | |
- | drwxr-xr-x. 2 root root 4096 Jun 4 10:07 basic.target.wants | + | |
- | --More-- | + | |
- | </ | + | |
- | Par exemple, sous RHEL/CentOS 7, le service **sshd** est configuré par le fichier **/ | ||
- | |||
- | < | ||
- | [root@centos7 ~]# cat / | ||
[Unit] | [Unit] | ||
- | Description=OpenSSH server daemon | + | Description=The Apache HTTP Server |
- | After=network.target | + | After=network.target |
- | Wants=sshd-keygen.service | + | Documentation=man:httpd@.service(8) |
[Service] | [Service] | ||
- | EnvironmentFile=/etc/sysconfig/sshd | + | Type=notify |
- | ExecStart=/ | + | Environment=LANG=C |
- | ExecReload=/ | + | Environment=HTTPD_INSTANCE=%i |
- | KillMode=process | + | ExecStartPre=/bin/mkdir -m 710 -p /run/ |
- | Restart=on-failure | + | ExecStartPre=/ |
- | RestartSec=42s | + | ExecStart=/ |
+ | ExecReload=/ | ||
+ | # Send SIGWINCH for graceful stop | ||
+ | KillSignal=SIGWINCH | ||
+ | KillMode=mixed | ||
+ | PrivateTmp=true | ||
[Install] | [Install] | ||
Ligne 3071: | Ligne 1821: | ||
</ | </ | ||
- | Dans le fichier on peut noter la présence des lignes suivantes | + | Une instance créée à partir de ce gabarit devrait avoir un nom sous la forme suivante |
- | * **ExecStart=/ | + | < |
- | * Cette ligne définit l' | + | httpd@< |
- | * **After=network.target sshd-keygen.service**, | + | </ |
- | * Cette ligne indique les services qui devraient être démarrés avant le démarrage de sshd, | + | |
- | * **WantedBy=multi-user.target**, | + | |
- | * Cette ligne indique la Cible dans laquelle le service doit être démarré, | + | |
- | * **Restart=on-failure**, | + | |
- | * Cette ligne indique quand le service doit être re-démarré. | + | |
- | ====Système | + | Dans ce fichier on peut constater l' |
- | **Systemd** utilise des Cibles d'une manière similaire | + | |
+ | | ||
+ | | ||
+ | * %P : est remplacé par le préfixe non-échappé de l'Unité, c' | ||
+ | * %i : est remplacé par le nom de l' | ||
+ | * %I : est remplacé par le nom de l' | ||
+ | * %f : est remplacé par le préfixe non-échappé ou le nom de l' | ||
+ | * %c : est remplacé par le CGroup de l' | ||
+ | * %u : est remplacé par le nom de l' | ||
+ | | ||
+ | | ||
+ | | ||
- | | + | Créez maintenant deux copies du fichier |
- | | + | |
- | | + | |
- | | + | |
- | * runlevel4.target, | + | |
- | * runlevel5.target, | + | |
- | * runlevel6.target. | + | |
- | Ceci étant dans RHEL/CentOS 7 il y principalement deux Cibles finales : | + | < |
+ | [root@centos8 ~]# cp /usr/ | ||
+ | [root@centos8 ~]# cp / | ||
+ | </ | ||
- | * **multi-user.target** qui est l' | + | Créez deux copies |
- | | + | |
- | Chaque Cible est décrite par un fichier | + | < |
+ | [root@centos8 ~]# cp / | ||
+ | [root@centos8 ~]# cp / | ||
+ | </ | ||
+ | |||
+ | Editez la directive **Listen** du fichier | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | # This file is part of systemd. | + | [root@centos8 ~]# more /etc/ |
+ | # | ||
+ | # This is the main Apache HTTP server configuration file. It contains the | ||
+ | # configuration directives that give the server its instructions. | ||
+ | # See < | ||
+ | # In particular, see | ||
+ | # < | ||
+ | # for a discussion | ||
# | # | ||
- | # | + | # See the httpd.conf(5) man page for more information on this configuration, |
- | # | + | # and httpd.service(8) on using and configuring the httpd service. |
- | # the Free Software Foundation; either version 2.1 of the License, or | + | # |
- | # (at your option) any later version. | + | # Do NOT simply read the instructions in here without understanding |
+ | # what they do. They' | ||
+ | # consult the online docs. You have been warned. | ||
+ | # | ||
+ | # Configuration and logfile names: If the filenames you specify for many | ||
+ | # of the server' | ||
+ | # server will use that explicit path. If the filenames do *not* begin | ||
+ | # with "/", | ||
+ | # with ServerRoot set to '/ | ||
+ | # server as '/ | ||
+ | # interpreted as '/ | ||
- | [Unit] | + | # |
- | Description=Graphical Interface | + | # ServerRoot: The top of the directory tree under which the server' |
- | Documentation=man:systemd.special(7) | + | # configuration, |
- | Requires=multi-user.target | + | # |
- | After=multi-user.target | + | # Do not add a slash at the end of the directory path. If you point |
- | Conflicts=rescue.target | + | # ServerRoot at a non-local disk, be sure to specify a local disk on the |
- | Wants=display-manager.service | + | # Mutex directive, if file-based mutexes are used. If you wish to share the |
- | AllowIsolate=yes | + | # same ServerRoot for multiple httpd daemons, you will need to change at |
+ | # least PidFile. | ||
+ | # | ||
+ | ServerRoot "/ | ||
- | [Install] | + | # |
- | Alias=default.target | + | # Listen: Allows you to bind Apache to specific IP addresses and/or |
- | </code> | + | # ports, instead of the default. |
+ | # directive. | ||
+ | # | ||
+ | # Change this to Listen on specific IP addresses as shown below to | ||
+ | # prevent Apache from glomming onto all bound IP addresses. | ||
+ | # | ||
+ | #Listen 12.34.56.78: | ||
+ | Listen 8008 | ||
+ | PidFile / | ||
- | Dans ce fichier on peut noter la présence des lignes suivantes | + | # |
+ | # Dynamic Shared Object (DSO) Support | ||
+ | # | ||
+ | # To be able to use the functionality of a module which was built as a DSO you | ||
+ | # have to place corresponding `LoadModule' | ||
+ | # directives contained in it are actually available _before_ they are used. | ||
+ | # Statically compiled modules (those listed by `httpd -l') do not need | ||
+ | # to be loaded here. | ||
+ | # | ||
+ | # Example: | ||
+ | # LoadModule foo_module modules/ | ||
+ | --More--(19%) | ||
+ | </ | ||
- | | + | Editez la directive |
- | * Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n'a pas été atteint aupréalable, | + | |
- | * **After=multi-user.target**, | + | |
- | * Cette ligne indique le **multi-user.target** doit d' | + | |
- | * **Conflicts=rescue.target**, | + | |
- | * Cette ligne indique | + | |
- | * **Wants=display-manager.service**, | + | |
- | * Cette ligne indique quel service doit être démarré. | + | |
- | + | ||
- | Dernièrement, | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | lrwxrwxrwx. 1 root root 36 Mar 8 14:05 /etc/systemd/system/default.target -> /lib/systemd/system/graphical.target | + | [root@centos8 ~]# more /etc/httpd/conf/instance02.conf |
- | </code> | + | # |
+ | # This is the main Apache HTTP server configuration file. It contains the | ||
+ | # configuration directives that give the server its instructions. | ||
+ | # See < | ||
+ | # In particular, see | ||
+ | # <URL:http:// | ||
+ | # for a discussion of each configuration directive. | ||
+ | # | ||
+ | # See the httpd.conf(5) man page for more information on this configuration, | ||
+ | # and httpd.service(8) on using and configuring the httpd service. | ||
+ | # | ||
+ | # Do NOT simply read the instructions in here without understanding | ||
+ | # what they do. They' | ||
+ | # consult the online docs. You have been warned. | ||
+ | # | ||
+ | # Configuration and logfile names: If the filenames you specify for many | ||
+ | # of the server' | ||
+ | # server will use that explicit path. If the filenames do *not* begin | ||
+ | # with "/", | ||
+ | # with ServerRoot set to '/ | ||
+ | # server as '/ | ||
+ | # interpreted as '/ | ||
- | ====La Commande systemd-analyze==== | + | # |
+ | # ServerRoot: The top of the directory tree under which the server' | ||
+ | # configuration, | ||
+ | # | ||
+ | # Do not add a slash at the end of the directory path. If you point | ||
+ | # ServerRoot at a non-local disk, be sure to specify a local disk on the | ||
+ | # Mutex directive, if file-based mutexes are used. If you wish to share the | ||
+ | # same ServerRoot for multiple httpd daemons, you will need to change at | ||
+ | # least PidFile. | ||
+ | # | ||
+ | ServerRoot "/ | ||
- | Pour avoir une évaluation du temps de démarrage, il convient d' | + | # |
- | + | # Listen: Allows you to bind Apache to specific IP addresses and/or | |
- | <code> | + | # ports, instead of the default. See also the <VirtualHost> |
- | [root@centos7 ~]# systemd-analyze | + | # directive. |
- | Startup finished in 769ms (kernel) + 4.643s (initrd) + 40.147s (userspace) = 45.560s | + | # |
+ | # Change this to Listen on specific IP addresses as shown below to | ||
+ | # prevent Apache from glomming onto all bound IP addresses. | ||
+ | # | ||
+ | #Listen 12.34.56.78: | ||
+ | Listen 8009 | ||
+ | PidFile / | ||
+ | # | ||
+ | # Dynamic Shared Object | ||
+ | # | ||
+ | # To be able to use the functionality of a module which was built as a DSO you | ||
+ | # have to place corresponding `LoadModule' | ||
+ | # directives contained in it are actually available _before_ they are used. | ||
+ | # Statically compiled modules | ||
+ | # to be loaded here. | ||
+ | # | ||
+ | # Example: | ||
+ | # LoadModule foo_module modules/ | ||
+ | --More--(19%) | ||
</ | </ | ||
- | L' | + | Démarrez |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | | + | [root@centos8 ~]# systemctl status httpd@instance01.service |
- | 10.302s tuned.service | + | ● httpd@instance01.service - The Apache HTTP Server |
- | | + | Loaded: loaded (/usr/lib/systemd/ |
- | 8.875s gssproxy.service | + | Active: active (running) since Mon 2021-06-07 01:40:43 EDT; 7s ago |
- | 8.860s ModemManager.service | + | Docs: man:httpd@.service(8) |
- | 8.598s vboxadd-x11.service | + | |
- | | + | |
- | 7.089s vboxadd.service | + | Main PID: 43856 (httpd) |
- | 6.398s plymouth-quit-wait.service | + | Status: " |
- | 5.593s NetworkManager-wait-online.service | + | |
- | 5.379s avahi-daemon.service | + | Memory: 43.6M |
- | 5.104s abrt-ccpp.service | + | CGroup: /system.slice/ |
- | 5.065s postfix.service | + | ├─43856 / |
- | 4.684s | + | ├─43857 / |
- | | + | ├─43858 / |
- | 4.306s rtkit-daemon.service | + | ├─43859 / |
- | 3.927s systemd-udev-settle.service | + | └─43860 / |
- | | + | |
- | | + | |
- | 2.811s libvirtd.service | + | |
- | 2.428s chronyd.service | + | |
- | 2.401s vboxadd-service.service | + | |
- | 2.349s nfs-config.service | + | |
- | 2.266s var-lib-nfs-rpc_pipefs.mount | + | |
- | 2.229s rhel-loadmodules.service | + | |
- | 2.104s rsyslog.service | + | |
- | 1.357s network.service | + | |
- | 1.283s lvm2-monitor.service | + | |
- | 1.246s rpcbind.service | + | |
- | 1.069s systemd-fsck-root.service | + | |
- | 1.007s colord.service | + | |
- | 944ms systemd-tmpfiles-setup-dev.service | + | |
- | 872ms systemd-tmpfiles-clean.service | + | |
- | 791ms rhel-readonly.service | + | |
- | 780ms NetworkManager.service | + | |
- | 743ms dmraid-activation.service | + | |
- | 723ms gdm.service | + | |
- | 720ms ksm.service | + | |
- | 718ms polkit.service | + | |
- | 716ms proc-fs-nfsd.mount | + | |
- | 669ms auditd.service | + | |
- | 660ms boot.mount | + | |
- | 608ms systemd-udev-trigger.service | + | |
- | 601ms kmod-static-nodes.service | + | |
- | 565ms netcf-transaction.service | + | |
- | 520ms systemd-vconsole-setup.service | + | |
- | 497ms systemd-sysctl.service | + | |
- | 487ms sys-kernel-debug.mount | + | |
- | 302ms dev-disk-by\x2duuid-11a4d11d\x2d81e4\x2d46a7\x2d82e0\x2d7796cd597dc9.swap | + | |
- | 297ms systemd-tmpfiles-setup.service | + | |
- | 283ms dev-mqueue.mount | + | |
- | 282ms dev-hugepages.mount | + | |
- | 261ms rhel-import-state.service | + | |
- | 243ms udisks2.service | + | |
- | 239ms systemd-user-sessions.service | + | |
- | 235ms rpc-statd-notify.service | + | |
- | 217ms systemd-random-seed.service | + | |
- | 173ms plymouth-read-write.service | + | |
- | 161ms systemd-udevd.service | + | |
- | 147ms upower.service | + | |
- | 142ms systemd-fsck@dev-disk-by\x2duuid-e8d3bd48\x2d1386\x2d411c\x2d9675\x2d41c3f8f1a309.service | + | |
- | 110ms plymouth-start.service | + | |
- | 96ms sys-fs-fuse-connections.mount | + | |
- | 82ms bluetooth.service | + | |
- | 73ms iscsi-shutdown.service | + | |
- | 69ms systemd-remount-fs.service | + | |
- | 63ms systemd-hostnamed.service | + | |
- | 53ms systemd-update-utmp.service | + | |
- | 38ms systemd-journal-flush.service | + | |
- | 33ms sys-kernel-config.mount | + | |
- | 31ms systemd-update-utmp-runlevel.service | + | |
- | lines 43-71/71 (END) | + | |
- | </ | + | |
- | L' | + | Jun 07 01:40:43 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... |
+ | Jun 07 01:40:43 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. | ||
+ | Jun 07 01:40:43 centos8.ittraining.loc httpd[43856]: | ||
+ | [root@centos8 ~]# systemctl start httpd@instance02.service | ||
+ | [root@centos8 ~]# systemctl status httpd@instance02.service | ||
+ | ● httpd@instance02.service | ||
+ | | ||
+ | | ||
+ | Docs: man: | ||
+ | Process: 43568 ExecStartPre=/ | ||
+ | Process: 43566 ExecStartPre=/ | ||
+ | Main PID: 43569 (httpd) | ||
+ | | ||
+ | Tasks: 213 (limit: 23719) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | < | + | Jun 07 01:36:45 centos8.ittraining.loc systemd[1]: Starting |
- | [root@centos7 ~]# systemd-analyze critical-chain sshd.service | + | Jun 07 01:36:45 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. |
- | The time after the unit is active or started is printed after the " | + | Jun 07 01:36:45 centos8.ittraining.loc httpd[43569]: |
- | The time the unit takes to start is printed after the " | + | |
- | + | ||
- | sshd.service @32.037s | + | |
- | └─network.target @31.990s | + | |
- | └─network.service @30.621s +1.357s | + | |
- | | + | |
- | └─firewalld.service @11.954s +12.274s | + | |
- | └─basic.target @11.937s | + | |
- | └─sockets.target @11.937s | + | |
- | └─dbus.socket @11.936s | + | |
- | └─sysinit.target @11.784s | + | |
- | └─systemd-update-utmp.service @11.726s +53ms | + | |
- | └─auditd.service @11.051s +669ms | + | |
- | └─systemd-tmpfiles-setup.service @10.734s +297ms | + | |
- | └─rhel-import-state.service @10.470s +261ms | + | |
- | └─local-fs.target @10.464s | + | |
- | └─boot.mount @9.798s +660ms | + | |
- | └─systemd-fsck@dev-disk-by\x2duuid-e8d3bd48\x2d1386\x2d411c\x2d9675\x2d41c3f8f1a309.service @9.654s +142ms | + | |
- | └─dev-disk-by\x2duuid-e8d3bd48\x2d1386\x2d411c\x2d9675\x2d41c3f8f1a309.device @9.650s | + | |
</ | </ | ||
- | ===Options de la Commande=== | + | ===5.3 - Interdire |
- | Les options de la commande **systemd-analyze** sont : | + | Il est possible d' |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | systemd-analyze [OPTIONS...] {COMMAND} ... | + | ● httpd.service |
+ | Loaded: loaded (/usr/lib/systemd/ | ||
+ | | ||
+ | Docs: man:httpd.service(8) | ||
- | Process | + | Jun 07 18:27:25 centos8.ittraining.loc httpd[58535]: |
+ | Jun 07 18:27:29 centos8.ittraining.loc | ||
+ | Jun 07 18:27:30 centos8.ittraining.loc systemd[1]: httpd.service: | ||
+ | Jun 07 18:27:30 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server. | ||
+ | Jun 07 18:27:32 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... | ||
+ | Jun 07 18:27:32 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. | ||
+ | Jun 07 18:27:32 centos8.ittraining.loc httpd[58760]: | ||
+ | Jun 07 18:27:34 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... | ||
+ | Jun 07 18:27:36 centos8.ittraining.loc systemd[1]: httpd.service: | ||
+ | Jun 07 18:27:36 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server. | ||
- | -h --help | + | [root@centos8 ~]# systemctl mask httpd.service |
- | --version | + | Created symlink / |
- | --system | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | When generating a dependency graph, filter only origins | + | |
- | or destinations, | + | |
- | | + | |
- | services, which finished TIMESPAN earlier, than the | + | |
- | latest in the branch. The unit of TIMESPAN is seconds | + | |
- | unless specified with a different unit, i.e. 50ms | + | |
- | | + | |
- | Commands: | + | [root@centos8 ~]# systemctl enable httpd.service |
- | | + | Failed |
- | blame Print list of running units ordered by time to init | + | |
- | | + | [root@centos8 ~]# systemctl start httpd.service |
- | | + | Failed to start httpd.service: |
- | | + | |
- | set-log-level LEVEL Set logging threshold for systemd | + | |
- | dump Output state serialization of service | + | |
</ | </ | ||
- | ====Gestion des Services==== | + | Pour autoriser de nouveau les modifications, il convient d' |
- | + | ||
- | Pour obtenir le détail sur un service donné, il convient d' | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | sshd.service - OpenSSH server daemon | + | Removed |
- | | + | |
- | | + | |
- | Main PID: 1212 (sshd) | + | |
- | | + | |
- | | + | |
- | Jun 11 11:01:52 centos7.fenestros.loc systemd[1]: Started OpenSSH server daemon. | + | [root@centos8 ~]# systemctl enable httpd.service |
- | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: Server listening on 0.0.0.0 port 22. | + | Created symlink / |
- | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: Server listening on :: port 22. | + | |
- | </ | + | |
- | Pour arrêter une Unité de service, utilisez la commande suivante : | + | [root@centos8 ~]# systemctl start httpd.service |
- | < | + | [root@centos8 |
- | [root@centos7 ~]# systemctl stop sshd.service | + | ● httpd.service - The Apache HTTP Server |
- | [root@centos7 | + | |
- | sshd.service - OpenSSH server daemon | + | |
- | | + | Docs: man: |
- | | + | Main PID: 59101 (httpd) |
- | | + | |
- | Main PID: 1212 (code=exited, status=0/ | + | Tasks: 213 (limit: 23719) |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | Jun 11 11:01:52 centos7.fenestros.loc systemd[1]: | + | Jun 07 18:30:59 centos8.ittraining.loc systemd[1]: |
- | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: | + | Jun 07 18:30:59 centos8.ittraining.loc systemd[1]: |
- | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: Server listening on :: port 22. | + | Jun 07 18:31:00 centos8.ittraining.loc httpd[59101]: Server configured, listening on: port 80 |
- | Jun 11 13:58:59 centos7.fenestros.loc systemd[1]: | + | |
- | Jun 11 13:58:59 centos7.fenestros.loc sshd[1212]: Received signal 15; terminating. | + | |
- | Jun 11 13:58:59 centos7.fenestros.loc systemd[1]: Stopped OpenSSH server daemon. | + | |
</ | </ | ||
- | Pour démarrer un service, utilisez la commande suivante : | + | =====Arrêt du Système===== |
- | < | + | Sous RHEL / CentOS 8 les commandes **halt**, **poweroff**, **reboot** et **shutdown** sont des liens symboliques vers **/ |
- | [root@centos7 ~]# systemctl start ssh.service | + | |
- | [root@centos7 ~]# systemctl status sshd.service | + | |
- | sshd.service - OpenSSH server daemon | + | |
- | | + | |
- | | + | |
- | Main PID: 6624 (sshd) | + | |
- | | + | |
- | | + | |
- | + | ||
- | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Starting OpenSSH server daemon... | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Started OpenSSH server daemon. | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server listening on 0.0.0.0 port 22. | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server listening on :: port 22. | + | |
- | </ | + | |
- | + | ||
- | Pour désactiver un service au prochain démarrage du système, utilisez l' | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | rm '/etc/systemd/system/multi-user.target.wants/sshd.service' | + | lrwxrwxrwx. 1 root root 16 Apr 7 16:55 / |
- | [root@centos7 ~]# systemctl status sshd.service | + | lrwxrwxrwx. 1 root root 16 Apr 7 16:55 /usr/sbin/poweroff |
- | sshd.service - OpenSSH server daemon | + | lrwxrwxrwx. 1 root root 16 Apr 7 16:55 / |
- | | + | lrwxrwxrwx. 1 root root 16 Apr 7 16:55 / |
- | | + | |
- | Main PID: 6624 (sshd) | + | |
- | | + | |
- | └─6624 | + | |
- | + | ||
- | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Starting OpenSSH server daemon... | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Started OpenSSH server daemon. | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server listening on 0.0.0.0 port 22. | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server listening on :: port 22. | + | |
</ | </ | ||
- | Pour activer un service au prochain démarrage du système, utilisez l'option **enable** | + | La manière recommendée d'utiliser ces commandes est donc : |
- | < | + | * systemctl halt |
- | [root@centos7 ~]# systemctl | + | |
- | ln -s '/ | + | * systemctl reboot |
- | [root@centos7 ~]# systemctl | + | |
- | sshd.service - OpenSSH server daemon | + | |
- | | + | |
- | | + | |
- | Main PID: 6624 (sshd) | + | |
- | | + | |
- | | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Starting OpenSSH server daemon... | + | Il est cependant toujours possibles d' |
- | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Started OpenSSH server daemon. | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server listening on 0.0.0.0 port 22. | + | |
- | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server listening on :: port 22. | + | |
- | </ | + | |
- | + | ||
- | =====Arrêt du Système===== | + | |
====La Commande shutdown==== | ====La Commande shutdown==== | ||
Ligne 3395: | Ligne 2132: | ||
La commande utilisée pour arrêter le système est la commande **shutdown** : | La commande utilisée pour arrêter le système est la commande **shutdown** : | ||
- | shutdown [-t sec] [-akrhHPfnc] heure [message] | + | shutdown [-t sec] [-HPrhkc] heure [message] |
===Options de la commande=== | ===Options de la commande=== | ||
Ligne 3402: | Ligne 2139: | ||
< | < | ||
- | Usage: | + | [root@centos8 ~]# shutdown --help |
- | -a: use /etc/shutdown.allow | + | shutdown |
- | | + | |
- | | + | |
- | | + | |
- | -P: halt action is to turn off power. | + | |
- | -H: halt action is to just halt. | + | |
- | -f: do a ' | + | |
- | -F: Force fsck on reboot. | + | |
- | -n: do not go through " | + | |
- | -c: cancel a running shutdown. | + | |
- | -t secs: delay between warning and kill signal. | + | |
- | ** the " | + | |
- | </ | + | |
- | Parmi les options les plus importantes, | + | Shut down the system. |
- | ^ Option ^ Description ^ | + | |
- | | -h | Arrêter le système | | + | -H --halt |
- | | -r | Re-démarrer le système | | + | -P --poweroff |
- | | -c | Annuler l'opération shutdown en cours | | + | |
- | | -f | Re-démarrer rapidement sans vérifier les systèmes de fichiers | | + | -h |
- | | -F | Forcer la vérification des systèmes de fichiers lors du prochain démarrage | | + | -k Don't halt/ |
+ | | ||
+ | -c | ||
+ | </ | ||
L' | L' | ||
Ligne 3430: | Ligne 2158: | ||
^ Valeur ^ Description ^ | ^ Valeur ^ Description ^ | ||
| hh:mm | L' | | hh:mm | L' | ||
- | | +m | Nombre de minutes avant que l' | + | | +m | Nombre de minutes avant que l' |
- | | now | L' | + | | now | L' |
- | <WRAP center round important> | + | <WRAP center round important |
- | **Important** : Si l' | + | **Important** : Si l' |
</ | </ | ||
- | Dans votre VM, ouvrez deux terminaux. Dans le premier passez en tant que root. Planifiez ensuite | + | L' |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | + | Mon Jun 7 18:58:26 EDT 2021 | |
- | Broadcast message from trainee@centos.fenestros.loc | + | Shutdown scheduled |
- | (/ | + | |
- | + | ||
- | The system is going down for reboot in 30 minutes! | + | |
- | </ | + | |
- | + | ||
- | Dans le deuxième terminal est passez en tant que route. Annulez ensuite le shutdown : | + | |
- | + | ||
- | < | + | |
- | [trainee@centos7 ~]$ su - | + | |
- | Mot de passe : | + | |
- | [root@centos7 ~]# shutdown -c | + | |
- | </ | + | |
- | + | ||
- | Retournez au premier terminal et constatez le message affiché : | + | |
- | + | ||
- | < | + | |
- | [root@centos7 ~]# shutdown -r +30 | + | |
- | + | ||
- | Broadcast message from trainee@centos.fenestros.loc | + | |
- | (/ | + | |
- | + | ||
- | The system is going down for reboot in 30 minutes! | + | |
- | + | ||
- | + | ||
- | shutdown: Shutdown cancelled | + | |
- | [root@centos7 ~]# | + | |
</ | </ | ||
==== La Commande reboot==== | ==== La Commande reboot==== | ||
- | Cette commande redémarre le système. Quand le système fonctionne normalement, | + | Cette commande redémarre le système. |
===Options de la commande=== | ===Options de la commande=== | ||
Ligne 3480: | Ligne 2182: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | Usage: | + | reboot [OPTIONS...] [ARG] |
Reboot the system. | Reboot the system. | ||
- | Options: | + | |
- | -n, --no-sync | + | |
- | -f, --force | + | -p --poweroff |
- | | + | --reboot |
- | -w, --wtmp-only | + | -f --force |
- | | + | -w --wtmp-only |
- | -q, --quiet | + | -d --no-wtmp |
- | | + | |
- | --help display this help and exit | + | |
- | | + | |
- | + | ||
- | This command is intended to instruct the kernel to reboot or halt the system; | + | |
- | when run without the -f option, or when in a system runlevel other than 0 or 6, | + | |
- | it will actually execute | + | |
- | + | ||
- | + | ||
- | Report bugs to < | + | |
</ | </ | ||
==== La Commande halt==== | ==== La Commande halt==== | ||
- | Cette commande arrête le système. Quand le système fonctionne normalement, | + | Cette commande arrête le système. |
===Options de la commande=== | ===Options de la commande=== | ||
Ligne 3512: | Ligne 2206: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | Usage: | + | halt [OPTIONS...] |
Halt the system. | Halt the system. | ||
- | Options: | + | |
- | -n, --no-sync | + | |
- | -f, --force | + | -p --poweroff |
- | | + | --reboot |
- | -w, --wtmp-only | + | -f --force |
- | | + | -w --wtmp-only |
- | -q, --quiet | + | -d --no-wtmp |
- | | + | |
- | --help display this help and exit | + | |
- | | + | |
- | + | ||
- | This command is intended to instruct the kernel to reboot or halt the system; | + | |
- | when run without the -f option, or when in a system runlevel other than 0 or 6, | + | |
- | it will actually execute | + | |
- | + | ||
- | + | ||
- | Report bugs to < | + | |
</ | </ | ||
==== La Commande poweroff==== | ==== La Commande poweroff==== | ||
- | Cette commande arrête le système et coupe l' | + | Cette commande arrête le système et coupe l' |
===Options de la commande=== | ===Options de la commande=== | ||
Ligne 3544: | Ligne 2230: | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | Usage: | + | poweroff [OPTIONS...] |
Power off the system. | Power off the system. | ||
- | Options: | + | |
- | -n, --no-sync | + | |
- | -f, --force | + | -p --poweroff |
- | | + | --reboot |
- | -w, --wtmp-only | + | -f --force |
- | | + | -w --wtmp-only |
- | -q, --quiet | + | -d --no-wtmp |
- | | + | |
- | --help display this help and exit | + | |
- | | + | |
- | + | ||
- | This command is intended to instruct the kernel to reboot or halt the system; | + | |
- | when run without the -f option, or when in a system runlevel other than 0 or 6, | + | |
- | it will actually execute | + | |
- | + | ||
- | + | ||
- | Report bugs to < | + | |
</ | </ | ||
----- | ----- | ||
- | < | + | Copyright © 2024 Hugh Norris. |
- | <div align=" | + | |
- | Copyright © 2021 Hugh Norris. | + | |
- | </ | + |