Skip to content

Instantly share code, notes, and snippets.

@bench
Last active June 9, 2026 12:23
Show Gist options
  • Select an option

  • Save bench/3e8227a8961ccf5609c150452b3d8996 to your computer and use it in GitHub Desktop.

Select an option

Save bench/3e8227a8961ccf5609c150452b3d8996 to your computer and use it in GitHub Desktop.
arch install with encrypted disk, ext4 partition, no LVM, one swap file, i3 desktop.
#!/bin/bash
# ==============================================================================
# SCRIPT D'INSTALLATION ARCH LINUX (MIS À JOUR 2026)
# Chiffrement LUKS + UEFI + systemd-boot + i3wm
# ==============================================================================
# 1. PRÉPARATION ET RÉSEAU
# ------------------------------------------------------------------------------
# Chargement du clavier français pour l'environnement d'installation
loadkeys fr
# Connexion internet sans fil (si non connecté en filaire)
# Décommentez et adaptez les lignes suivantes dans l'invite iwctl :
# iwctl
# > station wlan0 scan
# > station wlan0 connect "Votre_SSID"
# 2. PARTITIONNEMENT ET CHIFFREMENT
# ------------------------------------------------------------------------------
# Vérification du nom du disque cible (ex: /dev/nvme0n1)
fdisk -l
# Lancement de l'outil graphique de partitionnement
parted /dev/nvme0n1
# Créer l'arborescence suivante :
# - Partition 1 : ~512 Mo à 1 Go, type "EFI System" -> /dev/nvme0n1p1
# - Partition 2 : Tout le reste, type "Linux filesystem" -> /dev/nvme0n1p2
# mklabel gpt
# mkpart ESP fat32 1MiB 513MiB
# set 1 esp on
# mkpart primary 513MiB 100%
# quit
# Chiffrement de la partition principale (Saisissez un mot de passe fort)
cryptsetup luksFormat /dev/nvme0n1p2
# Ouverture de la partition chiffrée
cryptsetup open /dev/nvme0n1p2 cryptroot
# Formatage des partitions
mkfs.ext4 /dev/mapper/cryptroot
mkfs.vfat -F 32 /dev/nvme0n1p1
# 3. MONTAGE ET PACSTRAP
# ------------------------------------------------------------------------------
# Montage de la racine
mount /dev/mapper/cryptroot /mnt
# Création du point de montage EFI et montage de la partition boot
mkdir --parents /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
# Base du système + Environnement graphique & audio moderne (PipeWire, exfatprogs)
# ATTENTION : Remplacez 'intel-ucode' par 'amd-ucode' si vous avez un CPU AMD !
pacstrap /mnt base base-devel linux linux-headers linux-firmware intel-ucode pacman-contrib zip unzip p7zip vim alsa-utils mtools dosfstools exfatprogs zsh zsh-completions noto-fonts noto-fonts-emoji i3 networkmanager xorg-server xorg-xinit xf86-input-libinput gnome-terminal pipewire pipewire-pulse pavucontrol openssh git
# Génération du fichier fstab
genfstab -U /mnt >> /mnt/etc/fstab
# 4. CONFIGURATION DU SYSTÈME (CHROOT)
# ------------------------------------------------------------------------------
# Basculement dans le nouveau système
arch-chroot /mnt
# Fuseau horaire et horloge
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
hwclock --systohc
# Localisation
echo "LANG=fr_FR.UTF-8" > /etc/locale.conf
echo "KEYMAP=fr" > /etc/vconsole.conf
locale-gen
# Configuration réseau (Hostname)
echo "mon-arch-pc" > /etc/hostname
# Définition du mot de passe root
echo "Définition du mot de passe ROOT :"
passwd
# Création de l'utilisateur standard (ZSH par défaut, pas de groupes audio/video obsolètes)
echo "Création de l'utilisateur standard :"
useradd -m -s /usr/bin/zsh mon_utilisateur
passwd mon_utilisateur
# Ajout de l'utilisateur au groupe wheel pour les droits sudo
usermod -aG wheel mon_utilisateur
# Configuration de Sudo
# INSTRUCTION : Une fois dans visudo, repérez et décommentez (enlevez le #) la ligne :
# %wheel ALL=(ALL:ALL) ALL
echo "Appuyez sur Entrée pour configurer sudo (décommentez la ligne %wheel)..."
read
visudo
# 5. CONFIGURATION DU BOOT ET INITIAL RAMDISK
# ------------------------------------------------------------------------------
# Installation du chargeur d'amorçage systemd-boot
bootctl install
# Configuration de mkinitcpio.conf :
# INSTRUCTION : Modifiez la ligne HOOKS dans /etc/mkinitcpio.conf pour y intégrer
# 'microcode' (nouveauté), et placer 'keyboard' et 'keymap' AVANT 'encrypt' :
# HOOKS=(base udev autodetect microcode modconf block keyboard keymap encrypt filesystems fsck)
echo "Ouvrez /etc/mkinitcpio.conf et modifiez la ligne HOOKS comme suit :"
echo "HOOKS=(base udev autodetect microcode modconf block keyboard keymap encrypt filesystems fsck)"
echo "Appuyez sur Entrée une fois la modification faite..."
read
vim /etc/mkinitcpio.conf
# Régénération globale de l'initramfs
mkinitcpio -P
# 6. CONFIGURATION DE SYSTEMD-BOOT (ENTRÉE ARCH)
# ------------------------------------------------------------------------------
# Récupération automatique de l'UUID brut de la partition chiffrée
UUID_PART=$(blkid -s UUID -o value /dev/nvme0n1p2)
# Écriture du fichier de configuration d'amorçage
# Note : La ligne 'initrd /intel-ucode.img' n'est plus requise grâce au hook 'microcode'
cat <<EOF > /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=${UUID_PART}:cryptroot root=/dev/mapper/cryptroot rw quiet
EOF
# 7. SORTIE ET REDÉMARRAGE
# ------------------------------------------------------------------------------
echo "Installation terminée ! Sortie du chroot et redémarrage..."
exit
umount -R /mnt
reboot
# ==============================================================================
# APRÈS LE REDÉMARRAGE (Dans votre session utilisateur) :
# ==============================================================================
# 1. Connexion au Wi-Fi via NetworkManager :
# sudo systemctl enable --now NetworkManager
# nmcli device wifi connect "Mon_SSID" password "Mon_Mot_De_Passe"
#
# 2. Configuration de l'environnement graphique i3 :
# cp /etc/X11/xinit/xinitrc ~/.xinitrc
# (Modifiez ~/.xinitrc pour remplacer les dernières lignes par : exec i3)
#
# 3. Lancement de l'interface :
# startx
# ==============================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment