Cryptocurrency Mining.txt - Notepad

How to create a Ubuntu 18.04 NVIDIA Cryptocurrency Miner (RavenCoin Focused)

Install Ubuntu 18.04. I went with desktop.

apt-get install xorg-dev

Go to and download the deb (network) file for the CUDA installation:

sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb

sudo apt-key adv --fetch-keys

sudo apt-get update

sudo apt-get install cuda

Now to install the NVIDIA driver:

apt-add-repository ppa:graphics-drivers/ppa

apt-get install nvidia-driver-415 (or whatever is listed as the latest)

You may now need to reboot your PC.

You can confirm CUDA and NVIDIA driver version using nvidia-smi

You need to configure cool-bits on nvidia config to control the GPU fan speed:

nvidia-xconfig -a --cool-bits=4 --allow-empty-initial-configuration

You can check this config in /etc/X11/xorg.conf. If the command doesn't work, reboot and try again.

NOTE updating the nvidia driver requires you to remove the current driver first ie sudo apt-get purge nvidia*

The z-enemy miner can be downloaded from bitcoin talk. Get the version that is appropriate for your CUDA version. It is a single file.

Install pre-req:

apt-get install libcurl3

Sample invocation:

./z-enemy -a x16r -o stratum+tcp:// -u -p 'password' -i 21 &

Now that the miner has been verified as functional, apply some tweaks such as enabling ssh and booting to CLI instead of GUI:

systemctl set-default

apt-get install openssh-server

Next you will need to undervolt your GPUs and set your GPU fan speed to maintain a reasonable temperature ie 60.

Create /root/.xinitrc file with the below settings:

nvidia-settings -q fans

nvidia-settings -a [gpu:0]/GPUFanControlState=1 -a [fan:0]/GPUTargetFanSpeed=80

nvidia-settings -a [gpu:1]/GPUFanControlState=1 -a [fan:1]/GPUTargetFanSpeed=80

nvidia-settings -a [gpu:2]/GPUFanControlState=1 -a [fan:2]/GPUTargetFanSpeed=80

nvidia-settings -a [gpu:3]/GPUFanControlState=1 -a [fan:3]/GPUTargetFanSpeed=80

nvidia-smi -i 0 -pl 85

nvidia-smi -i 1 -pl 85

nvidia-smi -i 2 -pl 120

nvidia-smi -i 3 -pl 85


Start a xwindows shell in the background of your SSH session to read /root/.xinitrc and apply the above settings:

startx -- :0 &

There are ways to apply core and memory overclocking on Nvidia GPUs using Ubuntu, but I am mining ravencoin and prefer using stock settings for this.

The below is an interesting command which will suggest what nvidia drivers are most suitable for your GPU:

ubuntu-drivers devices

Autoinstall the recommended drivers:

ubuntu-drivers autoinstall

NOTE, my preferred method is the below to get multiple GPUs working. It involves temporarily plugging the GPUs into monitors though at boot. After which they can be unplugged.

Run the below to create your nvidia config file with cool bits 28 which enables all of the fancy overclocking and fan and temperature controls.

sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration

This creates a file at /etc/X11/xorg.conf

You can then copy this file to your xorg.conf.d directory.

sudo cp -f /etc/X11/xorg.conf /usr/share/X11/xorg.conf.d/20-nvidia.conf

Note, you can have multiple nvidia.conf files in this directory. but the one with the largest number will be read.