Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| elearning:workbooks:lpic:21:450:l103 [2022/10/07 09:39] – created admin | elearning:workbooks:lpic:21:450:l103 [2022/11/01 07:24] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 5: | Ligne 5: | ||
| Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
| - | ======Topic | + | ======Topic |
| - | =====Contenu du Module===== | + | |
| - | + | ||
| - | | + | |
| - | * Contenu du Module | + | |
| * Présentation | * Présentation | ||
| * BIOS, EFI et OpenFirmware | * BIOS, EFI et OpenFirmware | ||
| Ligne 27: | Ligne 24: | ||
| * Configurer l' | * Configurer l' | ||
| * Modifier la Configuration de GRUB Legacy en Ligne de Commande | * Modifier la Configuration de GRUB Legacy en Ligne de Commande | ||
| - | * GRUB 2 sous RHEL/CentOS 7 | + | * GRUB 2 sous Debian 11 |
| - | * Le fichier /boot/grub/device.map | + | * Le fichier /boot/grub2/device.map |
| * Le fichier / | * Le fichier / | ||
| * Les fichiers du répertoire /etc/grub.d | * Les fichiers du répertoire /etc/grub.d | ||
| - | * 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 48: | Ligne 42: | ||
| * Le script init | * Le script init | ||
| * La Commande dracut | * La Commande dracut | ||
| - | * Initramfs sous RHEL/CentOS 7 | + | * Initramfs sous Debian 11 |
| - | * Examiner l' | + | * LAB #1 - Travailler avec Initramfs |
| - | * Le script init | + | * 1.1 - Examiner l' |
| - | * Consulter le contenu d'un fichier dans initramfs | + | * 1.2 - La Commande |
| - | | + | |
| * Processus de Démarrage du Noyau Linux | * Processus de Démarrage du Noyau Linux | ||
| * Processus Init | * Processus Init | ||
| Ligne 93: | Ligne 86: | ||
| * La Commande stop | * La Commande stop | ||
| * La Commande restart | * La Commande restart | ||
| - | * Démarrer | + | * Démarrer |
| - | * La Commande systemctl | + | * LAB #2 - La Commande systemctl |
| - | * Fichiers de Configuration | + | * LAB #3 - Fichiers de Configuration |
| - | * La Commande systemd-analyze | + | * 3.1 - Fichiers de Configuration par Défaut |
| - | * Gestion des Services | + | * 3.2 - Surchargement des Fichiers par Défaut |
| - | * Arrêt Système du Système | + | * 3.3 - Les Fichiers d' |
| - | * La Commande shutdown | + | * LAB #4 - La Commande systemd-analyze |
| - | * La Commande reboot | + | * LAB #5 - Les Cibles |
| - | * La Commande halt | + | * 5.1 - Contrôler les dépendances d'une Cible |
| - | * La Commande poweroff | + | * 5.2 - La Cible par Défaut |
| + | * LAB #6 - Gestion des Services | ||
| + | * 6.1 - Gestion des Instances Uniques | ||
| + | * 6.2 - Gestion d' | ||
| + | * 6.3 - Interdire la Modification du Statut d'un Service | ||
| =====Présentation===== | =====Présentation===== | ||
| Ligne 149: | Ligne 146: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : L'UEFI gère parfaitement les **SSD** (//Solid State Drives//) qui utilisent le standard **NVMe** (// | **Important** : L'UEFI gère parfaitement les **SSD** (//Solid State Drives//) qui utilisent le standard **NVMe** (// | ||
| </ | </ | ||
| Ligne 204: | Ligne 201: | ||
| Si le BIOS signale une erreur lorsque LILO essaye de charger une image d' | Si le BIOS signale une erreur lorsque LILO essaye de charger une image d' | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : LILO ne gère pas les systèmes UEFI. | **Important** : LILO ne gère pas les systèmes UEFI. | ||
| </ | </ | ||
| Ligne 271: | Ligne 268: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : Sous les distributions dérivées de Red Hat, par exemple Fedora, le fichier menu.lst s' | **Important** : Sous les distributions dérivées de Red Hat, par exemple Fedora, le fichier menu.lst s' | ||
| </ | </ | ||
| Ligne 355: | Ligne 352: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : Notez l' | **Important** : Notez l' | ||
| </ | </ | ||
| Ligne 375: | Ligne 372: | ||
| * **echap** : abandonner les modifications et retourner à l' | * **echap** : abandonner les modifications et retourner à l' | ||
| - | ====GRUB 2 sous RHEL/CentOS 7==== | + | ====GRUB 2 sous Debian 11==== |
| 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 383: | Ligne 380: | ||
| * Etape 1 : Le **boot.img**, | * Etape 1 : Le **boot.img**, | ||
| * Etape 1.5 : Le **core.img**, | * Etape 1.5 : Le **core.img**, | ||
| - | * Etape 2 : Contenu dans le répertoire **/boot/grub2/**, il lance le menu pour que l' | + | * Etape 2 : Contenu dans le répertoire **/boot/grub/**, il lance le menu pour que l' |
| Dans le cas où le Charger de Démarrage **GRUB 2** n'est pas installé, il convient de saisir la commande suivante : | Dans le cas où le Charger de Démarrage **GRUB 2** n'est pas installé, il convient de saisir la commande suivante : | ||
| - | # grub2-install / | + | # grub-install / |
| où **périphérique** est le nom du périphérique ou l' | où **périphérique** est le nom du périphérique ou l' | ||
| - | **GRUB 2** lit ses entrées de menus à partir du fichier **/boot/grub2/ | + | **GRUB 2** lit ses entrées de menus à partir du fichier **/boot/grub/ |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# cat /boot/grub/grub.cfg |
| # | # | ||
| # DO NOT EDIT THIS FILE | # DO NOT EDIT THIS FILE | ||
| # | # | ||
| - | # It is automatically generated by grub2-mkconfig using templates | + | # It is automatically generated by grub-mkconfig using templates |
| # from /etc/grub.d and settings from / | # from /etc/grub.d and settings from / | ||
| # | # | ||
| ### BEGIN / | ### BEGIN / | ||
| - | set pager=1 | ||
| - | |||
| if [ -s $prefix/ | if [ -s $prefix/ | ||
| + | set have_grubenv=true | ||
| load_env | load_env | ||
| fi | fi | ||
| Ligne 414: | Ligne 410: | ||
| set boot_once=true | set boot_once=true | ||
| else | else | ||
| - | set default=" | + | set default=" |
| fi | fi | ||
| Ligne 439: | Ligne 435: | ||
| fi | fi | ||
| } | } | ||
| - | |||
| function load_video { | function load_video { | ||
| if [ x$feature_all_video_module = xy ]; then | if [ x$feature_all_video_module = xy ]; then | ||
| Ligne 454: | Ligne 449: | ||
| } | } | ||
| - | terminal_output console | + | if [ x$feature_default_font_path |
| - | if [ x$feature_timeout_style | + | font=unicode |
| - | set timeout_style=menu | + | |
| - | set timeout=5 | + | |
| - | # Fallback normal timeout code in case the timeout_style feature is | + | |
| - | # unavailable. | + | |
| else | else | ||
| - | | + | insmod part_msdos |
| + | insmod ext2 | ||
| + | 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 9887a74f-a680-4bde-8f04-db5ae9ea186e | ||
| + | fi | ||
| + | font="/ | ||
| + | fi | ||
| + | |||
| + | if loadfont $font ; then | ||
| + | set gfxmode=auto | ||
| + | load_video | ||
| + | insmod gfxterm | ||
| + | set locale_dir=$prefix/ | ||
| + | set lang=en_US | ||
| + | insmod gettext | ||
| + | fi | ||
| + | terminal_output gfxterm | ||
| + | if [ " | ||
| + | set timeout=30 | ||
| + | else | ||
| + | if [ x$feature_timeout_style = xy ] ; then | ||
| + | set timeout_style=menu | ||
| + | set timeout=5 | ||
| + | # Fallback normal timeout code in case the timeout_style feature is | ||
| + | # unavailable. | ||
| + | else | ||
| + | | ||
| + | fi | ||
| fi | fi | ||
| ### END / | ### END / | ||
| + | |||
| + | ### BEGIN / | ||
| + | insmod part_msdos | ||
| + | insmod ext2 | ||
| + | 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 9887a74f-a680-4bde-8f04-db5ae9ea186e | ||
| + | fi | ||
| + | insmod png | ||
| + | if background_image / | ||
| + | set color_normal=white/ | ||
| + | set color_highlight=black/ | ||
| + | else | ||
| + | set menu_color_normal=cyan/ | ||
| + | set menu_color_highlight=white/ | ||
| + | fi | ||
| + | ### END / | ||
| ### BEGIN / | ### BEGIN / | ||
| - | menuentry ' | + | function gfxmode |
| - | load_video | + | set gfxpayload="${1}" |
| - | 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 / | + | |
| } | } | ||
| - | menuentry 'CentOS | + | set linux_gfx_mode= |
| - | load_video | + | export linux_gfx_mode |
| - | set gfxpayload=keep | + | menuentry 'Debian GNU/Linux' --class |
| - | insmod gzio | + | load_video |
| - | insmod part_msdos | + | insmod gzio |
| - | insmod | + | if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi |
| - | set root=' | + | |
| - | if [ x$feature_platform_search_hint = xy ]; then | + | insmod |
| - | | + | set root=' |
| - | else | + | if [ x$feature_platform_search_hint = xy ]; then |
| - | | + | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, |
| - | fi | + | else |
| - | linux16 | + | search --no-floppy --fs-uuid --set=root |
| - | initrd16 | + | fi |
| + | | ||
| + | linux /boot/vmlinuz-5.10.0-13-amd64 | ||
| + | echo ' | ||
| + | | ||
| } | } | ||
| - | menuentry 'CentOS | + | submenu ' |
| - | load_video | + | |
| - | insmod gzio | + | load_video |
| - | insmod part_msdos | + | insmod gzio |
| - | insmod | + | if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi |
| - | set root=' | + | |
| - | if [ x$feature_platform_search_hint = xy ]; then | + | insmod |
| - | | + | set root=' |
| - | else | + | if [ x$feature_platform_search_hint = xy ]; then |
| - | | + | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, |
| - | fi | + | else |
| - | linux16 | + | search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e |
| - | initrd16 | + | fi |
| + | echo ' | ||
| + | linux / | ||
| + | echo ' | ||
| + | initrd | ||
| + | } | ||
| + | menuentry ' | ||
| + | load_video | ||
| + | insmod gzio | ||
| + | if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi | ||
| + | insmod part_msdos | ||
| + | insmod ext2 | ||
| + | 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 | ||
| + | fi | ||
| + | | ||
| + | linux /boot/vmlinuz-5.10.0-13-amd64 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e | ||
| + | echo ' | ||
| + | | ||
| + | } | ||
| } | } | ||
| - | if [ " | + | |
| ### END / | ### END / | ||
| ### BEGIN / | ### BEGIN / | ||
| + | |||
| ### END / | ### END / | ||
| - | |||
| - | ### BEGIN / | ||
| - | ### END / | ||
| ### BEGIN / | ### BEGIN / | ||
| ### END / | ### END / | ||
| + | |||
| + | ### BEGIN / | ||
| + | ### END / | ||
| ### BEGIN / | ### BEGIN / | ||
| Ligne 547: | Ligne 602: | ||
| | rootnoverify (hd0,1) | 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** sous RHEL/CentOS 7. La commande | + | Notez que ce fichier ne doit pas être modifié manuellement. En effet, il est généré par la commande **update-grub** ou la commande **grub-mkconfig** sous Debian. La commande |
| - | * grub2-mkconfig -o /boot/grub2/grub.cfg, ou | + | * grub-mkconfig -o /boot/grub/grub.cfg |
| - | * grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg | + | * grub-mkconfig -o /boot/edi/EFI/debian/grub.cfg |
| - | Lors de l' | + | Lors de l' |
| ===Le fichier / | ===Le fichier / | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# cat /boot/grub/ |
| - | # this device map was generated by anaconda | + | cat: / |
| - | (hd0) /dev/sda | + | root@debian11: |
| - | (hd1) /dev/sda | + | root@debian11: |
| + | (hd0) | ||
| + | (hd1) | ||
| + | (hd2) / | ||
| + | (hd3) / | ||
| + | (hd4) / | ||
| + | (hd5) / | ||
| </ | </ | ||
| Ligne 568: | Ligne 629: | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# cat / |
| + | # If you change this file, run ' | ||
| + | # / | ||
| + | # For full documentation of the options in this file, see: | ||
| + | # info -f grub -n ' | ||
| + | |||
| + | GRUB_DEFAULT=0 | ||
| GRUB_TIMEOUT=5 | GRUB_TIMEOUT=5 | ||
| - | GRUB_DISTRIBUTOR="$(sed 's, release .*$,, | + | GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` |
| - | GRUB_DEFAULT=saved | + | GRUB_CMDLINE_LINUX_DEFAULT="quiet" |
| - | GRUB_DISABLE_SUBMENU=true | + | GRUB_CMDLINE_LINUX="" |
| - | GRUB_TERMINAL_OUTPUT="console" | + | |
| - | GRUB_CMDLINE_LINUX=" | + | |
| - | GRUB_DISABLE_RECOVERY=" | + | |
| - | </ | + | |
| + | # Uncomment to enable BadRAM filtering, modify to suit your needs | ||
| + | # This works with Linux (no patch required) and with any kernel that obtains | ||
| + | # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) | ||
| + | # | ||
| + | |||
| + | # Uncomment to disable graphical terminal (grub-pc only) | ||
| + | # | ||
| + | |||
| + | # The resolution used on graphical terminal | ||
| + | # note that you can use only modes which your graphic card supports via VBE | ||
| + | # you can see them in real GRUB with the command `vbeinfo' | ||
| + | # | ||
| + | |||
| + | # Uncomment if you don't want GRUB to pass " | ||
| + | # | ||
| + | |||
| + | # Uncomment to disable generation of recovery mode menu entries | ||
| + | # | ||
| + | |||
| + | # Uncomment to get a beep at grub start | ||
| + | # | ||
| + | </ | ||
| - | <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' |
| </ | </ | ||
| - | Dans ce fichier les directives sont : | + | Dans ce fichier les directives |
| ^ Directive | ^ Directive | ||
| Ligne 591: | Ligne 676: | ||
| | GRUB_CMDLINE_LINUX_DEFAULT | Paramètres passés au noyau lors d'un démarrage normal (Hors donc le mode secours) | | | GRUB_CMDLINE_LINUX_DEFAULT | Paramètres passés au noyau lors d'un démarrage normal (Hors donc le mode secours) | | ||
| | 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_BADRAM | Permet de spécifier de la mémoire défaillante | | ||
| | GRUB_TERMINAL | Si non commentée, cette directive désactive le démarrage graphique | | | GRUB_TERMINAL | Si non commentée, cette directive désactive le démarrage graphique | | ||
| | GRUB_GFXMODE | Indique la résolution utilisée lors d'un démarrage graphique | | | GRUB_GFXMODE | Indique la résolution utilisée lors d'un démarrage graphique | | ||
| Ligne 596: | Ligne 682: | ||
| | GRUB_DISABLE_LINUX_RECOVERY | Si **true**, cette directive empêche la génération des entrées en mode **recovery** | | | GRUB_DISABLE_LINUX_RECOVERY | Si **true**, cette directive empêche la génération des entrées en mode **recovery** | | ||
| | GRUB_INIT_TUNE | Permet d' | | GRUB_INIT_TUNE | Permet d' | ||
| - | | GRUB_BADRAM | Permet de spécifier de la mémoire défaillante | | ||
| ===Les fichiers du répertoire / | ===Les fichiers du répertoire / | ||
| Ligne 603: | Ligne 688: | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# ls -l / |
| - | total 68 | + | total 80 |
| - | -rwxr-xr-x. 1 root root | + | -rwxr-xr-x 1 root root 10046 Jul 11 2021 00_header |
| - | -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 13664 Jul 11 2021 10_linux |
| - | -rwxr-xr-x. 1 root root 10275 Mar 26 09:27 20_linux_xen | + | -rwxr-xr-x 1 root root 13726 Jul 11 2021 20_linux_xen |
| - | -rwxr-xr-x. 1 root root | + | -rwxr-xr-x 1 root root 12059 Jul 11 2021 30_os-prober |
| - | -rwxr-xr-x. 1 root root 11169 Mar 26 09:27 30_os-prober | + | -rwxr-xr-x 1 root root 1416 Jul 11 2021 30_uefi-firmware |
| - | -rwxr-xr-x. 1 root root | + | -rwxr-xr-x 1 root root |
| - | -rwxr-xr-x. 1 root root | + | -rwxr-xr-x 1 root root |
| - | -rw-r--r--. 1 root root | + | -rw-r--r-- 1 root root |
| </ | </ | ||
| Ligne 622: | Ligne 707: | ||
| * **Les fichiers / | * **Les fichiers / | ||
| * Ces deux fichiers sont fournis en tant que modèles à personnaliser. | * Ces deux fichiers sont fournis en tant que modèles à personnaliser. | ||
| - | |||
| - | ===Configurer l' | ||
| - | |||
| - | ==RHEL/ | ||
| - | |||
| - | Pour configurer l' | ||
| - | |||
| - | < | ||
| - | [root@centos7 ~]# touch / | ||
| - | [root@centos7 ~]# chmod 755 / | ||
| - | </ | ||
| - | |||
| - | 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 806: | Ligne 722: | ||
| * **echap** : abandonner les modifications et retourner à l' | * **echap** : abandonner les modifications et retourner à l' | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : Certaines distributions, | **Important** : Certaines distributions, | ||
| </ | </ | ||
| Ligne 848: | Ligne 764: | ||
| Un Chargeur de Démarrage hybride, appelé **isodhpfx.bin**, | Un Chargeur de Démarrage hybride, appelé **isodhpfx.bin**, | ||
| - | + | =====Initramfs sous RHEL/CentOS 6===== | |
| - | ====Initramfs sous RHEL/CentOS 6==== | + | |
| Un fichier Initramfs //%%INITial Ram File System%%// est une image d'un système minimal initialisée au démarrage du système. | Un fichier Initramfs //%%INITial Ram File System%%// est une image d'un système minimal initialisée au démarrage du système. | ||
| Ligne 925: | Ligne 840: | ||
| </ | </ | ||
| - | <WRAP center round todo> | + | <WRAP center round todo 60%> |
| **A faire** : Utilisez le manuel de la commande **cpio** pour comprendre les options utilisées. | **A faire** : Utilisez le manuel de la commande **cpio** pour comprendre les options utilisées. | ||
| </ | </ | ||
| Ligne 966: | Ligne 881: | ||
| </ | </ | ||
| - | <WRAP center round todo> | + | <WRAP center round todo 60%> |
| **A faire** : Passez en revue le contenu du script. | **A faire** : Passez en revue le contenu du script. | ||
| </ | </ | ||
| Ligne 1081: | Ligne 996: | ||
| - | <WRAP center round todo> | + | <WRAP center round todo 60%> |
| **A faire** : **Re-démarrez votre machine pour tester votre configuration.** | **A faire** : **Re-démarrez votre machine pour tester votre configuration.** | ||
| </ | </ | ||
| - | ====Initramfs sous RHEL/CentOS 7==== | + | =====Initramfs sous Debian 11===== |
| - | Le fichier Initramfs //%%INITial Ram File System%%// est une archive | + | Le fichier Initramfs //%%INITial Ram File System%%// est une image d'un système minimal initialisée |
| - | < | + | ====LAB |
| - | [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 initramfs]# cpio -cid -I ../custom | + | |
| - | 113591 blocks | + | |
| - | [root@centos7 initramfs]# ls | + | |
| - | 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. 2 root root 80 Dec 4 11:00 var | + | |
| - | </ | + | |
| - | ===Examiner l' | + | ===1.1 - Examiner l' |
| - | Pour examiner une image initramfs | + | Pour examiner une image initramfs, il convient d'abord de la copier vers /tmp et de la décompresser |
| < | < | ||
| - | [root@centos7 initramfs]# cd .. | + | root@debian11:~# cp / |
| - | [root@centos7 tmp]# lsinitrd custom | more | + | root@debian11: |
| - | Image: custom: 56M | + | |
| - | ======================================================================== | + | |
| - | Version: dracut-033-502.el7_4.1 | + | |
| - | + | ||
| - | Arguments: -f | + | |
| - | + | ||
| - | dracut modules: | + | |
| - | bash | + | |
| - | nss-softokn | + | |
| - | i18n | + | |
| - | network | + | |
| - | ifcfg | + | |
| - | drm | + | |
| - | plymouth | + | |
| - | kernel-modules | + | |
| - | qemu | + | |
| - | resume | + | |
| - | rootfs-block | + | |
| - | terminfo | + | |
| - | udev-rules | + | |
| - | biosdevname | + | |
| - | systemd | + | |
| - | usrmount | + | |
| - | base | + | |
| - | fs-lib | + | |
| - | shutdown | + | |
| - | ======================================================================== | + | |
| - | drwxr-xr-x | + | |
| - | crw-r--r-- 1 root | + | |
| - | crw-r--r-- | + | |
| - | crw-r--r-- | + | |
| - | lrwxrwxrwx | + | |
| - | drwxr-xr-x | + | |
| - | drwxr-xr-x | + | |
| - | drwxr-xr-x | + | |
| - | drwxr-xr-x | + | |
| - | -rw-r--r-- | + | |
| - | -rw-r--r-- | + | |
| - | -rw-r--r-- | + | |
| - | --More-- | + | |
| </ | </ | ||
| - | Comme vous pouvez le constater, l'image contient une arborescence Linux minimaliste : | + | Ensuite il convient d'extraire |
| - | + | ||
| - | ===Le script init=== | + | |
| - | + | ||
| - | Le script **init** est lancé lors du chargement de l' | + | |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# cd /tmp |
| - | ... | + | root@debian11:/ |
| - | lrwxrwxrwx. | + | root@debian11:/ |
| + | root@debian11:/tmp/initrd# cpio -idvB < ../custom | ||
| ... | ... | ||
| + | var | ||
| + | var/cache | ||
| + | var/ | ||
| + | var/ | ||
| + | var/ | ||
| + | var/ | ||
| + | var/ | ||
| + | var/ | ||
| + | 31991 blocks | ||
| </ | </ | ||
| - | ===Consulter | + | Installez maintenant |
| - | + | ||
| - | Pour consulter le contenu d'un fichier inclus dans l' | + | |
| < | < | ||
| - | [root@centos7 | + | root@debian11:/tmp/initrd# apt-get -y install tree |
| - | include ld.so.conf.d/ | + | |
| </ | </ | ||
| - | ===La Commande dracut=== | + | Utilisez maintenant la commande **tree** pour examiner le contenu |
| - | + | ||
| - | La commande **dracut** permet | + | |
| < | < | ||
| - | [root@centos7 | + | root@debian11:/tmp/initrd# tree | more |
| - | Usage: / | + | . |
| + | ├── bin -> usr/bin | ||
| + | ├── conf | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── cryptroot | ||
| + | │ | ||
| + | ├── etc | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | --More-- | ||
| + | [q] | ||
| + | </code> | ||
| - | Version: 033-463.el7 | + | Comme vous pouvez le constater, l' |
| - | Creates initial ramdisk images for preloading modules | + | < |
| + | root@debian11:/ | ||
| + | total 36 | ||
| + | lrwxrwxrwx | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x | ||
| + | drwxr-xr-x 10 root root 4096 Apr 30 11:02 etc | ||
| + | -rwxr-xr-x | ||
| + | lrwxrwxrwx | ||
| + | lrwxrwxrwx | ||
| + | lrwxrwxrwx | ||
| + | lrwxrwxrwx | ||
| + | drwxr-xr-x | ||
| + | lrwxrwxrwx | ||
| + | drwxr-xr-x 10 root root 4096 Apr 30 11:02 scripts | ||
| + | drwxr-xr-x 10 root root 4096 Apr 30 11:02 usr | ||
| + | drwxr-xr-x | ||
| + | </ | ||
| - | --kver [VERSION] | + | Le script |
| - | -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 / | + | |
| - | 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. | + | < |
| + | root@debian11:/ | ||
| + | #!/bin/sh | ||
| - | For example: | + | # Default PATH differs between shells, and is not automatically exported |
| + | # by klibc dash. Make it consistent. | ||
| + | export PATH=/sbin:/ | ||
| - | # dracut | + | [ -d /dev ] || mkdir -m 0755 /dev |
| + | [ -d /root ] || mkdir -m 0700 /root | ||
| + | [ -d /sys ] || mkdir /sys | ||
| + | [ -d /proc ] || mkdir /proc | ||
| + | [ -d /tmp ] || mkdir /tmp | ||
| + | mkdir -p /var/lock | ||
| + | mount -t sysfs -o nodev, | ||
| + | mount -t proc -o nodev, | ||
| - | </code> | + | # shellcheck disable=SC2013 |
| + | for x in $(cat /proc/ | ||
| + | case $x in | ||
| + | initramfs.clear) | ||
| + | clear | ||
| + | ;; | ||
| + | quiet) | ||
| + | quiet=y | ||
| + | ;; | ||
| + | esac | ||
| + | done | ||
| - | Le fichier de configuration de dracut est **/ | + | if [ " |
| + | quiet=n | ||
| + | echo " | ||
| + | fi | ||
| + | export quiet | ||
| - | < | + | # Note that this only becomes /dev on the real filesystem if udev's scripts |
| - | # PUT YOUR CONFIG HERE OR IN separate files named *.conf | + | # are used; which they will be, but it's worth pointing out |
| - | # in /etc/dracut.conf.d | + | mount -t devtmpfs -o nosuid, |
| - | # SEE man dracut.conf(5) | + | mkdir /dev/pts |
| + | mount -t devpts -o noexec, | ||
| - | # Sample dracut config file | + | # Export the dpkg architecture |
| + | export DPKG_ARCH= | ||
| + | . / | ||
| - | #logfile=/ | + | # Set modprobe env |
| - | #fileloglvl=6 | + | export MODPROBE_OPTIONS=" |
| - | # Exact list of dracut modules to use. Modules not listed here are not going | + | # Export relevant variables |
| - | # to be included. | + | export ROOT= |
| - | # add_dracutmodules option instead. | + | export ROOTDELAY= |
| - | # | + | export ROOTFLAGS= |
| + | export ROOTFSTYPE= | ||
| + | export IP= | ||
| + | export DEVICE= | ||
| + | export BOOT= | ||
| + | export BOOTIF= | ||
| + | export UBIMTD= | ||
| + | export break= | ||
| + | export init=/ | ||
| + | --More--(19%) | ||
| + | </ | ||
| - | # dracut modules to omit | + | <WRAP center round todo 60%> |
| - | # | + | **A faire** : Passez en revue le contenu du script. |
| + | </ | ||
| - | # dracut modules to add to the default | + | ===1.2 - La commande mkinitramfs=== |
| - | # | + | |
| - | # additional kernel modules to the default | + | La commande **mkinitramfs** permet de créer facilement une image initramfs. Les options de la commande sont : |
| - | add_drivers+=" | + | |
| - | # list of kernel filesystem modules to be included in the generic initramfs | + | < |
| - | #filesystems+="" | + | root@debian11: |
| - | # build initrd only to boot current hardware | + | Usage: mkinitramfs [option]... -o outfile [version] |
| - | # | + | |
| - | # | + | |
| - | # install local /etc/mdadm.conf | + | Options: |
| - | # | + | -c compress |
| + | -d confdir | ||
| + | -k Keep temporary directory used to make the image. | ||
| + | -o outfile | ||
| + | -r root | ||
| - | # install local / | + | See mkinitramfs(8) for further details. |
| - | # | + | </ |
| - | # A list of fsck tools to install. If it's not specified, module' | + | Le fichier de configuration de mkinitramfs est **/etc/initramfs-tools/modules**. Editez ce fichier pour spécifier des modules noyau supplémentaires à inclure dans le fichier |
| - | # 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 | + | |
| < | < | ||
| - | [root@centos7 | + | root@debian11:/tmp/initrd# vi / |
| - | Executing: /sbin/dracut | + | root@debian11:/tmp/initrd# cat / |
| - | dracut module ' | + | # List of modules that you want to include in your initramfs. |
| - | dracut module ' | + | # They will be loaded at boot time in the order below. |
| - | *** Including module: bash *** | + | # |
| - | *** Including module: nss-softokn *** | + | # Syntax: |
| - | *** Including module: i18n *** | + | # |
| - | *** Including module: network *** | + | # You must run update-initramfs(8) to effect this change. |
| - | *** Including module: ifcfg *** | + | # |
| - | *** Including module: drm *** | + | # Examples: |
| - | *** Including module: plymouth *** | + | # |
| - | *** Including module: kernel-modules *** | + | # raid1 |
| - | *** Including module: qemu *** | + | # sd_mod |
| - | *** Including module: resume *** | + | usbcore |
| - | *** Including module: rootfs-block *** | + | uhci |
| - | *** Including module: terminfo *** | + | ehci-hcd |
| - | *** Including module: udev-rules *** | + | usb-ohci |
| - | Skipping udev rule: 91-permissions.rules | + | usb-uhci |
| - | *** Including module: biosdevname *** | + | usb-storage |
| - | *** Including module: systemd *** | + | scsi_mod |
| - | *** Including module: usrmount *** | + | sd_mod |
| - | *** 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 | + | Exécutez maintenant |
| < | < | ||
| - | [root@centos7 initrd]# ls -l /tmp/initrd/ | + | root@debian11:/tmp/initrd# mkinitramfs |
| - | -rw-------. 1 root root 16373488 Jun 10 10:23 / | + | |
| </ | </ | ||
| - | Déplacez | + | Notez la présence de votre nouvelle image **/tmp/ |
| < | < | ||
| - | [root@centos7 | + | root@debian11:/ |
| + | -rw-r--r-- 1 root root 47695493 Apr 30 11:12 /tmp/initrd/usbinitramfs-5.10.0-13-amd64.img | ||
| </ | </ | ||
| - | Ouvrez | + | Déplacez |
| < | < | ||
| - | ... | + | root@debian11: |
| - | ### BEGIN /etc/grub.d/ | + | |
| - | 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 /vmlinuz-3.10.0-229.4.2.el7.x86_64 root=UUID=b35de665-5ec8-4226-a533-58a1b567ac91 ro vconsole.keymap=fr crashkernel=auto | + | |
| - | initrd16 | + | |
| - | } | + | |
| - | ... | + | |
| </ | </ | ||
| - | Créez maintenant le fichier **/ | + | Créez maintenant le fichier **/ |
| - | <file> | + | <code> |
| + | root@debian11:/ | ||
| + | root@debian11:/ | ||
| #!/bin/sh -e | #!/bin/sh -e | ||
| cat << EOF | cat << EOF | ||
| - | menuentry 'CentOS | + | menuentry 'Debian GNU/Linux' --class |
| load_video | load_video | ||
| - | set gfxpayload=keep | ||
| insmod gzio | insmod gzio | ||
| + | if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi | ||
| insmod part_msdos | insmod part_msdos | ||
| - | insmod | + | insmod |
| set root=' | set root=' | ||
| if [ x$feature_platform_search_hint = xy ]; then | if [ x$feature_platform_search_hint = xy ]; then | ||
| - | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, | + | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, |
| else | else | ||
| - | search --no-floppy --fs-uuid --set=root | + | search --no-floppy --fs-uuid --set=root |
| fi | fi | ||
| - | | + | |
| - | | + | linux / |
| + | | ||
| + | initrd | ||
| } | } | ||
| EOF | EOF | ||
| - | </file> | + | </code> |
| Rendez ce fichier exécutable : | Rendez ce fichier exécutable : | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:/ |
| </ | </ | ||
| - | |||
| - | 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 : | Mettez à jour grub afin que celui-ci prend en compte le nouveau fichier : | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:/ |
| Generating grub configuration file ... | Generating grub configuration file ... | ||
| - | Found linux image: /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64 | + | Found background |
| - | Found initrd image: | + | Found linux image: / |
| - | Found linux image: / | + | Found initrd image: /boot/initrd.img-5.10.0-13-amd64 |
| - | Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img | + | |
| - | Found linux image: / | + | |
| - | Found initrd image: / | + | |
| done | done | ||
| </ | </ | ||
| - | Controlez le fichier /boot/grub2/grub.cfg : | + | Controlez le fichier /boot/grub/grub.cfg : |
| < | < | ||
| ... | ... | ||
| - | ### BEGIN / | + | ### END / |
| - | menuentry 'CentOS | + | |
| + | ### BEGIN / | ||
| + | menuentry 'Debian GNU/Linux' --class | ||
| load_video | load_video | ||
| - | set gfxpayload=keep | ||
| insmod gzio | insmod gzio | ||
| + | if [ x = xxen ]; then insmod xzio; insmod lzopio; fi | ||
| insmod part_msdos | insmod part_msdos | ||
| - | insmod | + | insmod |
| set root=' | set root=' | ||
| if [ x = xy ]; then | if [ x = xy ]; then | ||
| - | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, | + | search --no-floppy --fs-uuid --set=root --hint-bios=hd0, |
| else | else | ||
| + | search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e | ||
| + | fi | ||
| + | echo ' | ||
| + | linux / | ||
| + | echo ' | ||
| + | initrd | ||
| + | } | ||
| + | ### END / | ||
| + | |||
| + | ### BEGIN / | ||
| ... | ... | ||
| </ | </ | ||
| - | <WRAP center round todo> | + | =====Processus de Démarrage du Noyau Linux===== |
| - | **A faire** : **Re-démarrez votre machine pour tester votre configuration.** | + | |
| - | </ | + | |
| - | + | ||
| - | ====Processus de Démarrage du Noyau Linux==== | + | |
| Le processus de démarrage du Noyau Linux peut être divisé en 6 étapes : | Le processus de démarrage du Noyau Linux peut être divisé en 6 étapes : | ||
| Ligne 1568: | Ligne 1348: | ||
| 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==== | + | =====Processus Init===== |
| Le premier processus lancé par le noyau est **Init**. L' | Le premier processus lancé par le noyau est **Init**. L' | ||
| Ligne 1806: | Ligne 1586: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : Notez que chaque répertoire correspondant à un niveau d' | **Important** : Notez que chaque répertoire correspondant à un niveau d' | ||
| </ | </ | ||
| Ligne 1831: | Ligne 1611: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : Ici le principe est le même sauf que la lettre **K** indique au script **rc** que le script dans **/ | **Important** : Ici le principe est le même sauf que la lettre **K** indique au script **rc** que le script dans **/ | ||
| </ | </ | ||
| Ligne 2288: | Ligne 2068: | ||
| # update-rc.d ssh start 20 2 3 4 5 . stop 20 0 1 6 . [Entrée] | # update-rc.d ssh start 20 2 3 4 5 . stop 20 0 1 6 . [Entrée] | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : | **Important** : | ||
| Il existe aussi un mot clef : **default**. Ce mot clef indique à **update-rc.d** d' | Il existe aussi un mot clef : **default**. Ce mot clef indique à **update-rc.d** d' | ||
| Ligne 2297: | Ligne 2077: | ||
| # update-rc.d -f ssh remove [Entrée] | # update-rc.d -f ssh remove [Entrée] | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : | **Important** : | ||
| Cette commande laisse le script ssh dans le répertoire / | Cette commande laisse le script ssh dans le répertoire / | ||
| Ligne 2541: | Ligne 2321: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** : Notez qu'à part la deuxième ligne de la description, | **Important** : Notez qu'à part la deuxième ligne de la description, | ||
| </ | </ | ||
| Ligne 2568: | Ligne 2348: | ||
| | $syslog | Syslog, Syslog-ng ou Rsyslog doit être démarré. | | | $syslog | Syslog, Syslog-ng ou Rsyslog doit être démarré. | | ||
| | $time | L' | | $time | L' | ||
| - | |||
| =====Démarrer RHEL/CentOS 6 avec Upstart===== | =====Démarrer RHEL/CentOS 6 avec Upstart===== | ||
| Ligne 3059: | Ligne 2838: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| Il est aussi possible d' | Il est aussi possible d' | ||
| </ | </ | ||
| - | =====Démarrer | + | =====Démarrer |
| - | RHEL/CentOS 7, comme beaucoup d' | + | Les systèmes de démarrage antérieurs à Systemd, **SysVinit** et **Upstart**, étaient |
| - | Au lieu de parler de scripts de démarrage et de niveaux d' | + | **Systemd** |
| - | * un automount - (.automount), | + | Au lieu de parler de scripts de démarrage et de niveaux |
| - | * une périphérique - //Device// - (.device), | + | |
| - | * un montage | + | |
| - | | + | |
| - | | + | |
| - | * un service - //Service// - (.service), | + | |
| - | | + | |
| - | * une cible - //Target// - (.target). | + | |
| - | <WRAP center round important> | + | * **.automount** - active la fonctionalité d' |
| - | **Important** : Dans le contexte | + | * **.device** - expose une périphérique dans systemd. |
| - | </WRAP> | + | * **.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 sous surveillance par le système. | ||
| + | * **.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 | ||
| + | * **.swap** - encapsule | ||
| + | | ||
| + | * **.target** - regroupe des Unités multiples afin qu' | ||
| + | |||
| + | Une Cible est en quelque sorte une **grande étape** dans le démarrage du système : | ||
| + | |||
| + | * **halt.target** - arrête le système. | ||
| + | * **poweroff.target** - arrête le système et coupe le courant. | ||
| + | * **shutdown.target** - arrête le système. | ||
| + | * **rescue.target** - démarre le système en mode single-user (seul root peut s'y connecter). Tous les systèmes de fichiers sont montés mais le réseau n'est pas démarré. | ||
| + | * **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. | ||
| + | |||
| + | **Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d' | ||
| + | |||
| + | < | ||
| + | root@debian11:/ | ||
| + | lrwxrwxrwx 1 root root 15 Mar 20 20:55 / | ||
| + | lrwxrwxrwx 1 root root 13 Mar 20 20:55 / | ||
| + | lrwxrwxrwx 1 root root 17 Mar 20 20:55 / | ||
| + | lrwxrwxrwx 1 root root 17 Mar 20 20:55 / | ||
| + | lrwxrwxrwx 1 root root 17 Mar 20 20:55 / | ||
| + | lrwxrwxrwx 1 root root 16 Mar 20 20:55 / | ||
| + | lrwxrwxrwx 1 root root 13 Mar 20 20:55 / | ||
| + | |||
| + | / | ||
| + | total 0 | ||
| + | |||
| + | / | ||
| + | total 0 | ||
| + | |||
| + | / | ||
| + | total 0 | ||
| + | |||
| + | / | ||
| + | total 0 | ||
| + | |||
| + | / | ||
| + | total 0 | ||
| + | </code> | ||
| - | ====La Commande systemctl==== | + | ====LAB #2 - La Commande systemctl==== |
| Pour visualiser la liste des Unités, il convient d' | Pour visualiser la liste des Unités, il convient d' | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:/ |
| - | UNIT | + | root@debian11: |
| - | proc-sys-fs-binfmt_misc.automount | + | UNIT |
| - | sys-devices-pci0000: | + | 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-pci0000: |
| - | sys-devices-pci0000: | + | sys-devices-pci0000: |
| - | sys-devices-pci0000: | + | sys-devices-pci0000: |
| - | sys-devices-platform-serial8250-tty-ttyS0.device | + | sys-devices-pci0000: |
| - | sys-devices-platform-serial8250-tty-ttyS1.device | + | sys-devices-pci0000: |
| - | sys-devices-platform-serial8250-tty-ttyS2.device | + | sys-devices-pci0000: |
| - | sys-devices-platform-serial8250-tty-ttyS3.device | + | sys-devices-pci0000: |
| - | sys-module-configfs.device | + | sys-devices-pci0000: |
| - | sys-module-fuse.device | + | sys-devices-pci0000: |
| - | sys-subsystem-net-devices-enp0s3.device | + | sys-devices-pci0000: |
| - | -.mount | + | sys-devices-pci0000: |
| - | boot.mount | + | sys-devices-pci0000: |
| - | dev-hugepages.mount | + | sys-devices-pci0000: |
| - | dev-mqueue.mount | + | sys-devices-pci0000: |
| - | proc-fs-nfsd.mount | + | sys-devices-pci0000: |
| - | run-media-trainee-VBOXADDITIONS_4.3.28_100309.mount | + | sys-devices-pci0000: |
| - | run-user-1000-gvfs.mount | + | |
| - | sys-fs-fuse-connections.mount | + | |
| - | sys-kernel-config.mount | + | sys-devices-platform-serial8250-tty-ttyS1.device |
| - | sys-kernel-debug.mount | + | sys-devices-platform-serial8250-tty-ttyS2.device |
| - | var-lib-nfs-rpc_pipefs.mount | + | sys-devices-platform-serial8250-tty-ttyS3.device |
| - | brandbot.path | + | |
| - | cups.path | + | sys-devices-virtual-block-dm\x2d1.device |
| - | systemd-ask-password-plymouth.path | + | sys-devices-virtual-block-dm\x2d2.device |
| - | systemd-ask-password-wall.path | + | sys-devices-virtual-misc-rfkill.device |
| - | session-1.scope | + | |
| - | abrt-ccpp.service | + | sys-module-fuse.device |
| - | abrt-oops.service | + | sys-subsystem-net-devices-ens18.device |
| - | abrt-xorg.service | + | -.mount |
| - | abrtd.service | + | dev-hugepages.mount |
| - | accounts-daemon.service | + | dev-mqueue.mount |
| - | alsa-state.service | + | mnt-sdc11.mount |
| - | atd.service | + | mnt-sdc12.mount |
| - | auditd.service | + | run-user-1000.mount |
| - | avahi-daemon.service | + | run-user-113.mount |
| - | bluetooth.service | + | sys-fs-fuse-connections.mount |
| - | chronyd.service | + | sys-kernel-config.mount |
| - | colord.service | + | sys-kernel-debug.mount |
| - | crond.service | + | sys-kernel-tracing.mount |
| - | cups.service | + | cups.path |
| - | dbus.service | + | systemd-ask-password-plymouth.path |
| - | firewalld.service | + | systemd-ask-password-wall.path |
| - | gdm.service | + | init.scope |
| - | gssproxy.service | + | |
| - | iscsi-shutdown.service | + | |
| - | kdump.service | + | |
| - | kmod-static-nodes.service | + | auditd.service |
| - | ksm.service | + | avahi-daemon.service |
| - | ksmtuned.service | + | blk-availability.service |
| - | libstoragemgmt.service | + | |
| - | libvirtd.service | + | cron.service |
| - | lvm2-lvmetad.service | + | |
| + | cups.service | ||
| + | lines 1-58 | ||
| + | [q] | ||
| </ | </ | ||
| Ligne 3151: | Ligne 2975: | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl list-units --all | grep inactive | more |
| - | proc-sys-fs-binfmt_misc.mount | + | ● home.mount |
| - | File System | + | |
| - | systemd-ask-password-console.path | + | ● tmp.mount |
| - | ole Directory Watch | + | |
| - | abrt-vmcore.service | + | |
| - | alsa-restore.service | + | apt-daily-upgrade.service |
| - | alsa-store.service | + | apt-daily.service |
| - | apparmor.service | + | ● connman.service |
| - | auth-rpcgss-module.service | + | ● console-screen.service |
| - | S | + | dm-event.service |
| - | brandbot.service | + | |
| - | cpupower.service | + | |
| - | gs | + | |
| - | dm-event.service | + | ● fcoe.service |
| - | dmraid-activation.service | + | |
| - | dracut-shutdown.service | + | getty-static.service |
| - | ebtables.service | + | ● iscsi-shutdown.service |
| - | emergency.service | + | ● iscsi.service |
| - | exim.service | + | ● iscsid.service |
| - | getty@tty1.service | + | ● kbd.service |
| - | hypervkvpd.service | + | logrotate.service |
| - | hypervvssd.service | + | ● lvm2-activation.service |
| - | ip6tables.service | + | lvm2-lvmpolld.service |
| - | iptables.service | + | man-db.service |
| - | irqbalance.service | + | mlocate.service |
| - | iscsi.service | + | modprobe@configfs.service |
| - | s | + | modprobe@drm.service |
| - | iscsid.service | + | modprobe@fuse.service |
| - | iscsiuio.service | + | ● nslcd.service |
| + | plymouth-quit.service | ||
| + | ● rbdmap.service | ||
| + | rc-local.service | ||
| + | | ||
| + | rsync.service | ||
| + | ● sssd.service | ||
| + | | ||
| + | systemd-ask-password-plymouth.service | ||
| + | systemd-ask-password-wall.service | ||
| + | systemd-binfmt.service | ||
| + | systemd-boot-system-token.service | ||
| + | systemd-cryptsetup@sdc11.service | ||
| + | systemd-fsck-root.service | ||
| + | | ||
| + | systemd-fsckd.service | ||
| + | | ||
| + | systemd-initctl.service | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | systemd-rfkill.service | ||
| + | systemd-tmpfiles-clean.service | ||
| + | ● systemd-update-done.service | ||
| + | | ||
| + | ● systemd-vconsole-setup.service | ||
| + | ● ypbind.service | ||
| + | system-systemd\x2dcryptsetup.slice | ||
| + | system-systemd\x2dfsck.slice | ||
| --More-- | --More-- | ||
| + | [q] | ||
| </ | </ | ||
| - | Pour consulter | + | Les points noirs au début de certaines lignes dans la sortie ci-dessus sont en réalité |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl status connman |
| - | UNIT FILE | + | Unit connman.service could not be found. |
| - | proc-sys-fs-binfmt_misc.automount | + | </ |
| - | dev-hugepages.mount | + | |
| - | dev-mqueue.mount | + | Pour consulter la liste des Unités ainsi que leurs statuts, utilisez la commande suivante : |
| - | proc-fs-nfsd.mount | + | |
| - | proc-sys-fs-binfmt_misc.mount | + | < |
| - | sys-fs-fuse-connections.mount | + | root@debian11: |
| - | sys-kernel-config.mount | + | UNIT FILE |
| - | sys-kernel-debug.mount | + | proc-sys-fs-binfmt_misc.automount |
| - | tmp.mount | + | -.mount |
| - | var-lib-nfs-rpc_pipefs.mount | + | dev-hugepages.mount |
| - | brandbot.path | + | dev-mqueue.mount |
| - | cups.path | + | media-cdrom0.mount |
| - | systemd-ask-password-console.path | + | mnt-sdc11.mount |
| - | systemd-ask-password-plymouth.path | + | proc-sys-fs-binfmt_misc.mount |
| - | systemd-ask-password-wall.path | + | sys-fs-fuse-connections.mount |
| - | session-1.scope | + | sys-kernel-config.mount |
| - | session-8.scope | + | sys-kernel-debug.mount |
| - | abrt-ccpp.service | + | sys-kernel-tracing.mount |
| - | abrt-oops.service | + | cups.path |
| - | abrt-pstoreoops.service | + | systemd-ask-password-console.path |
| - | abrt-vmcore.service | + | systemd-ask-password-plymouth.path |
| - | abrt-xorg.service | + | systemd-ask-password-wall.path |
| - | abrtd.service | + | session-180.scope |
| - | accounts-daemon.service | + | session-c1.scope |
| - | alsa-restore.service | + | alsa-restore.service |
| - | alsa-state.service | + | alsa-state.service |
| - | alsa-store.service | + | alsa-utils.service |
| - | anaconda-direct.service | + | anacron.service |
| + | apparmor.service | ||
| + | apt-daily-upgrade.service | ||
| + | apt-daily.service | ||
| + | auditd.service | ||
| + | autovt@.service | ||
| + | avahi-daemon.service | ||
| + | blk-availability.service | ||
| + | colord.service | ||
| + | configure-printer@.service | ||
| + | console-getty.service | ||
| + | console-setup.service | ||
| + | container-getty@.service | ||
| + | cron.service | ||
| + | cryptdisks-early.service | ||
| + | cryptdisks.service | ||
| + | cups-browsed.service | ||
| + | cups.service | ||
| + | dbus-fi.w1.wpa_supplicant1.service | ||
| + | dbus-org.freedesktop.Avahi.service | ||
| + | dbus-org.freedesktop.hostname1.service | ||
| + | dbus-org.freedesktop.locale1.service | ||
| + | dbus-org.freedesktop.login1.service | ||
| + | dbus-org.freedesktop.ModemManager1.service | ||
| + | dbus-org.freedesktop.nm-dispatcher.service | ||
| + | dbus-org.freedesktop.timedate1.service | ||
| + | dbus-org.freedesktop.timesync1.service | ||
| + | dbus.service | ||
| + | debug-shell.service | ||
| + | display-manager.service | ||
| + | dm-event.service | ||
| + | e2scrub@.service | ||
| + | e2scrub_all.service | ||
| + | e2scrub_fail@.service | ||
| + | e2scrub_reap.service | ||
| + | emergency.service | ||
| + | fstrim.service | ||
| --More-- | --More-- | ||
| + | [q] | ||
| </ | </ | ||
| - | ===Options de la Commande systemctl=== | + | Pour visualiser les Unités d'un type spécifique, |
| - | Les options de la commande | + | < |
| + | root@debian11: | ||
| + | UNIT FILE | ||
| + | -.mount | ||
| + | dev-hugepages.mount | ||
| + | dev-mqueue.mount | ||
| + | media-cdrom0.mount | ||
| + | mnt-sdc11.mount | ||
| + | proc-sys-fs-binfmt_misc.mount disabled | ||
| + | sys-fs-fuse-connections.mount static | ||
| + | sys-kernel-config.mount | ||
| + | sys-kernel-debug.mount | ||
| + | sys-kernel-tracing.mount | ||
| + | |||
| + | 10 unit files listed. | ||
| + | </ | ||
| + | |||
| + | Dans la colonne STATE on voit les mots **static** et **generated**. | ||
| + | |||
| + | * STATE = static | ||
| + | * Ceci implique que l' | ||
| + | |||
| + | * STATE = generated | ||
| + | * Ceci implique que le fichier a été généré automatiquement en utilisant les informations dans le fichier **/ | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# ls -l / |
| - | systemctl [OPTIONS...] {COMMAND} ... | + | -rwxr-xr-x 1 root root 43440 Mar 20 20:55 / |
| + | </ | ||
| - | Query or send control commands to the systemd manager. | + | Il existe aussi d' |
| - | -h --help | + | < |
| - | | + | root@debian11: |
| - | -t --type=TYPE | + | total 420 |
| - | --state=STATE | + | -rwxr-xr-x 1 root root 146872 Feb 22 2021 lvm2-activation-generator |
| - | -p --property=NAME | + | -rwxr-xr-x 1 root root 14488 Mar 20 20:55 systemd-bless-boot-generator |
| - | -a --all Show all loaded units/ | + | -rwxr-xr-x 1 root root 35176 Mar 20 20:55 systemd-cryptsetup-generator |
| - | ones. To list all units installed on the system, use | + | -rwxr-xr-x 1 root root 14632 Mar 20 20:55 systemd-debug-generator |
| - | the 'list-unit-files' command instead. | + | -rwxr-xr-x 1 root root 43440 Mar 20 20:55 systemd-fstab-generator |
| - | --reverse | + | -rwxr-xr-x 1 root root 14480 Mar 20 20:55 systemd-getty-generator |
| - | -l --full | + | -rwxr-xr-x 1 root root 34968 Mar 20 20:55 systemd-gpt-auto-generator |
| - | | + | -rwxr-xr-x 1 root root 14624 Mar 20 20:55 systemd-hibernate-resume-generator |
| - | pending | + | -rwxr-xr-x 1 root root 14480 Mar 20 20:55 systemd-rc-local-generator |
| - | --irreversible | + | -rwxr-xr-x 1 root root 14616 Mar 20 20:55 systemd-run-generator |
| - | cancelled | + | -rwxr-xr-x 1 root root 14480 Mar 20 20:55 systemd-system-update-generator |
| - | --ignore-dependencies | + | -rwxr-xr-x 1 root root |
| - | When queueing a new job, ignore all its dependencies | + | -rwxr-xr-x 1 root root 14624 Mar 20 20:55 systemd-veritysetup-generator |
| - | | + | </ |
| - | -i --ignore-inhibitors | + | |
| - | When shutting down or sleeping, ignore inhibitors | + | |
| - | --kill-who=WHO | + | |
| - | -s --signal=SIGNAL | + | |
| - | -H --host=[USER@]HOST | + | |
| - | Show information for remote host | + | |
| - | -P --privileged | + | |
| - | -q --quiet Suppress output | + | |
| - | --no-block Do not wait until operation finished | + | |
| - | | + | |
| - | --no-reload | + | |
| - | configuration | + | |
| - | | + | |
| - | --no-pager | + | |
| - | | + | |
| - | Do not ask for system | + | |
| - | --system | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | -f --force | + | |
| - | When shutting down, execute action immediately | + | |
| - | --root=PATH Enable unit files in the specified | + | |
| - | -n --lines=INTEGER | + | |
| - | -o --output=STRING | + | |
| - | verbose, export, json, json-pretty, json-sse, cat) | + | |
| - | --plain | + | |
| - | Unit Commands: | + | Les options de la commande **systemctl** sont : |
| - | list-units | + | |
| - | list-sockets | + | |
| - | start [NAME...] | + | |
| - | stop [NAME...] | + | |
| - | reload [NAME...] | + | |
| - | restart [NAME...] | + | |
| - | try-restart [NAME...] | + | |
| - | reload-or-restart [NAME...] | + | |
| - | otherwise start or restart | + | |
| - | reload-or-try-restart [NAME...] Reload one or more units if possible, | + | |
| - | otherwise restart if active | + | |
| - | isolate [NAME] | + | |
| - | kill [NAME...] | + | |
| - | is-active [NAME...] | + | |
| - | 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 List installed unit files | + | root@debian11:~# systemctl |
| - | | + | systemctl |
| - | disable [NAME...] | + | |
| - | reenable [NAME...] | + | |
| - | preset [NAME...] | + | |
| - | based on preset configuration | + | |
| - | is-enabled [NAME...] | + | |
| - | mask [NAME...] | + | Query or send control commands to the system manager. |
| - | unmask [NAME...] Unmask one or more units | + | |
| - | link [PATH...] | + | |
| - | the search path | + | |
| - | get-default | + | |
| - | set-default NAME Set the default target | + | |
| - | Job Commands: | + | Unit Commands: |
| - | list-jobs List jobs | + | list-units [PATTERN...] |
| - | | + | |
| + | ordered by address | ||
| + | list-timers [PATTERN...] | ||
| + | ordered by next elapse | ||
| + | is-active PATTERN... | ||
| + | is-failed PATTERN... | ||
| + | status [PATTERN...|PID...] | ||
| + | show [PATTERN...|JOB...] | ||
| + | units/jobs or the manager | ||
| + | cat PATTERN... | ||
| + | help PATTERN...|PID... | ||
| + | list-dependencies [UNIT...] | ||
| + | or wanted by the units or by which those | ||
| + | units are required or wanted | ||
| + | start UNIT... | ||
| + | stop UNIT... | ||
| + | reload UNIT... | ||
| + | restart UNIT... | ||
| + | try-restart UNIT... | ||
| + | reload-or-restart UNIT... | ||
| + | otherwise start or restart | ||
| + | try-reload-or-restart UNIT... | ||
| + | if supported, otherwise restart | ||
| + | isolate UNIT Start one unit and stop all others | ||
| + | kill UNIT... | ||
| + | clean UNIT... | ||
| + | configuration of unit | ||
| + | freeze PATTERN... | ||
| + | thaw PATTERN... | ||
| + | set-property UNIT PROPERTY=VALUE... Sets one or more properties of a unit | ||
| + | service-log-level SERVICE [LEVEL] | ||
| + | service-log-target SERVICE [TARGET] Get/set logging target for service | ||
| + | reset-failed [PATTERN...] | ||
| + | units | ||
| + | Unit File Commands: | ||
| + | list-unit-files [PATTERN...] | ||
| + | enable [UNIT...|PATH...] | ||
| + | disable UNIT... | ||
| + | reenable UNIT... | ||
| + | preset UNIT... | ||
| + | based on preset configuration | ||
| + | preset-all | ||
| + | preset configuration | ||
| + | is-enabled UNIT... | ||
| + | mask UNIT... | ||
| + | unmask UNIT... | ||
| + | link PATH... | ||
| + | the search path | ||
| + | revert UNIT... | ||
| + | version | ||
| + | add-wants TARGET UNIT... | ||
| + | on specified one or more units | ||
| + | lines 1-58 | ||
| + | [q] | ||
| + | </ | ||
| - | Snapshot Commands: | + | ====LAB #3 - Fichiers de Configuration==== |
| - | snapshot [NAME] | + | |
| - | delete [NAME...] | + | |
| - | Environment Commands: | + | ===3.1 - Fichiers de Configuration par Défaut=== |
| - | show-environment | + | |
| - | set-environment [NAME=VALUE...] Set one or more environment variables | + | |
| - | unset-environment [NAME...] | + | |
| - | Manager Lifecycle Commands: | + | Les fichiers de configuration |
| - | daemon-reload | + | |
| - | daemon-reexec | + | |
| - | System Commands: | + | < |
| - | default | + | root@debian11:~# pkg-config systemd |
| - | rescue | + | /lib/ |
| - | 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 Hibernate and suspend the system | + | |
| - | lines 95-123/123 (END) | + | |
| </ | </ | ||
| - | ====Fichiers de Configuration==== | + | < |
| + | root@debian11: | ||
| + | total 1076 | ||
| + | -rw-r--r-- 1 root root 576 Dec 7 2020 alsa-restore.service | ||
| + | -rw-r--r-- 1 root root 528 Dec 7 2020 alsa-state.service | ||
| + | lrwxrwxrwx 1 root root 9 Dec 7 2020 alsa-utils.service -> /dev/null | ||
| + | -rw-r--r-- 1 root root 776 Feb 6 2021 anacron.service | ||
| + | -rw-r--r-- 1 root root 154 Feb 6 2021 anacron.timer | ||
| + | -rw-r--r-- 1 root root 1162 Apr 3 2021 apparmor.service | ||
| + | -rw-r--r-- 1 root root 326 Jun 10 2021 apt-daily.service | ||
| + | -rw-r--r-- 1 root root 156 Jun 10 2021 apt-daily.timer | ||
| + | -rw-r--r-- 1 root root 389 Jun 10 2021 apt-daily-upgrade.service | ||
| + | -rw-r--r-- 1 root root 184 Jun 10 2021 apt-daily-upgrade.timer | ||
| + | -rw-r--r-- 1 root root 1491 Jan 6 2021 auditd.service | ||
| + | lrwxrwxrwx 1 root root 14 Mar 20 20:55 autovt@.service -> getty@.service | ||
| + | -rw-r--r-- 1 root root 1044 Feb 6 2021 avahi-daemon.service | ||
| + | -rw-r--r-- 1 root root 870 Feb 6 2021 avahi-daemon.socket | ||
| + | -rw-r--r-- 1 root root 927 Feb 2 2021 basic.target | ||
| + | -rw-r--r-- 1 root root 380 Feb 22 2021 blk-availability.service | ||
| + | -rw-r--r-- 1 root root 449 Feb 2 2021 blockdev@.target | ||
| + | -rw-r--r-- 1 root root 427 Feb 2 2021 bluetooth.target | ||
| + | -rw-r--r-- 1 root root 463 Feb 2 2021 boot-complete.target | ||
| + | -rw-r--r-- 1 root root 295 Nov 12 2020 colord.service | ||
| + | -rw-r--r-- 1 root root 150 Jan 13 2021 configure-printer@.service | ||
| + | -rw-r--r-- 1 root root 1073 Mar 20 20:55 console-getty.service | ||
| + | -rw-r--r-- 1 root root 312 Oct 29 2018 console-setup.service | ||
| + | -rw-r--r-- 1 root root 1254 Mar 20 20:55 container-getty@.service | ||
| + | -rw-r--r-- 1 root root 316 Feb 22 2021 cron.service | ||
| + | lrwxrwxrwx 1 root root 9 Mar 20 20:55 cryptdisks-early.service -> /dev/null | ||
| + | lrwxrwxrwx 1 root root 9 Mar 20 20:55 cryptdisks.service -> /dev/null | ||
| + | -rw-r--r-- 1 root root 473 Feb 2 2021 cryptsetup-pre.target | ||
| + | -rw-r--r-- 1 root root 420 Feb 2 2021 cryptsetup.target | ||
| + | lrwxrwxrwx 1 root root 13 Mar 20 20:55 ctrl-alt-del.target -> reboot.target | ||
| + | -rw-r--r-- 1 root root 234 Jan 7 2021 cups-browsed.service | ||
| + | -rw-r--r-- 1 root root 142 May 27 2021 cups.path | ||
| + | -rw-r--r-- 1 root root 278 May 27 2021 cups.service | ||
| + | -rw-r--r-- 1 root root 132 May 27 2021 cups.socket | ||
| + | lrwxrwxrwx 1 root root 25 Mar 20 20:55 dbus-org.freedesktop.hostname1.service -> systemd-hostnamed.service | ||
| + | lrwxrwxrwx 1 root root 23 Mar 20 20:55 dbus-org.freedesktop.locale1.service -> systemd-localed.service | ||
| + | lrwxrwxrwx 1 root root 22 Mar 20 20:55 dbus-org.freedesktop.login1.service -> systemd-logind.service | ||
| + | lrwxrwxrwx 1 root root 25 Mar 20 20:55 dbus-org.freedesktop.timedate1.service -> systemd-timedated.service | ||
| + | -rw-r--r-- 1 root root 380 Feb 21 2021 dbus.service | ||
| + | -rw-r--r-- 1 root root 102 Feb 21 2021 dbus.socket | ||
| + | -rw-r--r-- 1 root root 1065 Mar 20 20:55 debug-shell.service | ||
| + | lrwxrwxrwx 1 root root 16 Mar 20 20:55 default.target -> graphical.target | ||
| + | -rw-r--r-- 1 root root 758 Feb 2 2021 dev-hugepages.mount | ||
| + | -rw-r--r-- 1 root root 701 Feb 2 2021 dev-mqueue.mount | ||
| + | -rw-r--r-- 1 root root 341 Feb 22 2021 dm-event.service | ||
| + | -rw-r--r-- 1 root root 248 Feb 22 2021 dm-event.socket | ||
| + | -rw-r--r-- 1 root root 297 Jun 7 2021 e2scrub_all.service | ||
| + | -rw-r--r-- 1 root root 251 Jun 7 2021 e2scrub_all.timer | ||
| + | -rw-r--r-- 1 root root 245 Jun 7 2021 e2scrub_fail@.service | ||
| + | -rw-r--r-- 1 root root 550 Jun 7 2021 e2scrub_reap.service | ||
| + | -rw-r--r-- 1 root root 438 Jun 7 2021 e2scrub@.service | ||
| + | -rw-r--r-- 1 root root 805 Mar 20 20:55 emergency.service | ||
| + | -rw-r--r-- 1 root root 479 Feb 2 2021 emergency.target | ||
| + | -rw-r--r-- 1 root root 549 Feb 2 2021 exit.target | ||
| + | -rw-r--r-- 1 root root 488 Feb 2 2021 final.target | ||
| + | -rw-r--r-- 1 root root 461 Feb 2 2021 first-boot-complete.target | ||
| + | -rw-r--r-- 1 root root 477 Jan 20 21:10 fstrim.service | ||
| + | --More-- | ||
| + | [q] | ||
| + | </ | ||
| - | Les Cibles et les Unités sont configurées par des fichiers | + | ===3.2 - Surchargement |
| + | |||
| + | Certains | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# ls -l /run/ |
| - | total 12 | + | total 0 |
| - | drwxr-xr-x. 2 root root 54 Mar 8 13:57 basic.target.wants | + | |
| - | drwxr-xr-x. 2 root root 30 Mar 8 13:53 bluetooth.target.wants | + | |
| - | lrwxrwxrwx. 1 root root 41 Mar 8 13:53 dbus-org.bluez.service -> / | + | |
| - | lrwxrwxrwx. 1 root root 41 Mar 8 13:48 dbus-org.fedoraproject.FirewallD1.service -> / | + | |
| - | 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 -> / | + | |
| - | lrwxrwxrwx. 1 root root 46 Mar 8 13:49 dbus-org.freedesktop.NetworkManager.service -> / | + | |
| - | 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 63 Jun 4 14:59 graphical.target.wants | + | |
| - | 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 30 Jun 4 10:00 remote-fs.target.wants | + | |
| - | 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 | + | Les fichiers de configuration des Unités crées |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# pkg-config systemd --variable=systemduserunitdir |
| - | total 1208 | + | /usr/ |
| - | -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-- | + | |
| </ | </ | ||
| + | |||
| + | <WRAP center round important 60%> | ||
| + | **Important** : De cette façon les fichiers dans **/ | ||
| + | </ | ||
| + | |||
| + | Les fichiers de configuration par défaut peuvent être surchargés par des fichiers dans d' | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# pkg-config systemd --variable=systemdsystemunitpath |
| - | 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-- | + | |
| </ | </ | ||
| - | Par exemple, sous RHEL/CentOS 7, le service **sshd** est configuré par le fichier **/ | + | ===3.3 - Les Fichiers d' |
| + | |||
| + | Prenons maintenant | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# cat / |
| [Unit] | [Unit] | ||
| - | Description=OpenSSH | + | Description=OpenBSD Secure Shell server |
| - | After=network.target | + | Documentation=man: |
| - | Wants=sshd-keygen.service | + | After=network.target |
| + | ConditionPathExists=!/ | ||
| [Service] | [Service] | ||
| - | EnvironmentFile=/ | + | EnvironmentFile=-/etc/default/ |
| - | ExecStart=/ | + | ExecStartPre=/ |
| + | ExecStart=/ | ||
| + | ExecReload=/ | ||
| ExecReload=/ | ExecReload=/ | ||
| KillMode=process | KillMode=process | ||
| Restart=on-failure | Restart=on-failure | ||
| - | RestartSec=42s | + | RestartPreventExitStatus=255 |
| + | Type=notify | ||
| + | RuntimeDirectory=sshd | ||
| + | RuntimeDirectoryMode=0755 | ||
| [Install] | [Install] | ||
| WantedBy=multi-user.target | WantedBy=multi-user.target | ||
| + | Alias=sshd.service | ||
| </ | </ | ||
| - | Dans le fichier on peut noter la présence des lignes suivantes : | + | Dans le fichier on peut noter la présence des lignes suivantes |
| - | * **ExecStart=/usr/sbin/sshd -D $OPTIONS**, | + | * **Description=OpenBSD Secure Shell server**, |
| - | | + | * Cette directive est utilisée pour donner une courte description des fonctionnalités de l' |
| - | * **After=network.target | + | * **Documentation=man: |
| - | * Cette ligne indique les services | + | * Cette directive stipule les chapitres des manuels et les URLs contenant de l'information en relation avec l' |
| - | * **WantedBy=multi-user.target**, | + | * **After=network.target |
| - | * Cette ligne indique la Cible dans laquelle | + | * Cette directive |
| + | |||
| + | Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** : | ||
| + | |||
| + | * **Type=notify**, | ||
| + | * Cette directive indique que le service informera Systemd quand son démarrage | ||
| + | * **ExecStart=/ | ||
| + | * Cette directive définit l' | ||
| + | * **ExecReload=/ | ||
| + | * Cette directive | ||
| + | * **KillMode=process**, | ||
| + | * Cette directive indique comment les processus du service doivent | ||
| * **Restart=on-failure**, | * **Restart=on-failure**, | ||
| - | * Cette ligne indique | + | * Cette ligne indique |
| - | ====Système | + | On note la présence |
| - | **Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d' | + | |
| + | | ||
| - | * runlevel0.target, | + | < |
| - | * runlevel1.target, | + | root@debian11: |
| - | * runlevel2.target, | + | total 0 |
| - | * runlevel3.target, | + | lrwxrwxrwx 1 root root 35 Apr 25 06:47 anacron.service -> / |
| - | * runlevel4.target, | + | lrwxrwxrwx 1 root root 34 Apr 29 14:24 auditd.service -> / |
| - | * runlevel5.target, | + | lrwxrwxrwx 1 root root 40 Apr 25 06:51 avahi-daemon.service -> / |
| - | * runlevel6.target. | + | lrwxrwxrwx 1 root root 41 Apr 25 06:32 console-setup.service -> / |
| + | lrwxrwxrwx 1 root root 32 Apr 25 06:31 cron.service -> / | ||
| + | lrwxrwxrwx 1 root root 40 Apr 25 06:52 cups-browsed.service -> / | ||
| + | lrwxrwxrwx 1 root root 29 Apr 25 06:52 cups.path -> / | ||
| + | lrwxrwxrwx 1 root root 38 Apr 25 06:51 lm-sensors.service -> / | ||
| + | lrwxrwxrwx 1 root root 40 Apr 25 06:52 ModemManager.service -> / | ||
| + | lrwxrwxrwx 1 root root 38 Apr 25 06:31 networking.service -> / | ||
| + | lrwxrwxrwx 1 root root 42 Apr 25 06:52 NetworkManager.service -> / | ||
| + | lrwxrwxrwx 1 root root 36 Apr 25 06:30 remote-fs.target | ||
| + | lrwxrwxrwx 1 root root 33 Apr 28 13:36 rsync.service -> / | ||
| + | lrwxrwxrwx 1 root root 35 Apr 25 06:31 rsyslog.service -> / | ||
| + | lrwxrwxrwx 1 root root 31 Apr 25 07:04 ssh.service -> / | ||
| + | lrwxrwxrwx 1 root root 42 Apr 25 06:51 wpa_supplicant.service -> / | ||
| + | </ | ||
| - | Ceci étant dans RHEL/CentOS 7 il y principalement deux Cibles finales | + | Dernièrement, |
| - | * **multi-user.target** | + | * **Alias=sshd.service** |
| - | * **graphical.target** qui est l'équivalent du niveau d' | + | |
| + | Les alias se trouvent dans la répertoire **/ | ||
| + | |||
| + | < | ||
| + | root@debian11: | ||
| + | total 36 | ||
| + | lrwxrwxrwx 1 root root 42 Apr 25 06:51 dbus-fi.w1.wpa_supplicant1.service -> / | ||
| + | lrwxrwxrwx 1 root root 40 Apr 25 06:51 dbus-org.freedesktop.Avahi.service -> / | ||
| + | lrwxrwxrwx 1 root root 40 Apr 25 06:52 dbus-org.freedesktop.ModemManager1.service -> / | ||
| + | lrwxrwxrwx 1 root root 53 Apr 25 06:52 dbus-org.freedesktop.nm-dispatcher.service -> / | ||
| + | lrwxrwxrwx 1 root root 45 Apr 25 06:48 dbus-org.freedesktop.timesync1.service -> / | ||
| + | drwxr-xr-x 2 root root 4096 Apr 25 06:30 default.target.wants | ||
| + | lrwxrwxrwx 1 root root 35 Apr 25 06:53 display-manager.service -> / | ||
| + | drwxr-xr-x 2 root root 4096 Apr 25 06:30 getty.target.wants | ||
| + | drwxr-xr-x 2 root root 4096 Apr 25 06:50 graphical.target.wants | ||
| + | drwxr-xr-x 2 root root 4096 Apr 29 14:24 multi-user.target.wants | ||
| + | drwxr-xr-x 2 root root 4096 Apr 25 06:52 network-online.target.wants | ||
| + | drwxr-xr-x 2 root root 4096 Apr 25 06:52 printer.target.wants | ||
| + | drwxr-xr-x 2 root root 4096 Apr 26 13:47 sockets.target.wants | ||
| + | lrwxrwxrwx 1 root root 31 Apr 25 07:04 sshd.service -> / | ||
| + | drwxr-xr-x 2 root root 4096 Apr 26 13:47 sysinit.target.wants | ||
| + | lrwxrwxrwx 1 root root 35 Apr 25 06:31 syslog.service -> / | ||
| + | drwxr-xr-x 2 root root 4096 Apr 29 14:38 timers.target.wants | ||
| + | </ | ||
| + | |||
| + | Pour consulter | ||
| + | |||
| + | < | ||
| + | root@debian11: | ||
| + | Type=notify | ||
| + | Restart=on-failure | ||
| + | NotifyAccess=main | ||
| + | RestartUSec=100ms | ||
| + | TimeoutStartUSec=1min 30s | ||
| + | TimeoutStopUSec=1min 30s | ||
| + | TimeoutAbortUSec=1min 30s | ||
| + | TimeoutStartFailureMode=terminate | ||
| + | TimeoutStopFailureMode=terminate | ||
| + | RuntimeMaxUSec=infinity | ||
| + | WatchdogUSec=0 | ||
| + | WatchdogTimestampMonotonic=0 | ||
| + | RootDirectoryStartOnly=no | ||
| + | RemainAfterExit=no | ||
| + | GuessMainPID=yes | ||
| + | RestartPreventExitStatus=255 | ||
| + | MainPID=449 | ||
| + | ControlPID=0 | ||
| + | FileDescriptorStoreMax=0 | ||
| + | NFileDescriptorStore=0 | ||
| + | StatusErrno=0 | ||
| + | Result=success | ||
| + | ReloadResult=success | ||
| + | CleanResult=success | ||
| + | UID=[not set] | ||
| + | GID=[not set] | ||
| + | NRestarts=0 | ||
| + | OOMPolicy=stop | ||
| + | ExecMainStartTimestamp=Tue 2022-04-26 13:08:21 CEST | ||
| + | ExecMainStartTimestampMonotonic=7283003 | ||
| + | ExecMainExitTimestampMonotonic=0 | ||
| + | ExecMainPID=449 | ||
| + | ExecMainCode=0 | ||
| + | ExecMainStatus=0 | ||
| + | ExecStartPre={ path=/ | ||
| + | ExecStartPreEx={ path=/ | ||
| + | ExecStart={ path=/ | ||
| + | ExecStartEx={ path=/ | ||
| + | ExecReload={ path=/ | ||
| + | ExecReload={ path=/ | ||
| + | ExecReloadEx={ path=/ | ||
| + | ExecReloadEx={ path=/ | ||
| + | Slice=system.slice | ||
| + | ControlGroup=/ | ||
| + | MemoryCurrent=5832704 | ||
| + | CPUUsageNSec=664103000 | ||
| + | EffectiveCPUs= | ||
| + | EffectiveMemoryNodes= | ||
| + | TasksCurrent=1 | ||
| + | IPIngressBytes=[no data] | ||
| + | IPIngressPackets=[no data] | ||
| + | IPEgressBytes=[no data] | ||
| + | IPEgressPackets=[no data] | ||
| + | IOReadBytes=18446744073709551615 | ||
| + | IOReadOperations=18446744073709551615 | ||
| + | IOWriteBytes=18446744073709551615 | ||
| + | IOWriteOperations=18446744073709551615 | ||
| + | Delegate=no | ||
| + | lines 1-58 | ||
| + | [q] | ||
| + | </ | ||
| + | |||
| + | Pour consulter la liste des dépendances d'une Unité, il convient d' | ||
| + | |||
| + | < | ||
| + | root@debian11: | ||
| + | sshd.service | ||
| + | ● ├─-.mount | ||
| + | ● ├─system.slice | ||
| + | ● └─sysinit.target | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● | ||
| + | ● │ └─systemd-cryptsetup@sdc11.service | ||
| + | ● | ||
| + | ● │ ├─-.mount | ||
| + | ● │ ├─mnt-sdc11.mount | ||
| + | ● │ ├─systemd-fsck-root.service | ||
| + | ● │ └─systemd-remount-fs.service | ||
| + | ● | ||
| + | ● | ||
| + | </ | ||
| + | |||
| + | ====LAB #4 - La Commande systemd-analyze==== | ||
| + | |||
| + | Pour avoir une évaluation du temps de démarrage, il convient d' | ||
| + | |||
| + | < | ||
| + | root@debian11: | ||
| + | Startup finished in 3.197s (kernel) + 4.577s (userspace) = 7.775s | ||
| + | graphical.target | ||
| + | </ | ||
| + | |||
| + | L' | ||
| + | |||
| + | < | ||
| + | root@debian11: | ||
| + | 1.781s dev-sdb1.device | ||
| + | 1.645s man-db.service | ||
| + | 1.304s apparmor.service | ||
| + | 1.254s udisks2.service | ||
| + | 1.212s systemd-random-seed.service | ||
| + | 1.155s systemd-journal-flush.service | ||
| + | 1.027s NetworkManager-wait-online.service | ||
| + | 1.005s systemd-udevd.service | ||
| + | 876ms ModemManager.service | ||
| + | 645ms ssh.service | ||
| + | 608ms NetworkManager.service | ||
| + | 584ms polkit.service | ||
| + | 542ms logrotate.service | ||
| + | 469ms avahi-daemon.service | ||
| + | 449ms wpa_supplicant.service | ||
| + | 445ms systemd-logind.service | ||
| + | 441ms lightdm.service | ||
| + | 433ms plymouth-quit-wait.service | ||
| + | 410ms user@113.service | ||
| + | 372ms apt-daily.service | ||
| + | 358ms apt-daily-upgrade.service | ||
| + | 329ms packagekit.service | ||
| + | 313ms keyboard-setup.service | ||
| + | 299ms networking.service | ||
| + | 288ms systemd-timesyncd.service | ||
| + | 226ms systemd-tmpfiles-setup.service | ||
| + | 197ms systemd-modules-load.service | ||
| + | 196ms rsyslog.service | ||
| + | 184ms systemd-udev-trigger.service | ||
| + | 165ms e2scrub_reap.service | ||
| + | 164ms systemd-journald.service | ||
| + | 152ms user@1000.service | ||
| + | 108ms hddtemp.service | ||
| + | 101ms systemd-tmpfiles-setup-dev.service | ||
| + | 94ms systemd-sysusers.service | ||
| + | 93ms plymouth-start.service | ||
| + | 91ms lvm2-pvscan@8: | ||
| + | 89ms systemd-update-utmp.service | ||
| + | 86ms systemd-remount-fs.service | ||
| + | 80ms lm-sensors.service | ||
| + | 72ms lvm2-pvscan@8: | ||
| + | 68ms systemd-sysctl.service | ||
| + | 67ms plymouth-read-write.service | ||
| + | 65ms lvm2-monitor.service | ||
| + | 63ms dev-hugepages.mount | ||
| + | 63ms sys-kernel-debug.mount | ||
| + | 62ms dev-mqueue.mount | ||
| + | 60ms sys-kernel-tracing.mount | ||
| + | 57ms lvm2-pvscan@8: | ||
| + | 41ms systemd-user-sessions.service | ||
| + | 33ms modprobe@fuse.service | ||
| + | 32ms sys-kernel-config.mount | ||
| + | 32ms ifupdown-pre.service | ||
| + | 27ms auditd.service | ||
| + | 27ms console-setup.service | ||
| + | 22ms rtkit-daemon.service | ||
| + | 20ms modprobe@configfs.service | ||
| + | 19ms sys-fs-fuse-connections.mount | ||
| + | lines 1-58 | ||
| + | [q] | ||
| + | </ | ||
| + | |||
| + | L' | ||
| + | |||
| + | < | ||
| + | root@debian11: | ||
| + | The time when unit became active or started is printed after the " | ||
| + | The time the unit took to start is printed after the " | ||
| + | |||
| + | ssh.service +645ms | ||
| + | └─network.target @3.425s | ||
| + | └─NetworkManager.service @2.816s +608ms | ||
| + | └─dbus.service @2.812s | ||
| + | └─basic.target @2.789s | ||
| + | └─sockets.target @2.789s | ||
| + | └─dbus.socket @2.789s | ||
| + | └─sysinit.target @2.786s | ||
| + | └─systemd-timesyncd.service @2.497s +288ms | ||
| + | └─systemd-tmpfiles-setup.service @2.268s +226ms | ||
| + | └─systemd-journal-flush.service @1.112s +1.155s | ||
| + | └─systemd-journald.service @946ms +164ms | ||
| + | └─systemd-journald.socket @925ms | ||
| + | └─system.slice @487ms | ||
| + | └─-.slice @487ms | ||
| + | </ | ||
| + | |||
| + | Les options de la commande **systemd-analyze** sont : | ||
| + | |||
| + | < | ||
| + | root@debian11: | ||
| + | systemd-analyze [OPTIONS...] COMMAND ... | ||
| + | |||
| + | Profile systemd, show unit dependencies, | ||
| + | |||
| + | Commands: | ||
| + | [time] | ||
| + | blame Print list of running units ordered by time to init | ||
| + | critical-chain [UNIT...] Print a tree of the time critical chain of units | ||
| + | plot | ||
| + | dot [UNIT...] | ||
| + | dump | ||
| + | cat-config | ||
| + | unit-files | ||
| + | unit-paths | ||
| + | exit-status [STATUS...] | ||
| + | capability [CAP...] | ||
| + | syscall-filter [NAME...] Print list of syscalls in seccomp filter | ||
| + | condition CONDITION... | ||
| + | verify FILE... | ||
| + | calendar SPEC... | ||
| + | timestamp TIMESTAMP... | ||
| + | timespan SPAN... | ||
| + | security [UNIT...] | ||
| + | |||
| + | Options: | ||
| + | -h --help | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | -H --host=[USER@]HOST | ||
| + | -M --machine=CONTAINER | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | than the latest in the branch | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | See the systemd-analyze(1) man page for details. | ||
| + | </ | ||
| + | |||
| + | ====LAB #5 - Les Cibles==== | ||
| Chaque Cible est décrite par un fichier de configuration : | Chaque Cible est décrite par un fichier de configuration : | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# cat / |
| + | # SPDX-License-Identifier: | ||
| + | # | ||
| # This file is part of systemd. | # This file is part of systemd. | ||
| # | # | ||
| Ligne 3516: | Ligne 3725: | ||
| Documentation=man: | Documentation=man: | ||
| Requires=multi-user.target | Requires=multi-user.target | ||
| - | After=multi-user.target | ||
| - | Conflicts=rescue.target | ||
| Wants=display-manager.service | Wants=display-manager.service | ||
| + | Conflicts=rescue.service rescue.target | ||
| + | After=multi-user.target rescue.service rescue.target display-manager.service | ||
| AllowIsolate=yes | AllowIsolate=yes | ||
| - | |||
| - | [Install] | ||
| - | Alias=default.target | ||
| </ | </ | ||
| Ligne 3528: | Ligne 3734: | ||
| * **Requires=multi-user.target**, | * **Requires=multi-user.target**, | ||
| - | * Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n'a pas été atteint | + | * Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n'a pas été atteint |
| - | * **After=multi-user.target**, | + | * **After=multi-user.target |
| - | * Cette ligne indique le **multi-user.target** | + | * Cette ligne indique le **multi-user.target** |
| - | * **Conflicts=rescue.target**, | + | * **Conflicts=rescue.service |
| - | * Cette ligne indique la Cible en conflit | + | * Cette ligne indique la Cible et le service |
| * **Wants=display-manager.service**, | * **Wants=display-manager.service**, | ||
| * Cette ligne indique quel service doit être démarré. | * Cette ligne indique quel service doit être démarré. | ||
| - | Dernièrement, | + | ===5.1 - Contrôler les dépendances d' |
| + | |||
| + | Les dépendances d'une Cible peuvent | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl list-dependencies multi-user.target |
| - | lrwxrwxrwx. 1 root root 36 Mar 8 14:05 /etc/systemd/system/default.target -> /lib/systemd/ | + | multi-user.target |
| + | ● ├─anacron.service | ||
| + | ● ├─auditd.service | ||
| + | ● ├─avahi-daemon.service | ||
| + | ● ├─console-setup.service | ||
| + | ● ├─cron.service | ||
| + | ● ├─cups-browsed.service | ||
| + | ● ├─cups.path | ||
| + | ● ├─dbus.service | ||
| + | ● ├─hddtemp.service | ||
| + | ● ├─lm-sensors.service | ||
| + | ● ├─ModemManager.service | ||
| + | ● ├─networking.service | ||
| + | ● ├─NetworkManager.service | ||
| + | ● ├─plymouth-quit-wait.service | ||
| + | ● ├─plymouth-quit.service | ||
| + | ● ├─rsync.service | ||
| + | ● ├─rsyslog.service | ||
| + | ● ├─ssh.service | ||
| + | ● ├─systemd-ask-password-wall.path | ||
| + | ● ├─systemd-logind.service | ||
| + | ● ├─systemd-update-utmp-runlevel.service | ||
| + | ● ├─systemd-user-sessions.service | ||
| + | ● ├─wpa_supplicant.service | ||
| + | ● ├─basic.target | ||
| + | ● │ ├─-.mount | ||
| + | ● │ ├─tmp.mount | ||
| + | ● │ ├─paths.target | ||
| + | ● │ ├─slices.target | ||
| + | ● │ │ ├─-.slice | ||
| + | ● │ │ └─system.slice | ||
| + | ● │ ├─sockets.target | ||
| + | ● │ │ ├─avahi-daemon.socket | ||
| + | ● │ │ ├─cups.socket | ||
| + | ● │ │ ├─dbus.socket | ||
| + | ● │ │ ├─dm-event.socket | ||
| + | ● │ │ ├─systemd-initctl.socket | ||
| + | ● │ │ ├─systemd-journald-audit.socket | ||
| + | ● │ │ ├─systemd-journald-dev-log.socket | ||
| + | ● │ │ ├─systemd-journald.socket | ||
| + | ● │ │ ├─systemd-udevd-control.socket | ||
| + | ● │ │ └─systemd-udevd-kernel.socket | ||
| + | ● │ ├─sysinit.target | ||
| + | ● │ │ ├─apparmor.service | ||
| + | ● │ │ ├─blk-availability.service | ||
| + | ● │ │ ├─dev-hugepages.mount | ||
| + | ● │ │ ├─dev-mqueue.mount | ||
| + | ● │ │ ├─keyboard-setup.service | ||
| + | ● │ │ ├─kmod-static-nodes.service | ||
| + | ● │ │ ├─lvm2-lvmpolld.socket | ||
| + | ● │ │ ├─lvm2-monitor.service | ||
| + | ● │ │ ├─plymouth-read-write.service | ||
| + | ● │ │ ├─plymouth-start.service | ||
| + | ● │ │ ├─proc-sys-fs-binfmt_misc.automount | ||
| + | ● │ │ ├─sys-fs-fuse-connections.mount | ||
| + | ● │ │ ├─sys-kernel-config.mount | ||
| + | ● │ │ ├─sys-kernel-debug.mount | ||
| + | ● │ │ ├─sys-kernel-tracing.mount | ||
| + | lines 1-58 | ||
| + | [q] | ||
| </ | </ | ||
| - | ====La Commande systemd-analyze==== | + | Les points noirs au début de chaque ligne dans la sortie ci-dessus peuvent être de trois couleurs différentes : |
| - | Pour avoir une évaluation du temps de démarrage, il convient | + | * **Vert** implique que le service, la cible ou l' |
| + | * **Blanc** implique le service, la cible ou l' | ||
| + | * **Rouge** implique que le service, la cible ou l' | ||
| + | |||
| + | Pour visualiser les Unités en état d' | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl |
| - | Startup finished in 769ms (kernel) + 4.643s (initrd) + 40.147s (userspace) = 45.560s | + | UNIT LOAD ACTIVE SUB DESCRIPTION |
| + | 0 loaded units listed. | ||
| </ | </ | ||
| - | L' | + | Les dépendances sont créés sous la forme de liens symboliques dans les répertoires |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# ls -l /etc/systemd/ |
| - | 12.274s firewalld.service | + | total 0 |
| - | 10.302s tuned.service | + | lrwxrwxrwx 1 root root 35 Apr 25 06:47 anacron.service -> / |
| - | | + | lrwxrwxrwx 1 root root 34 Apr 29 14:24 auditd.service -> / |
| - | 8.875s gssproxy.service | + | lrwxrwxrwx 1 root root 40 Apr 25 06:51 avahi-daemon.service |
| - | 8.860s ModemManager.service | + | lrwxrwxrwx 1 root root 41 Apr 25 06:32 console-setup.service |
| - | 8.598s vboxadd-x11.service | + | lrwxrwxrwx 1 root root 32 Apr 25 06:31 cron.service -> / |
| - | | + | lrwxrwxrwx 1 root root 40 Apr 25 06:52 cups-browsed.service -> / |
| - | 7.089s vboxadd.service | + | lrwxrwxrwx 1 root root 29 Apr 25 06:52 cups.path -> / |
| - | 6.398s plymouth-quit-wait.service | + | lrwxrwxrwx 1 root root 38 Apr 25 06:51 lm-sensors.service -> /lib/ |
| - | | + | lrwxrwxrwx 1 root root 40 Apr 25 06:52 ModemManager.service |
| - | 5.379s | + | lrwxrwxrwx |
| - | | + | lrwxrwxrwx |
| - | 5.065s postfix.service | + | lrwxrwxrwx |
| - | 4.684s | + | lrwxrwxrwx |
| - | | + | lrwxrwxrwx 1 root root 35 Apr 25 06:31 rsyslog.service -> / |
| - | 4.306s rtkit-daemon.service | + | lrwxrwxrwx 1 root root 31 Apr 25 07:04 ssh.service -> / |
| - | | + | lrwxrwxrwx 1 root root 42 Apr 25 06:51 wpa_supplicant.service |
| - | 3.396s ksmtuned.service | + | |
| - | 3.084s rhel-dmesg.service | + | root@debian11: |
| - | 2.811s libvirtd.service | + | total 0 |
| - | 2.428s chronyd.service | + | lrwxrwxrwx 1 root root 15 Feb 21 2021 dbus.service -> ../dbus.service |
| - | 2.401s vboxadd-service.service | + | lrwxrwxrwx 1 root root 15 Mar 20 20:55 getty.target |
| - | | + | lrwxrwxrwx 1 root root 24 Mar 2 2021 plymouth-quit.service -> ../plymouth-quit.service |
| - | 2.266s var-lib-nfs-rpc_pipefs.mount | + | lrwxrwxrwx 1 root root 29 Mar 2 2021 plymouth-quit-wait.service -> ../plymouth-quit-wait.service |
| - | 2.229s rhel-loadmodules.service | + | lrwxrwxrwx 1 root root 33 Mar 20 20:55 systemd-ask-password-wall.path -> ../systemd-ask-password-wall.path |
| - | | + | lrwxrwxrwx 1 root root 25 Mar 20 20:55 systemd-logind.service -> ../systemd-logind.service |
| - | 1.357s network.service | + | lrwxrwxrwx 1 root root 39 Mar 20 20:55 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service |
| - | 1.283s lvm2-monitor.service | + | lrwxrwxrwx 1 root root 32 Mar 20 20:55 systemd-user-sessions.service -> ../systemd-user-sessions.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 | + | |
| - | | + | |
| - | 161ms systemd-udevd.service | + | |
| - | 147ms upower.service | + | |
| - | | + | |
| - | 110ms plymouth-start.service | + | |
| - | 96ms sys-fs-fuse-connections.mount | + | |
| - | 82ms bluetooth.service | + | |
| - | 73ms iscsi-shutdown.service | + | |
| - | | + | |
| - | 63ms systemd-hostnamed.service | + | |
| - | 53ms systemd-update-utmp.service | + | |
| - | | + | |
| - | 33ms sys-kernel-config.mount | + | |
| - | 31ms systemd-update-utmp-runlevel.service | + | |
| - | lines 43-71/71 (END) | + | |
| </ | </ | ||
| - | L'option | + | ===5.2 - La Cible par Défaut=== |
| + | |||
| + | ==Consulter la Cible par Défaut== | ||
| + | |||
| + | Pour consulter la cible par défaut, il convient d'utiliser la commande | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl get-default |
| - | The time after the unit is active or started is printed after the " | + | graphical.target |
| - | The time the unit takes to start is printed after the " | + | </ |
| - | sshd.service @32.037s | + | ==Modifier la Cible par Défaut== |
| - | └─network.target @31.990s | + | |
| - | | + | Pour modifier la Cible par défaut avec une prise en compte lors du **prochain** démarrage, il convient d' |
| - | | + | |
| - | | + | < |
| - | | + | root@debian11:~# ls -l / |
| - | └─sockets.target | + | -rw-r--r-- 1 root root 540 Feb 2 2021 / |
| - | | + | root@debian11:~# systemctl set-default multi-user.target |
| - | └─sysinit.target @11.784s | + | Created symlink /etc/systemd/ |
| - | └─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 | + | |
| - | | + | |
| - | | + | |
| - | └─dev-disk-by\x2duuid-e8d3bd48\x2d1386\x2d411c\x2d9675\x2d41c3f8f1a309.device @9.650s | + | |
| </ | </ | ||
| - | ===Options de la Commande=== | + | ==Modifier |
| - | Les options | + | Il est possible |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl isolate rescue |
| - | systemd-analyze [OPTIONS...] {COMMAND} ... | + | |
| - | Process systemd profiling information | + | root@debian11: |
| + | rescue.target | ||
| - | -h --help | + | root@debian11: |
| - | --version | + | 5 1 |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | 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@debian11:~# who -r |
| - | | + | run-level 1 2022-04-30 12:19 |
| - | | + | |
| - | | + | root@debian11: |
| - | | + | |
| - | | + | root@debian11: |
| - | set-log-level | + | |
| - | dump Output state serialization of service manager | + | |
| + | root@debian11: | ||
| + | 1 3 | ||
| + | |||
| + | root@debian11: | ||
| + | run-level | ||
| </ | </ | ||
| - | ====Gestion des Services==== | + | ====LAB #6 - Gestion des Services==== |
| - | Pour obtenir | + | ===6.1 - Gestion des Instances Uniques=== |
| + | |||
| + | Commencez par installer | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# apt install -y apache2 |
| - | sshd.service - OpenSSH server daemon | + | </ |
| - | | + | |
| - | | + | Pour obtenir le détail sur un service donné, il convient d' |
| - | Main PID: 1212 (sshd) | + | |
| - | | + | < |
| - | | + | root@debian11: |
| + | ● apache2.service - The Apache HTTP Server | ||
| + | | ||
| + | | ||
| + | Docs: https:// | ||
| + | Main PID: 56037 (apache2) | ||
| + | | ||
| + | | ||
| + | CPU: 38ms | ||
| + | CGroup: / | ||
| + | ├─56037 / | ||
| + | | ||
| + | └─56040 /usr/sbin/apache2 | ||
| - | Jun 11 11:01:52 centos7.fenestros.loc | + | Apr 30 12:22:50 debian11 |
| - | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: | + | Apr 30 12:22:50 debian11 systemd[1]: Started The Apache HTTP Server. |
| - | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: Server | + | |
| </ | </ | ||
| - | Pour arrêter | + | Dans le cas du service apache2 ci-dessus, on peut constater que le statut est **enabled**. Le statut peut être une de 2 valeurs : |
| + | |||
| + | * **disabled** - le service | ||
| + | * **enabled** - le service démarrera lors du prochain démarrage du système. | ||
| + | |||
| + | Il est possible de vérifier le statut en utilisant le commande | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl |
| - | [root@centos7 ~]# systemctl status sshd.service | + | enabled |
| - | sshd.service - OpenSSH server daemon | + | </code> |
| - | | + | |
| - | Active: inactive (dead) since Thu 2015-06-11 13:58:59 CEST; 16s ago | + | |
| - | Process: 1212 ExecStart=/usr/ | + | |
| - | Main PID: 1212 (code=exited, | + | |
| - | Jun 11 11:01:52 centos7.fenestros.loc systemd[1]: Started OpenSSH server daemon. | + | Pour rendre le statut **disabled**, |
| - | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: Server listening on 0.0.0.0 port 22. | + | |
| - | Jun 11 11:01:53 centos7.fenestros.loc sshd[1212]: Server listening on :: port 22. | + | < |
| - | Jun 11 13:58:59 centos7.fenestros.loc systemd[1]: | + | root@debian11:~# systemctl disable apache2.service |
| - | Jun 11 13:58:59 centos7.fenestros.loc sshd[1212]: Received signal 15; terminating. | + | Synchronizing state of apache2.service with SysV service script with /lib/systemd/ |
| - | Jun 11 13:58:59 centos7.fenestros.loc | + | Executing: / |
| + | Removed / | ||
| + | |||
| + | root@debian11:~# systemctl is-enabled apache2.service | ||
| + | disabled | ||
| + | |||
| + | root@debian11: | ||
| + | ● apache2.service - The Apache HTTP Server | ||
| + | | ||
| + | Active: active (running) since Sat 2022-04-30 12:22:50 CEST; 3min 6s ago | ||
| + | Docs: https:// | ||
| + | Main PID: 56037 (apache2) | ||
| + | Tasks: 55 (limit: 4663) | ||
| + | | ||
| + | CPU: 46ms | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | Apr 30 12:22:50 debian11 | ||
| + | Apr 30 12:22:50 debian11 | ||
| </ | </ | ||
| - | Pour démarrer un service, | + | Dans le cas du service |
| + | |||
| + | * **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. | ||
| + | |||
| + | Il est possible de vérifier l' | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl |
| - | [root@centos7 ~]# systemctl status sshd.service | + | active |
| - | sshd.service | + | </code> |
| - | | + | |
| - | Active: | + | |
| - | Main PID: 6624 (sshd) | + | |
| - | | + | |
| - | | + | |
| - | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Starting OpenSSH server daemon... | + | Pour rendre l' |
| - | 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. | + | root@debian11:~# systemctl stop apache2.service |
| </ | </ | ||
| - | Pour désactiver un service au prochain démarrage du système, utilisez | + | Vérifiez ensuite |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl |
| - | rm '/ | + | inactive |
| - | [root@centos7 ~]# systemctl status sshd.service | + | |
| - | sshd.service - OpenSSH server daemon | + | |
| - | | + | |
| - | | + | |
| - | Main PID: 6624 (sshd) | + | |
| - | | + | |
| - | └─6624 / | + | |
| - | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Starting | + | root@debian11:~# systemctl status apache2.service |
| - | Jun 11 14:00:17 centos7.fenestros.loc | + | ● apache2.service - The Apache HTTP Server |
| - | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server | + | |
| - | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server | + | |
| + | Docs: https:// | ||
| + | Process: 56435 ExecStop=/ | ||
| + | Main PID: 56037 (code=exited, | ||
| + | CPU: 77ms | ||
| + | |||
| + | Apr 30 12:22:50 debian11 | ||
| + | Apr 30 12:22:50 debian11 | ||
| + | Apr 30 12:27:53 debian11 systemd[1]: Stopping The Apache HTTP Server... | ||
| + | Apr 30 12:27:53 debian11 systemd[1]: apache2.service: Succeeded. | ||
| + | Apr 30 12:27:53 debian11 systemd[1]: Stopped The Apache HTTP Server. | ||
| </ | </ | ||
| - | Pour activer un service | + | Pour démarrer une Unité de service, utilisez |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl |
| - | ln -s '/ | + | |
| - | [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... | + | root@debian11:~# systemctl status apache2.service |
| - | Jun 11 14:00:17 centos7.fenestros.loc systemd[1]: Started OpenSSH server daemon. | + | ● apache2.service - The Apache HTTP Server |
| - | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server | + | |
| - | Jun 11 14:00:17 centos7.fenestros.loc sshd[6624]: Server | + | Active: active (running) since Sat 2022-04-30 12:30:17 CEST; 2s ago |
| + | Docs: https:// | ||
| + | Process: 56448 ExecStart=/ | ||
| + | Main PID: 56452 (apache2) | ||
| + | Tasks: 55 (limit: 4663) | ||
| + | | ||
| + | CPU: 35ms | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | Apr 30 12:30:17 debian11 systemd[1]: Starting The Apache HTTP Server... | ||
| + | Apr 30 12:30:17 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| </ | </ | ||
| - | =====Arrêt | + | Pour activer un service au prochain démarrage |
| - | ====La Commande shutdown==== | + | < |
| + | root@debian11: | ||
| + | Synchronizing state of apache2.service with SysV service script with / | ||
| + | Executing: / | ||
| - | Lors de l' | + | Created symlink / |
| + | root@debian11:~# systemctl status apache2.service | ||
| + | ● apache2.service - The Apache HTTP Server | ||
| + | | ||
| + | | ||
| + | Docs: https:// | ||
| + | Main PID: 56452 (apache2) | ||
| + | Tasks: 55 (limit: 4663) | ||
| + | | ||
| + | CPU: 39ms | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| - | * Il previent les utilisateurs, | + | Apr 30 12:30:17 debian11 systemd[1]: Starting The Apache HTTP Server... |
| - | * Il arrête tous les services, | + | Apr 30 12:30:17 debian11 systemd[1]: Started The Apache HTTP Server. |
| - | * Il inscrit toutes les données sur disque, | + | </ |
| - | * Il démonte les systèmes de fichiers. | + | |
| - | La commande utilisée pour arrêter le système est la commande **shutdown** : | + | ===6.2 - Gestion d' |
| - | shutdown [-t sec] [-akrhHPfnc] heure [message] | + | Systemd permet l' |
| - | ===Options de la commande=== | + | < |
| + | root@debian11: | ||
| + | [Unit] | ||
| + | Description=The Apache HTTP Server | ||
| + | After=network.target remote-fs.target nss-lookup.target | ||
| + | ConditionPathIsDirectory=/ | ||
| + | Documentation=https:// | ||
| - | Les options | + | [Service] |
| + | Type=forking | ||
| + | Environment=APACHE_CONFDIR=/ | ||
| + | ExecStart=/ | ||
| + | ExecStop=/ | ||
| + | ExecReload=/ | ||
| + | KillMode=mixed | ||
| + | PrivateTmp=true | ||
| + | Restart=on-abort | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | |||
| + | Une instance créée à partir | ||
| < | < | ||
| - | Usage: | + | httpd@< |
| - | -a: use / | + | |
| - | -k: don't really shutdown, only warn. | + | |
| - | -r: reboot after shutdown. | + | |
| - | -h: halt after 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, | + | Dans ce fichier on peut constater l' |
| - | ^ Option ^ Description ^ | + | * %n : est remplacé par le nom complet échappé de l' |
| - | | -h | Arrêter | + | * %N : est remplacé par le nom complet non-échappé de l' |
| - | | -r | Re-démarrer | + | * %p : est remplacé par le préfixe échappé de l' |
| - | | -c | Annuler | + | * %P : est remplacé par le préfixe non-échappé de l' |
| - | | -f | Re-démarrer rapidement | + | * %i : est remplacé par le nom de l'instance échappé de l' |
| - | | -F | Forcer la vérification des systèmes | + | * %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' | ||
| + | * %U : est remplacé par l' | ||
| + | * %H : est remplacé par le nom d' | ||
| + | * %% : est remplacé" | ||
| - | L' | + | Créez maintenant deux copies du fichier |
| - | ^ Valeur ^ Description ^ | + | < |
| - | | hh:mm | L' | + | root@debian11:~# cp / |
| - | | +m | Nombre de minutes avant que l' | + | root@debian11: |
| - | | now | L' | + | </ |
| - | <WRAP center round important> | + | Copiez le répertoire |
| - | **Important** : Si l' | + | |
| - | </ | + | |
| - | Dans votre VM, ouvrez deux terminaux. Dans le premier passez en tant que root. Planifiez ensuite un redémarrage de la VM dans 30 minutes | + | < |
| + | root@debian11: | ||
| + | root@debian11: | ||
| + | </ | ||
| + | |||
| + | Editez le fichier **vi / | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# vi / |
| + | root@debian11: | ||
| + | # If you just change the port or add more ports here, you will likely also | ||
| + | # have to change the VirtualHost statement in | ||
| + | # / | ||
| - | Broadcast message from trainee@centos.fenestros.loc | + | Listen 81 |
| - | (/ | + | |
| - | The system is going down for reboot in 30 minutes! | + | < |
| - | </code> | + | Listen 443 |
| + | </IfModule> | ||
| - | Dans le deuxième terminal est passez en tant que route. Annulez ensuite le shutdown : | + | < |
| + | Listen 443 | ||
| + | </ | ||
| - | < | + | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet |
| - | [trainee@centos7 ~]$ su - | + | |
| - | Mot de passe : | + | |
| - | [root@centos7 ~]# shutdown -c | + | |
| </ | </ | ||
| - | Retournez au premier terminal et constatez | + | Editez |
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# vi / |
| + | root@debian11: | ||
| + | # If you just change the port or add more ports here, you will likely also | ||
| + | # have to change the VirtualHost statement in | ||
| + | # / | ||
| - | Broadcast message from trainee@centos.fenestros.loc | + | Listen 82 |
| - | (/ | + | |
| - | The system is going down for reboot in 30 minutes! | + | < |
| + | Listen 443 | ||
| + | </ | ||
| + | < | ||
| + | Listen 443 | ||
| + | </ | ||
| - | shutdown: Shutdown cancelled | + | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet |
| - | [root@centos7 ~]# | + | |
| </ | </ | ||
| - | ==== La Commande reboot==== | + | Editez la directive **APACHE_PID_FILE** du fichier **/ |
| - | Cette commande redémarre le système. Quand le système fonctionne normalement, | + | < |
| + | root@debian11: | ||
| + | root@debian11: | ||
| + | # envvars - default environment variables for apache2ctl | ||
| - | ===Options de la commande=== | + | # this won't be correct after changing uid |
| + | unset HOME | ||
| - | Les options de cette commande sont : | + | # for supporting multiple apache2 instances |
| + | if [ " | ||
| + | SUFFIX=" | ||
| + | else | ||
| + | SUFFIX= | ||
| + | fi | ||
| + | |||
| + | # Since there is no sane way to get the parsed apache2 config in scripts, some | ||
| + | # settings are defined via environment variables and then used in apache2ctl, | ||
| + | # / | ||
| + | export APACHE_RUN_USER=www-data | ||
| + | export APACHE_RUN_GROUP=www-data | ||
| + | # temporary state file location. This might be changed to /run in Wheezy+1 | ||
| + | export APACHE_PID_FILE=/ | ||
| + | export APACHE_RUN_DIR=/ | ||
| + | export APACHE_LOCK_DIR=/ | ||
| + | # Only / | ||
| + | export APACHE_LOG_DIR=/ | ||
| + | |||
| + | ## The locale used by some modules like mod_dav | ||
| + | export LANG=C | ||
| + | ## Uncomment the following line to use the system default locale instead: | ||
| + | #. / | ||
| + | |||
| + | export LANG | ||
| + | |||
| + | ## The command to get the status for ' | ||
| + | ## Some packages providing ' | ||
| + | #export APACHE_LYNX=' | ||
| + | |||
| + | ## If you need a higher file descriptor limit, uncomment and adjust the | ||
| + | ## following line (default is 8192): | ||
| + | # | ||
| + | |||
| + | ## If you would like to pass arguments to the web server, add them below | ||
| + | ## to the APACHE_ARGUMENTS environment. | ||
| + | #export APACHE_ARGUMENTS='' | ||
| + | |||
| + | ## Enable the debug mode for maintainer scripts. | ||
| + | ## This will produce a verbose output on package installations of web server modules and web application | ||
| + | ## installations which interact with Apache | ||
| + | #export APACHE2_MAINTSCRIPT_DEBUG=1 | ||
| + | </ | ||
| + | |||
| + | Editez la directive **APACHE_PID_FILE** du fichier **/ | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# vi / |
| - | Usage: reboot [OPTION]... | + | root@debian11:~# cat / |
| - | Reboot the system. | + | # envvars - default environment variables for apache2ctl |
| - | Options: | + | # this won' |
| - | -n, --no-sync | + | unset HOME |
| - | -f, --force | + | |
| - | -p, --poweroff | + | |
| - | -w, --wtmp-only | + | |
| - | record | + | |
| - | -q, --quiet | + | |
| - | -v, --verbose | + | |
| - | --help | + | |
| - | | + | |
| - | This command is intended to instruct the kernel to reboot or halt the system; | + | # for supporting multiple apache2 instances |
| - | when run without the -f option, or when in a system runlevel other than 0 or 6, | + | if [ " |
| - | it will actually execute | + | |
| + | else | ||
| + | SUFFIX= | ||
| + | fi | ||
| + | # Since there is no sane way to get the parsed apache2 config in scripts, some | ||
| + | # settings are defined via environment variables and then used in apache2ctl, | ||
| + | # / | ||
| + | export APACHE_RUN_USER=www-data | ||
| + | export APACHE_RUN_GROUP=www-data | ||
| + | # temporary state file location. This might be changed to /run in Wheezy+1 | ||
| + | export APACHE_PID_FILE=/ | ||
| + | export APACHE_RUN_DIR=/ | ||
| + | export APACHE_LOCK_DIR=/ | ||
| + | # Only / | ||
| + | export APACHE_LOG_DIR=/ | ||
| - | Report bugs to < | + | ## The locale used by some modules like mod_dav |
| - | </code> | + | export LANG=C |
| + | ## Uncomment the following line to use the system default locale instead: | ||
| + | #. / | ||
| - | ==== La Commande halt==== | + | export LANG |
| - | Cette commande arrête le système. Quand le système fonctionne normalement, | + | ## The command to get the status for ' |
| + | ## Some packages providing | ||
| + | #export APACHE_LYNX=' | ||
| - | ===Options de la commande=== | + | ## If you need a higher file descriptor limit, uncomment and adjust the |
| + | ## following line (default is 8192): | ||
| + | # | ||
| - | Les options de cette commande sont : | + | ## If you would like to pass arguments to the web server, add them below |
| + | ## to the APACHE_ARGUMENTS environment. | ||
| + | #export APACHE_ARGUMENTS='' | ||
| + | |||
| + | ## Enable the debug mode for maintainer scripts. | ||
| + | ## This will produce a verbose output on package installations of web server modules and web application | ||
| + | ## installations which interact with Apache | ||
| + | #export APACHE2_MAINTSCRIPT_DEBUG=1 | ||
| + | </ | ||
| + | |||
| + | Créez les répertoires **/ | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# mkdir / |
| - | Usage: halt [OPTION]... | + | root@debian11:~# mkdir / |
| - | Halt the system. | + | |
| - | Options: | + | root@debian11:~# chown root:adm / |
| - | -n, --no-sync | + | root@debian11: |
| - | -f, --force | + | </ |
| - | -p, --poweroff | + | |
| - | -w, --wtmp-only | + | Démarrez les deux services : |
| - | record | + | |
| - | -q, --quiet | + | < |
| - | -v, --verbose | + | root@debian11: |
| - | | + | |
| - | | + | root@debian11: |
| + | ● apache2@instance01.service | ||
| + | | ||
| + | | ||
| + | Docs: https:// | ||
| + | Process: 56906 ExecStart=/ | ||
| + | Main PID: 56910 (apache2) | ||
| + | | ||
| + | | ||
| + | CPU: 31ms | ||
| + | | ||
| + | ├─56910 / | ||
| + | ├─56911 / | ||
| + | └─56912 / | ||
| + | |||
| + | Apr 30 13:51:47 debian11 systemd[1]: Starting The Apache HTTP Server... | ||
| + | Apr 30 13:51:47 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| - | This command is intended to instruct the kernel to reboot or halt the system; | + | root@debian11: |
| - | when run without the -f option, or when in a system runlevel other than 0 or 6, | + | |
| - | it will actually execute / | + | |
| + | root@debian11: | ||
| + | ● apache2@instance02.service - The Apache HTTP Server | ||
| + | | ||
| + | | ||
| + | Docs: https:// | ||
| + | Process: 57137 ExecStart=/ | ||
| + | Main PID: 57148 (apache2) | ||
| + | Tasks: 55 (limit: 4663) | ||
| + | | ||
| + | CPU: 37ms | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| - | Report bugs to < | + | Apr 30 14:04:21 debian11 systemd[1]: Starting The Apache HTTP Server... |
| + | Apr 30 14:04:21 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| </ | </ | ||
| - | ==== La Commande poweroff==== | + | Installez l' |
| - | Cette commande arrête le système et coupe l' | + | < |
| + | root@debian11: | ||
| + | </ | ||
| - | ===Options de la commande=== | + | Testez ensuite les deux instances d' |
| - | Les options de cette commande | + | < |
| + | root@debian11: | ||
| + | | ||
| + | It works! | ||
| + | |||
| + | This is the default welcome page used to test the correct operation of | ||
| + | the Apache2 server after installation on Debian systems. If you can | ||
| + | read this page, it means that the Apache HTTP server installed at this | ||
| + | site is working properly. You should replace this file (located at | ||
| + | / | ||
| + | | ||
| + | |||
| + | If you are a normal user of this web site and don't know what this page | ||
| + | is about, this probably means that the site is currently unavailable | ||
| + | due to maintenance. If the problem persists, please contact the site' | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | for the full documentation. Documentation for the web server itself can | ||
| + | be found by accessing the [1]manual if the apache2-doc package was | ||
| + | | ||
| + | |||
| + | The configuration layout for an Apache2 web server installation on | ||
| + | | ||
| + | / | ||
| + | |-- apache2.conf | ||
| + | | | ||
| + | |-- mods-enabled | ||
| + | | |-- *.load | ||
| + | | `-- *.conf | ||
| + | |-- conf-enabled | ||
| + | | `-- *.conf | ||
| + | |-- sites-enabled | ||
| + | | `-- *.conf | ||
| + | |||
| + | * apache2.conf is the main configuration file. It puts the pieces | ||
| + | | ||
| + | | ||
| + | * ports.conf is always included from the main configuration file. It | ||
| + | is used to determine the listening ports for incoming connections, | ||
| + | and this file can be customized anytime. | ||
| + | * Configuration files in the mods-enabled/, | ||
| + | | ||
| + | | ||
| + | | ||
| + | * They are activated by symlinking available configuration files from | ||
| + | their respective *-available/ | ||
| + | by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and | ||
| + | | ||
| + | | ||
| + | * The binary is called apache2. Due to the use of environment | ||
| + | | ||
| + | | ||
| + | / | ||
| + | | ||
| + | |||
| + | --More-- | ||
| + | [q] | ||
| + | |||
| + | root@debian11: | ||
| + | | ||
| + | It works! | ||
| + | |||
| + | This is the default welcome page used to test the correct operation of | ||
| + | the Apache2 server after installation on Debian systems. If you can | ||
| + | read this page, it means that the Apache HTTP server installed at this | ||
| + | site is working properly. You should replace this file (located at | ||
| + | / | ||
| + | | ||
| + | |||
| + | If you are a normal user of this web site and don't know what this page | ||
| + | is about, this probably means that the site is currently unavailable | ||
| + | due to maintenance. If the problem persists, please contact the site' | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | for the full documentation. Documentation for the web server itself can | ||
| + | be found by accessing the [1]manual if the apache2-doc package was | ||
| + | | ||
| + | |||
| + | The configuration layout for an Apache2 web server installation on | ||
| + | | ||
| + | / | ||
| + | |-- apache2.conf | ||
| + | | | ||
| + | |-- mods-enabled | ||
| + | | |-- *.load | ||
| + | | `-- *.conf | ||
| + | |-- conf-enabled | ||
| + | | `-- *.conf | ||
| + | |-- sites-enabled | ||
| + | | `-- *.conf | ||
| + | |||
| + | * apache2.conf is the main configuration file. It puts the pieces | ||
| + | | ||
| + | | ||
| + | * ports.conf is always included from the main configuration file. It | ||
| + | is used to determine the listening ports for incoming connections, | ||
| + | and this file can be customized anytime. | ||
| + | * Configuration files in the mods-enabled/, | ||
| + | | ||
| + | | ||
| + | | ||
| + | * They are activated by symlinking available configuration files from | ||
| + | their respective *-available/ | ||
| + | by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and | ||
| + | | ||
| + | | ||
| + | * The binary is called apache2. Due to the use of environment | ||
| + | | ||
| + | | ||
| + | / | ||
| + | | ||
| + | |||
| + | --More-- | ||
| + | [q] | ||
| + | </ | ||
| + | |||
| + | ===6.3 - Interdire la Modification du Statut d'un Service=== | ||
| + | |||
| + | Il est possible d' | ||
| < | < | ||
| - | [root@centos7 | + | root@debian11:~# systemctl status apache2.service |
| - | Usage: poweroff [OPTION]... | + | ● apache2.service |
| - | Power off the system. | + | |
| + | | ||
| + | Docs: https:// | ||
| + | Main PID: 56452 (apache2) | ||
| + | Tasks: 55 (limit: 4663) | ||
| + | | ||
| + | CPU: 379ms | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| - | Options: | + | Apr 30 12:30:17 debian11 systemd[1]: Starting The Apache HTTP Server... |
| - | -n, --no-sync | + | Apr 30 12:30:17 debian11 systemd[1]: Started The Apache HTTP Server. |
| - | -f, --force force reboot or halt, don't call shutdown(8) | + | |
| - | -p, --poweroff | + | root@debian11: |
| - | -w, --wtmp-only | + | Created symlink / |
| - | | + | |
| - | -q, --quiet | + | root@debian11: |
| - | -v, --verbose | + | apache2.service |
| - | --help display this help and exit | + | apache2@.service |
| - | --version | + | apache2@instance01.service |
| + | apache2@instance02.service | ||
| + | |||
| + | root@debian11: | ||
| + | Synchronizing state of apache2.service with SysV service script with / | ||
| + | Executing: / | ||
| + | Unit / | ||
| + | |||
| + | root@debian11: | ||
| + | ● apache2.service - The Apache HTTP Server | ||
| + | | ||
| + | Active: active (running) since Sat 2022-04-30 14:17:14 CEST; 3s ago | ||
| + | Docs: https:// | ||
| + | Process: 57431 ExecStart=/ | ||
| + | Main PID: 57435 (apache2) | ||
| + | Tasks: 55 (limit: 4663) | ||
| + | | ||
| + | CPU: 33ms | ||
| + | | ||
| + | | ||
| + | | ||
| + | └─57437 / | ||
| + | |||
| + | Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server... | ||
| + | Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| + | |||
| + | root@debian11: | ||
| + | |||
| + | root@debian11: | ||
| + | ● apache2.service | ||
| + | | ||
| + | | ||
| + | Main PID: 57435 (code=exited, status=0/ | ||
| + | CPU: 39ms | ||
| + | |||
| + | Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server... | ||
| + | Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: Stopping apache2.service... | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: apache2.service: | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: Stopped apache2.service. | ||
| + | |||
| + | root@debian11: | ||
| + | Failed to start apache2.service: | ||
| + | |||
| + | root@debian11: | ||
| + | Removed / | ||
| + | |||
| + | root@debian11: | ||
| + | ● apache2.service | ||
| + | | ||
| + | | ||
| + | Docs: https:// | ||
| + | Main PID: 57435 (code=exited, status=0/ | ||
| + | CPU: 39ms | ||
| + | |||
| + | Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server... | ||
| + | Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: Stopping apache2.service... | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: apache2.service: | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: Stopped apache2.service. | ||
| + | |||
| + | root@debian11: | ||
| + | Synchronizing state of apache2.service with SysV service script with / | ||
| + | Executing: / | ||
| + | |||
| + | root@debian11: | ||
| + | ● apache2.service | ||
| + | | ||
| + | | ||
| + | Docs: https:// | ||
| + | Main PID: 57435 (code=exited, | ||
| + | CPU: 39ms | ||
| + | |||
| + | Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server... | ||
| + | Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: Stopping apache2.service... | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: apache2.service: | ||
| + | Apr 30 14:17:45 debian11 systemd[1]: Stopped apache2.service. | ||
| - | This command is intended to instruct the kernel to reboot or halt the system; | + | root@debian11: |
| - | when run without the -f option, or when in a system runlevel other than 0 or 6, | + | |
| - | it will actually execute / | + | |
| + | root@debian11: | ||
| + | ● apache2.service - The Apache HTTP Server | ||
| + | | ||
| + | | ||
| + | Docs: https:// | ||
| + | Process: 57685 ExecStart=/ | ||
| + | Main PID: 57689 (apache2) | ||
| + | Tasks: 55 (limit: 4663) | ||
| + | | ||
| + | CPU: 30ms | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| - | Report bugs to < | + | Apr 30 14:19:11 debian11 systemd[1]: Starting The Apache HTTP Server... |
| + | Apr 30 14:19:12 debian11 systemd[1]: Started The Apache HTTP Server. | ||
| </ | </ | ||
| ----- | ----- | ||
| - | < | ||
| - | <div align=" | ||
| Copyright © 2022 Hugh Norris. | Copyright © 2022 Hugh Norris. | ||
| - | </ | ||