Created
April 3, 2025 07:28
-
-
Save brahimmachkouri/ef26e7c80ada79f9218d58ab5b09f571 to your computer and use it in GitHub Desktop.
Install GUI sur Ubuntu server 22.04 + Nvidia drivers + CUDA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Install de l'interface xubuntu sur Ubuntu Server 22.04 | |
# Install des drivers Nvidia + CUDA | |
# Install de tools | |
set -e | |
# === VARIABLES DE VERSION === | |
NVIDIA_DRIVER_VERSION="550" | |
CUDA_VERSION="12-4" | |
CUDA_REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64" | |
echo "==== [1/7] Mise à jour du système ====" | |
sudo apt update -y | |
sudo apt upgrade -y | |
echo "==== [2/7] Installation d’un environnement graphique minimal (Xubuntu Core) ====" | |
sudo apt install -y xubuntu-core | |
echo "==== [3/7] Installation des firmwares AMD et utilitaires graphiques ====" | |
sudo apt install -y firmware-linux firmware-linux-nonfree libdrm-amdgpu1 mesa-utils | |
echo "==== [4/7] Nettoyage des anciens pilotes NVIDIA ====" | |
sudo apt-get purge -y nvidia* | |
sudo apt-get autoremove -y | |
echo "==== [5/7] Installation du pilote NVIDIA $NVIDIA_DRIVER_VERSION depuis le PPA ====" | |
sudo add-apt-repository ppa:graphics-drivers/ppa -y | |
sudo apt update -y | |
sudo apt install -y "nvidia-driver-${NVIDIA_DRIVER_VERSION}" | |
echo "==== [6/7] Installation du CUDA Toolkit $CUDA_VERSION ====" | |
# Télécharger et appliquer le fichier de préférences CUDA | |
wget "${CUDA_REPO_URL}/cuda-ubuntu2204.pin" | |
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
# Ajouter la clé GPG NVIDIA | |
sudo apt-key adv --fetch-keys "${CUDA_REPO_URL}/3bf863cc.pub" | |
# Ajouter le dépôt CUDA | |
sudo add-apt-repository "deb ${CUDA_REPO_URL}/ /" | |
sudo apt update -y | |
# Installer CUDA Toolkit | |
sudo apt install -y "cuda-toolkit-${CUDA_VERSION}" | |
# Corriger d’éventuelles dépendances cassées | |
sudo apt --fix-broken install -y | |
echo "==== [7/7] Nettoyage final et installation d’utilitaires ====" | |
sudo apt autoclean -y | |
sudo apt autoremove -y | |
# Outils de monitoring et info matériel | |
sudo apt install -y nvme-cli smartmontools lm-sensors sensors-applet | |
echo "✅ Installation complète avec NVIDIA Driver ${NVIDIA_DRIVER_VERSION} et CUDA ${CUDA_VERSION} !" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment