Install Ubuntu 17.10
These are the steps for installing Cuda on a fresh Ubuntu 17.10 install. I’m running my machine without a dedicated monitor, so some of my configuration is optional.
Install Nvidia drivers
Firstly make the necessary preparations to install your chosen driver. Add the PPA repositiry for graphics drivers, then update/upgrade your system:
sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update sudo apt-get upgrade
Now install your chosen Nvidia driver – in my case the latest version is 3.90:
sudo apt-get install nvidia-390
You can test your install with:
Set up screen sharing
If you’re going to run your miner headless, you’ll need some means of accessing the desktop in order to manage your mining software. In the Settings Panel, go to Sharing and select Screen Sharing. Set this up so you have to type in a password (or numeric PIN) to connect – make sure you select the network the Miner will be running on once installed.
If you’re controlling your Miner from a Mac, set the following to allow VNC to connect:
gsettings set org.gnome.Vino require-encryption false
Disable power saving options
Open the Settings Panel – in Power you can set Blank screen to Never & disable Wi-Fi – Turn off Wi-FI to save power.
Allow auto login
To get auto login working, it is sometimes necessary to reconfigure the GDM custom.conf to suit your needs – type:
sudo vi /etc/gdm3/custom.conf
Then edit the lines as so – they may not be next to each other:
AutomaticLoginEnable=true AutomaticLogin=miner WaylandEnabled=false
Where AutomaticLogin is the account name you want to log in at boot up. Also note that the capitalisation of boolean values is all lowercase.
Install Nvidia Cuda Compiler
Go to the Cuda download page and select your required install method:
Linux > x86_64 > Ubuntu > 17.04 > deb (network)
Download the file and follow the instructions on the Nvidia Cuda page – e.g:
sudo dpkg -i cuda-repo-ubuntu1704_9.1.85-1_amd64.deb sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64/7fa2af80.pub sudo apt-get update sudo apt-get install cuda
The Cuda installation can take some time, so maybe go make a nice hot drink.
Once complete, export the PATH for the Cuda Compiler:
Install GCC & G++
For our purposes we require a earlier version of GCC and G++ than is shipped with Ubuntu 17.10. To fix this we will install GCC and G++ 6.
Run the following to install and set up our ye olde compilation tools:
sudo apt-get install gcc-6 g++-6 sudo ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc sudo ln -s /usr/bin/g++-6 /usr/local/cuda/bin/g++
Install and run Cuda sample scripts
Make a directory in your home directory – I have called mine ‘Cuda’.
From there run the sample scripts to test the install:
Go to the directory the shell script creates. Type:
Once again, this step can take some time, so you might wanna go do something else for 10 minutes.
Install the Cuda toolkit
The toolkit installs some useful tools, we don’t necessarily need these, but one of the tools is useful for verifying our Cuda install:
sudo apt install nvidia-cuda-toolkit
To test your install, simply run:
That’s all you need to do to set up Cuda for Ubuntu 17.10. We’re setting this up for the purpose of running Crypto Miners but I hope this guide will benefit anyone trying to get Cuda 9.1 running on their Ubuntu machine.
Let me know how you get on below 😀