How to install Ubuntu 16.0.4 and Cuda with multi GPU cards.

This tutorial is only for mining [XDNA coin](https://xdna.io/) .
 
***How to install Ubuntu 16.0.4 and Cuda 9 driver***

1.Install Ubuntu 16.0.4
  (1)Download Ubuntu16.0.4 LTS 64bit from this site.
     http://mirror.math.princeton.edu/pub/ubuntu-iso/16.04/
     choose 
ubuntu-16.04.4-desktop-amd64.iso

  (2)Burn img file to DVD or other bootable media.
  (3)Boot  from DVD.
  (4)See this Youtube video.(How to install Ubuntu)
     https://www.youtube.com/watch?v=j5iFE6zBHPE

 2.Update latest Ubuntu16.0.4 after you installed.
  (1)Execute terminal.(you can find the terminal from icon at upper left on desktop)
  (2)Input these commands to the terminal window.
      i)sudo apt-get update
     ii)sudo apt-get upgrade
      If these commands cause error, you can update latest kernel by Application updater([A]icon on desktop).
      And retry i) and ii) commands.
   (3)reboot your computer.
 
3.Install Cuda 9.2
   (1)Download Cuda from this site
      https://developer.nvidia.com/cuda-toolkit
      Select [Download now]->[Linux]->[x86_64]->[Ubuntu]->[16.0.4]->[runfile]
      and then download “Base Installer”.

   (2)Create new file at /etc/modprobe.d/blacklist-nouveau.conf
      and write these to the file.

      blacklist nouveau
      options nouveau modeset=0
   (3)Save the file
   (4)Execute terminal and input commands
      i)sudo update-initramfs -u
     ii)sudo reboot
    (5)Copy Cuda Base installer to your folder.
       if you want to copy from Windows network,
       You should better set up (6.Make share directory..) at this time.

   (6)Execute terminal  and input commands
     i)sudo service lightdm stop
   (7)Press ctrl+Alt+F1
    (8)sudo chmod +x ./cuda_9.2.88_396.26_linux.run
   (9)./cuda_9.2.88_396.26_linux.run
      i)choose install driver and toolkit.
   (10)Edit ~/.bashrc and add these.

      export PATH="/usr/local/cuda-9.2/bin:$PATH"
      export LD_LIBRARY_PATH="/usr/local/cuda-9.2/lib64:$LD_LIBRARY_PATH"

   (11)sudo reboot

4.Check Installation.
   (1)Execute terminal and input command
     nvidia-smi
     if you success installation,you can see these.

     +-----------------------------------------------------------------------------+
     | NVIDIA-SMI 387.26                 Driver Version: 387.26                    
     |
     |-------------------------------+----------------------+----------------------+
     | 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:09:00.0 Off |                  N/A |
     | 52%   70C    P2   132W / 120W |   1173MiB /  6072MiB |     98%      Default |
     +-------------------------------+----------------------+----------------------+
     |   1  GeForce GTX 1080    Off  | 00000000:0A:00.0  On |                  N/A |
     | 57%   73C    P2   176W / 180W |   1391MiB /  8112MiB |    100%      Default |
     +-------------------------------+----------------------+----------------------+
    
5.Stop Auto Update
Cuda 9.x driver doesn't work well if the new kernel was installed.
So it need to stop Auto Update.
(1)Edit /etc/apt/apt.conf.d/20auto-upgrades
  i)change "1" to "0".
 
     APT::Periodic::Update-Package-Lists "0";
     APT::Periodic::Unattended-Upgrade "0";

6.Make share directory for copy any file to Ubuntu PC easily.
(1)sudo apt-get install samba
(2)sudo mkdir /home/share <-you can change any directory you want.
(3)sudo chmod 777 /home/share
(4)Edit /etc/samba/smb.conf

     #near line 30
     #set your windows work group name
     workgroup = WORKGROUP
     
     #near line 58
     bind interfaces only = yes
     map to guest = Bad User

     #Add to last line
    [share]
      path = /home/share
      writable = yes
      guest ok = yes
      guest only = yes
      create mode = 0777
      directory mode = 0777

(5)Save the file
(6)sudo systemctl restart smbd

(7)Then you can access share folder from windows.
   ex.¥¥192.168.1.12¥share

7.When your z-enemy shows Permission Error.
(1)cd /home/share/z-enemy(place at z-enemy applicaton)
(2)sudo chmod +x ./z-enemy
(3)./z-enemy -a x16r -o stratum+tcp://......(may be it works)

8.If you have network trouble with Realtek Ethernet Interface.
Please try this command.
(1)sudo apt-get install r8168-dkms

***Over clocking and other setting***
nvidia-setting doesn't work with normal install.
Please try these incantation.
*this command can't use through ssh.
 Use this by terminal window on Diaplay0

     $ sudo update-grub
     $ sudo nvidia-xconfig -a --allow-empty-initial-configuration --cool-bits=31 --use-display-device="DFP-0" --connected-monitor="DFP-0"

May be you can use these command.
ex.

     $ nvidia-settings -a "[gpu:0]/GPUPowerMizerMode=1"
     $ nvidia-settings -a "[gpu:0]/GPUFanControlState=1"
     $ nvidia-settings -a "[fan:0]/GPUTargetFanSpeed=80"
     $ nvidia-settings -a "[gpu:0]/GPUGraphicsClockOffset[3]=100"
     $ nvidia-settings -a "[gpu:0]/GPUMemoryTransferRateOffset[3]=100"
This example means:
 Set Fan speed to 80% on GPU0
 Increase core speed +100MHz on GPU0
 Increase memory clock +100Mhz on GPU0

You can setup other details easily only type "nividia-settings" on terminal at your Display(not ssh).
The command shows Nvidia GUI Window.

***Setting for Power limit***

ex.this command sets 100w limit to gpu card 0 and gpu card 1.

     $ nvidia-smi -i 0,1 -pl 100
if it didn't accepted,use "sudo" before command.

if you have trouble "Gtk-WARNING **: Locale not supported by C library."
You probably need to install the language pack, check this link out:

https://askubuntu.com/questions/359753/gtk-warning-locale-not-supported-by-c-library-when-starting-apps-from-th

Sorry my poor English:)
I'm mining XDNA now. It's a great coin.
We will meet here on Discord  Channel.
https://discord.gg/UbktfKr
Have a nice mining!!
ayamaka
my donate address
RavenCoin:RCubEdQ1ZeDQXYaKvHDipt5RE3Ct6Fjuz7
Eth:0x6be251128bd29842d0ff82faf4248cfa34b0b9aa
BitCoin: 31svovVFtXt35ynueDXBLeTHKcbQH7xaJ4