tech:nouvelle_install_debian_configuration_optimisation
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:nouvelle_install_debian_configuration_optimisation [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:nouvelle_install_debian_configuration_optimisation [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Nouvelle Install Debian configuration optimisation | ||
| + | |||
| + | Optimisation perf : https:// | ||
| + | |||
| + | **Lors d'une nouvelle install, il faut d' | ||
| + | Voir : [[formater_une_carte_microsd_en_optimisant_les_performances_et_la_duree_de_vie]] | ||
| + | |||
| + | [[swap_sur_ramdisk]] | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | APT:: | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | PermitRootLogin without-password | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | mount | grep -v noatime | grep ext4 | grep -v noatime | ||
| + | ~~~ | ||
| + | |||
| + | Voir [[debian_noatime]] | ||
| + | |||
| + | SystemD - Désactiver le redémarrage par défaut si `ctrl+alt+del` | ||
| + | ~~~bash | ||
| + | unlink / | ||
| + | ln -s /dev/null / | ||
| + | systemctl daemon-reload | ||
| + | ~~~ | ||
| + | |||
| + | # Si x86 (32 bits) | ||
| + | |||
| + | Dans Debian, la configuration noyau 686 a été remplacée par la configuration 686-pae qui utilise PAE (« Physical Address Extension » − Extension d' | ||
| + | grep -q ' | ||
| + | S'il ne l'a pas (c' | ||
| + | |||
| + | |||
| + | # Hardening | ||
| + | |||
| + | Table ARP en dur ? | ||
| + | [[notes_arp]] | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | # Default limit for number of user's processes to prevent | ||
| + | # accidental fork bombs. | ||
| + | # See rhbz #432903 for reasoning. | ||
| + | * soft nproc 1024 | ||
| + | root | ||
| + | www-data | ||
| + | ~~~ | ||
| + | |||
| + | FIXME | ||
| + | ~~~bash | ||
| + | apt-get install debian-security-support | ||
| + | check-support-status | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | service nfs-common stop | ||
| + | service portmap stop | ||
| + | service rpcbind stop | ||
| + | apt-get -y autoremove --purge portmap rpcbind | ||
| + | ~~~ | ||
| + | |||
| + | FIXME umask pam | ||
| + | |||
| + | FIXME https:// | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install fail2ban rsyslog | ||
| + | ~~~ | ||
| + | |||
| + | pas de connexion avec utilisateur root (sauf par clef) | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | ----------------------------------------------------------------------------- | ||
| + | ATTENTION : Ne vous connectez pas a cette machine sans y etre autorise. | ||
| + | Toute tentative de piratage sera suivie d'une plainte aupres | ||
| + | des autorites. Le CERT sera egalement prevenu. | ||
| + | |||
| + | WARNING : Don't try to connect without permission. Every illegal access will | ||
| + | be referred to the appropriate authorities and the CERT. | ||
| + | ----------------------------------------------------------------------------- | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | PasswordAuthentication no | ||
| + | Port < | ||
| + | AllowUsers < | ||
| + | Banner / | ||
| + | PermitRootLogin without-password | ||
| + | ~~~ | ||
| + | |||
| + | **Ne pas oublier de configurer fail2ban** après le changement de port SSH et de redémarrer le service | ||
| + | |||
| + | # Crontab que pour root | ||
| + | ~~~bash | ||
| + | echo root > / | ||
| + | ~~~ | ||
| + | |||
| + | Standart | ||
| + | atop munin sysstat | ||
| + | |||
| + | Machine physique | ||
| + | lm-sensors smartmontools | ||
| + | |||
| + | amd64-microcode intel-microcode | ||
| + | |||
| + | [https:// | ||
| + | |||
| + | |||
| + | Config : | ||
| + | `/ | ||
| + | ~~~ini | ||
| + | start_smartd=yes | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | service smartmontools restart | ||
| + | sensors-detect --auto | ||
| + | ~~~ | ||
| + | |||
| + | ## VM | ||
| + | |||
| + | FIXME | ||
| + | Redirection de la console | ||
| + | |||
| + | |||
| + | ## Si plusieurs CPUs | ||
| + | |||
| + | FIXME | ||
| + | irqbalance | ||
| + | Et **numad** ? | ||
| + | |||
| + | ~~~bash | ||
| + | getconf _NPROCESSORS_ONLN | ||
| + | |||
| + | irqbalance | ||
| + | ~~~ | ||
| + | |||
| + | / | ||
| + | |||
| + | TODO comparer avec | ||
| + | ~~~bash | ||
| + | mpstat -P ALL 60 | ||
| + | ~~~ | ||
| + | |||
| + | ## Si Ordinateur de bureau | ||
| + | |||
| + | ### Pas décidé : | ||
| + | FIXME | ||
| + | Activation dépôt multimédia http:// | ||
| + | ~~~bash | ||
| + | apt-get install libdvdcss2 | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | GRUB_CMDLINE_LINUX=" | ||
| + | ~~~ | ||
| + | ou `vga=788` | ||
| + | |||
| + | Puis | ||
| + | |||
| + | Déprécié, | ||
| + | ~~~ | ||
| + | gfxpayload=1024x768x16, | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | update-grub | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Décidé | ||
| + | |||
| + | ~~~bash | ||
| + | #apt-get install rtmpdump # Remplacé par curl ? | ||
| + | apt-get install mplayer2 vlc cclive | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | # | ||
| + | ~~~ | ||
| + | |||
| + | Preload va examiner vos habitudes et pré-charger en mémoire les librairies les plus souvent sollicitées. | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install preload | ||
| + | ~~~ | ||
| + | |||
| + | Prelink. Permet de charger en mémoire les bibliothèques partagées | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install prelink | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | icedove bleachbit | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | set bell-style none | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install libnotify-bin | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install numlockx | ||
| + | numlockx on | ||
| + | ~~~ | ||
| + | |||
| + | FIXME a vérif | ||
| + | ~~~bash | ||
| + | grep -q numlockx / | ||
| + | ~~~ | ||
| + | |||
| + | Conky FIXME voir ~/.conkyrc | ||
| + | |||
| + | `~/ | ||
| + | ~~~ini | ||
| + | # | ||
| + | [Desktop Entry] | ||
| + | Version=1.0 | ||
| + | Type=Application | ||
| + | Terminal=false | ||
| + | Exec=conky | ||
| + | Name=Conky | ||
| + | ~~~ | ||
| + | |||
| + | Faire le ménage dans | ||
| + | / | ||
| + | |||
| + | Exemple | ||
| + | ~~~bash | ||
| + | rm / | ||
| + | rm / | ||
| + | rm / | ||
| + | rm / | ||
| + | ~~~ | ||
| + | |||
| + | # Aleger | ||
| + | |||
| + | Accélérer Xfce4. | ||
| + | Ne pas afficher les images dans les menus, texte seul. | ||
| + | Cacher le contenu des fenêtres lors des déplacements, | ||
| + | |||
| + | Remplacement de bash par dash | ||
| + | dpkg-reconfigure dash | ||
| + | |||
| + | Installer slim comme gestionnaire de session graphique. | ||
| + | ~~~bash | ||
| + | apt-get install slim | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | vm.swappiness=10 | ||
| + | vm.vfs_cache_pressure=50 | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | tmpfs / | ||
| + | ~~~ | ||
| + | Voir `/ | ||
| + | |||
| + | Nettoyer /tmp | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | [Unit] | ||
| + | Description=Daily Cleanup of Temporary Directories | ||
| + | Documentation=man: | ||
| + | |||
| + | [Timer] | ||
| + | OnBootSec=15min | ||
| + | OnUnitActiveSec=1d | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | [Unit] | ||
| + | Description=Cleanup of Temporary Directories | ||
| + | Documentation=man: | ||
| + | DefaultDependencies=no | ||
| + | Conflicts=shutdown.target | ||
| + | After=systemd-readahead-collect.service | ||
| + | systemd-readahead-replay.service local-fs.target time-sync.target | ||
| + | Before=shutdown.target | ||
| + | |||
| + | [Service] | ||
| + | Type=oneshot | ||
| + | ExecStart=/ | ||
| + | IOSchedulingClass=idle | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | # Clear tmp directories separately, to make them easier to override | ||
| + | d /tmp 1777 root root 10d | ||
| + | d /var/tmp 1777 root root 30d | ||
| + | |||
| + | # Exclude namespace mountpoints created with PrivateTmp=yes | ||
| + | x / | ||
| + | X / | ||
| + | x / | ||
| + | X / | ||
| + | ~~~ | ||
| + | |||
| + | Diminuez le nombre de bureaux virtuels | ||
| + | |||
| + | |||
| + | Un “MTA” (Mail Transfert Agent) est installé par défaut et lancé au démarrage, exim est utile comme serveur de courriels, mais également pour recevoir les courriels du système. | ||
| + | Si vous voulez simplement recevoir les courriels systèmes, mais sans avoir le démon exim lancé en permanence, changez l' | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | QUEUERUNNER=' | ||
| + | ~~~ | ||
| + | |||
| + | # Tous | ||
| + | Commande checkrestart (pour savoir les services / processus à redémarrer après mise à jour) | ||
| + | ~~~bash | ||
| + | apt-get install debian-goodies | ||
| + | ~~~ | ||
| + | |||
| + | FIXME Tous !? | ||
| + | ~~~bash | ||
| + | #echo " | ||
| + | echo " | ||
| + | ~~~ | ||
| + | |||
| + | Tous !? | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | GRUB_CMDLINE_LINUX=" | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | update-grub | ||
| + | ~~~ | ||
| + | |||
| + | apt-get install sed vim build-essential | ||
| + | python-minimal # Pour Ansible | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | vm.swappiness=5 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | sysctl -p / | ||
| + | ~~~ | ||
| + | |||
| + | `~/.bashrc` | ||
| + | ~~~bash | ||
| + | export LS_OPTIONS=' | ||
| + | eval " | ||
| + | alias ls='ls $LS_OPTIONS' | ||
| + | alias ll='ls $LS_OPTIONS -l' | ||
| + | alias l='ls $LS_OPTIONS -lA' | ||
| + | |||
| + | alias rm='rm -i' | ||
| + | alias cp='cp -i' | ||
| + | alias mv='mv -i' | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Juste après install | ||
| + | |||
| + | ~~~bash | ||
| + | sed -i -e ' | ||
| + | |||
| + | update-alternatives --set editor / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | # Par encore décidé | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | # | ||
| + | QUEUERUNNER=' | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | syntax on | ||
| + | |||
| + | " Uncomment the following to have Vim jump to the last position when | ||
| + | " reopening a file | ||
| + | if has(" | ||
| + | au BufReadPost * if line("' | ||
| + | endif | ||
| + | |||
| + | " Uncomment the following to have Vim load indentation rules and plugins | ||
| + | " according to the detected filetype. | ||
| + | if has(" | ||
| + | filetype plugin indent on | ||
| + | endif | ||
| + | |||
| + | set showcmd | ||
| + | set showmatch | ||
| + | set smartcase | ||
| + | set incsearch | ||
| + | set hidden | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | # Autre | ||
| + | |||
| + | FIXME | ||
| + | Activer le cache disque avec gnome-disk-utility ou hdparm !? | ||
| + | |||
| + | Pas de login si /home/$USER absent | ||
| + | |||
| + | |||
| + | ## Cloud AWS | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | ~~~ini | ||
| + | vm.swappiness = 0 | ||
| + | vm.dirty_ratio = 80 | ||
| + | vm.dirty_background_ratio = 5 | ||
| + | vm.dirty_expire_centisecs = 12000 | ||
| + | net.core.somaxconn = 1000 | ||
| + | net.core.netdev_max_backlog = 5000 | ||
| + | net.core.rmem_max = 16777216 | ||
| + | net.core.wmem_max = 16777216 | ||
| + | net.ipv4.tcp_wmem = 4096 12582912 16777216 | ||
| + | net.ipv4.tcp_rmem = 4096 12582912 16777216 | ||
| + | net.ipv4.tcp_max_syn_backlog = 8096 | ||
| + | net.ipv4.tcp_slow_start_after_idle = 0 | ||
| + | net.ipv4.tcp_tw_reuse = 1 | ||
| + | net.ipv4.ip_local_port_range = 10240 65535 | ||
| + | kernel.sysrq = 0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## net.core.somaxconn | ||
| + | |||
| + | ~~~ | ||
| + | net.core.somaxconn = 2000 | ||
| + | ~~~ | ||
| + | |||
| + | Conf nginx `backlog` | ||
| + | ~~~nginx | ||
| + | server { | ||
| + | listen 80 backlog=2000 reuseport; | ||
| + | server_name example.com; | ||
| + | root / | ||
| + | index index.html; | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
