Installing NVIDIA and AMD GPU Headless Drivers For Crypto Mining on Linux server

Edited: 2021–02–16

This is my write-up how I am installing drivers for NVIDIA 1070Ti and RX 480/580 on Ubuntu 18.04.4 and 20.04 LTS Server. This server I am using for the crypto currency mining, therefor I need performance as much as possible with headless drivers and with ROCm support it’s possible.

Check the status of display adapters

sudo lshw -c display

Let’s assume you have already installed and prepared Ubuntu 18.04.4, if not here is how I did [1]. AMD Radeon drivers, version 18.30 [2]

# Upgrade Ubuntu 18.04 OS packages before installing sudo apt update && sudo apt upgrade -y# Download Driverswget https://www2.ati.com/drivers/linux/ubuntu/18.04/amdgpu-pro-18.30-641594.tar.xz --referer https://support.amd.com/en-us/kb-articles/Pages/Radeon-Software-for-Linux-Release-Notes.aspx# Unarchive tar -Jxvf amdgpu-pro-18.30-641594.tar.xz
cd amdgpu-pro-18.30-641594/
# Install Drivers./amdgpu-pro-install -y --opencl=legacy,rocm --headless

Once installation has completed add yourself to the video group and reboot

sudo usermod -a -G video $LOGNAME && sudo reboot

AMD Radeon drivers, version 20.45 on Ubuntu 20.04.

# Upgrade Ubuntu 20.04 OS packages before installing
sudo apt update && sudo apt upgrade -y
# Download drivers
wget https://drivers.amd.com/drivers/linux/amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz --referer https://www.amd.com
# Unarchive
tar -Jxvf amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz
# Install drivers
cd amdgpu-pro-20.45-1188099-ubuntu-20.04/
./amdgpu-pro-install -y --opencl=legacy,rocr --headless

Once installation has completed add yourself to the video group and reboot

sudo usermod -a -G render $LOGNAME && sudo reboot

NVIDIA

# Optionally, Remove old software [3]
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt remove nvidia-*
# add PGP keys
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
# Add Nvidia repo
sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
# First install nvidia drivers then cuda
sudo apt update && sudo apt install nvidia-headless-440 -y
sudo apt install cuda-10-2 -y

Edit ~/.profile file

# set PATH for cuda 10.2 installation
if [ -d "/usr/local/cuda-10.2/bin/" ]; then
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi

System reboot is required.

I found a great tool to reduce electricity consumption by changing core speed settings. It called Radeon Open Compute System Management Interface, ROC-smi in short.This software enables the high-performance operation of AMD GPUs for computationally oriented tasks in the Linux operating system.[4]. By the way for this application an old python 2.7 is needed. Please aware of it.

sudo apt install -y pythongit clone https://github.com/RadeonOpenCompute/ROC-smi.git
cd ROC-smi/
./rocm-smi --setsclk 3 # Reducing core clock speed
Image for post
Image for post
source [5]

Troubleshooting:

  • Turn out the latest kernel version 5.4.0–56-generic on Ubuntu 20.04 has issues with GPU drivers. You can follow this artical to downgrade the Linux kernel [6]
#1 https://medium.com/@tomas_savenas/all-great-things-start-from-installing-ubuntu-9500873fec82 
#2 https://amdgpu-install.readthedocs.io/en/latest/
#3 https://www.nvidia.com/download/driverResults.aspx/126185/en-us
#4 https://github.com/RadeonOpenCompute/ROCm
#5 https://avesta.io/en/cryptocurrency-mining-pros-cons-and-benefits/
#6 https://tomas-savenas.medium.com/fixing-issue-amdgpu-kernel-module-failed-to-build-40caa5017a50

Kibernetinio saugumo entuziastas; Aktyviausias Lietuvis TryHackMe platformoje; Inovacijų valdymo ir Antreprenerystės Magistrantas @ KTU

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store