-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgpu-firmware-install.sh
50 lines (41 loc) · 1.51 KB
/
gpu-firmware-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Install Dependencies
echo "[Step 1] Installing Dependencies..."
sudo apt update && sudo apt install -y curl git net-tools docker.io neofetch
# Install NVIDIA Driver
echo "[Step 2] Installing NVIDIA Drivers..."
sudo apt update && sudo apt upgrade -y
sudo apt install ubuntu-drivers-common -y
NVIDIA_DRIVER=$(sudo ubuntu-drivers devices | grep recommended | awk '{print $2}')
echo "Recommended NVIDIA driver version: $NVIDIA_DRIVER"
sudo apt install "$NVIDIA_DRIVER" -y
# Reboot after installing NVIDIA driver
echo "Rebooting system..."
sudo reboot now
# Install CUDA
echo "[Step 3] Installing CUDA..."
nvidia-smi
sudo apt install gcc -y
gcc -v
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda
# Reboot after installing CUDA
echo "Rebooting system..."
sudo reboot now
# Configure .bashrc for CUDA
echo "[Step 4] Configuring .bashrc for CUDA..."
echo "neofetch" >> ~./bashrc
echo "export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" >> ~/.bashrc
source ~/.bashrc
# Verify CUDA Installation
echo "Verifying CUDA Installation..."
nvcc -V
# Install Docker NVIDIA Runtime
echo "[Step 5] Installing Docker NVIDIA Runtime..."
sudo apt install -y nvidia-docker2
sudo systemctl daemon-reload
sudo systemctl restart docker
echo "[Complete] Installation completed successfully."