Ubuntu Mining
By Jeroz - Jan 19th, 2018
General Introduction
This guide will help you set up Ubuntu on your PC and help you start mining with NVIDIA GPUs. You will have to install Ubuntu first.
- You can download the ISO of 64 bit Ubuntu 18.04 here
- The easiest way is to install from a USB stick.
- Ubuntu provides very user friendly tutorials to guide you through the installation.
This guide will further guide you through the steps to set up your system NVIDIA CUDA drivers. This guide is heavily inspired on the more comprehensive guide by NVIDIA that also describes installation steps for other Linux distributions.
Pre-installation
Verify that you have a CUDA-Capable GPU
lspci | grep -i nvidia
If your graphics card is from NVIDIA and it is listed in http://developer.nvidia.com/cuda-gpus, your GPU is CUDA-capable.
Verify you have 64 bit Ubuntu 18.04
uname -m && cat /etc/*release
The x86_64 line indicates you are running on a 64-bit system. The remainder gives information about your distribution.
Verify gcc is installed
gcc --version
If an error message displays, you need to install the development tools from your Linux distribution or obtain a version of gcc and its accompanying toolchain from the Web.
Verify the System Kernel Headers
sudo apt-get install linux-headers-$(uname -r)
Install required third-party libraries
sudo apt-get install build-essential dkms freeglut3 freeglut3-dev libxi-dev libxmu-dev
Download and install the NVIDIA CUDA Toolkit
Download CUDA drivers
cd ~/Downloads wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
Install CUDA drivers
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub sudo apt-get update sudo apt-get install cuda
Post-installation Actions
Add location of CUDA drivers to the PATH
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
Set configuration
sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration
Reboot
Installation verification
Verify the Driver Version
cat /proc/driver/nvidia/version
Should return the version
Verify the version of the CUDA Toolkit
nvcc -V
Should return the version
Verify GPUs are found
nvidia-smi
This will return something that looks like this (make sure all GPUs are found):
+-----------------------------------------------------------------------------+ | NVIDIA-SMI 410.79 Driver Version: 410.79 CUDA Version: 10.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 106... Off | 00000000:01:00.0 On | N/A | | 28% 29C P8 8W / 120W | 674MiB / 6075MiB | 0% Default | +-------------------------------+----------------------+----------------------+
[OPTIONAL] Change power and or overclock settings
To overclock the cards you can adjust the settings in the NVIDIA applications that is listed in the applications list. This list is available in the lower left corner of the desktop. Most miners want to set their power to ~70% to save energy costs. This can be done by:
- Enable persistent mode so that settings persist after a reboot:
sudo nvidia-smi -pm 1
- Look up current power setting to figure out what ~70% needs to be:
nvidia-smi -i 0 -q -d POWER
- Change power setting (in my example I lower power from 120W to 100W):
sudo nvidia-smi -pl 100
Setting up the miner
For this example, let's look at the currently popular miner T-Rex.
- Download the last version from their Github here.
- Browse to the Downloads folder using the Files explorer
- Extract the miner from the tar.gz-file (right click and choose Extract Here)
- Move the extracted folder to your home directory by dragging or copy-pasting it there
- Rename the folder to trex-miner for simplicity (right click and choose Rename...)
- In the folder trex-miner, rename config_example to config (at the time of this writing their example was named config_example)
- Open the config file in Text Editor (simply double-click) and change the settings to your liking.
Now start the miner by opening a Terminal and type:
~/trex-miner/t-rex -c config
OPTIONAL: Adjust intensity setting to your liking by adding -i X, where X is your desired intensity setting, for example 20.
~/trex-miner/t-rex -c config -i 20