Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UbuntuMiner. Command list to build an Ubuntu 14.04 Server with Cuda Toolkit 6.5, driver 352.41, and ccminer.
#!/bin/bash
### Command log to install Cuda Toolkit 6.5, driver 343.22, and ccminer.
## Update the system
sudo apt-get update && sudo apt-get -y dist-upgrade
# All the dependencies for Cuda & ccminer (I think)
sudo apt-get -y install gcc g++ build-essential automake linux-headers-$(uname -r) git gawk libcurl4-openssl-dev libjansson-dev xorg libc++-dev libgmp-dev python-dev
## Install the nvidia display driver
cd && wget http://us.download.nvidia.com/XFree86/Linux-x86_64/352.41/NVIDIA-Linux-x86_64-352.41.run
sudo chmod +x NVIDIA-Linux-x86_64-352.41.run
sudo ./NVIDIA-Linux-x86_64-352.41.run --accept-license --no-questions --disable-nouveau --no-install-compat32-libs
rm NVIDIA-Linux-x86_64-352.41.run
sudo echo 'GRUB_CMDLINE_LINUX="nomodeset"' >> /etc/default/grub
sudo update-grub
sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration # flags enable OC and fan controls. via: https://bitcointalk.org/index.php?topic=826901.msg12279696#msg12279696
## Time to install cuda!
cd && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
rm cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-6-5 # You're gonna have to accept the terms here. Not an unattended install!
# OPTIONAL: Install the 'cuda' package. It includes some more things.
sudo usermod -a -G video $USER
echo "" >> ~/.bashrc
echo "export PATH=/usr/local/cuda-6.5/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH" >> ~/.bashrc
## You should probably restart the system here
sudo shutdown -r now
## Lets make the deviceQuery sample. This is used to verify cuda works
cd /usr/local/cuda/samples/1_Utilities/deviceQuery && sudo make
# If you see all of your cards listed, and the last line says "Result = PASS" you're good to go!
/usr/local/cuda/samples/1_Utilities/deviceQuery/deviceQuery
## djm34's fork requires this, and there aren't any packages available in the repos.
cd && wget http://www.mpir.org/mpir-2.6.0.tar.bz2
tar jxf mpir-2.6.0.tar.bz2
rm mpir-2.6.0.tar.bz2
cd mpir-2.6.0/
./configure
make && make check
sudo make install
cd && rm -r mpir-2.6.0/
echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
## ccminer, djm34 fork. commit: 3cd198a461618eb3807fe608475f2034ef76bd53 as of this writing.
cd && git clone https://github.com/djm34/ccminer.git
cd ccminer/
./autogen.sh
./configure
make
### Thought this was useful? btc:14ciL7BuCyLy1LJcqhzQnpEQUGjinGU5TD
@ngdias

This comment has been minimized.

Copy link

ngdias commented Jul 11, 2015

I was wondering if CUDA 7 would also work and why use this fork and not cbuchner1's.

@drduh

This comment has been minimized.

Copy link

drduh commented Oct 13, 2015

Could you add a crypto hash for NVIDIA-Linux-x86_64-352.41.run? I got a SHA-256 of 0eb60d0543a0e7c5c3cfec13702005ffec6e2b8c7f22c631f324736ba2a1a832

@kristerfl

This comment has been minimized.

Copy link

kristerfl commented Mar 8, 2016

For Ubuntu 15 I have found the following:

Notes on installing and compiling ccminer on Ubuntu 15..

Wrong versions of GCC and G++:

  1. GCC have to be installed from pacakge manager or similar to 4.7 and then:

1b. in terminal/console write: sudo ln -s /usr/bin/gcc-47 /usr/local/cuda/gcc

  1. G++ have to be the same version as GCC so go to pacakge manger and find version 4.7 and remove version 5 this makes it so that you do not have to "ln" as above , but beware which 5 you remove, one of them remove cuda in addition THAT IS not the right one.
@kristerfl

This comment has been minimized.

Copy link

kristerfl commented Mar 8, 2016

Sorry if these comments are spamming but after fixing the above I got to compile but I got a new error that sent me to this page:

http://www.cs.virginia.edu/~mwb7w/cuda_support/libcudart.html

@kristerfl

This comment has been minimized.

Copy link

kristerfl commented Mar 8, 2016

The above helped but I had to set the path to /lib64 not /lib in the first command (1): (from the page)

(export LD_LIBRARY_PATH=$LD_LIBARY_PATH:/usr/local/cuda/lib64)

...........

Problem: When executing a CUDA program under Linux, you get the following error:

error while loading shared libraries: libcudart.so.2: cannot open shared object file: No such file or directory

Solution: You need to add the path to the CUDA libraries to your $LD_LIBRARY_PATH environment variable.

Explanation:
When a CUDA program is executed, it needs to dynamically link to the CUDA runtime libraries. By default, these libraries are located in the /usr/local/cuda/lib directory. When searching for these libraries, the operating system looks in directories specified in the $LD_LIBRARY_PATH environment variable. If the CUDA library directory is not specified here, the program will fail with the error shown above.

There are two solutions (these assume you are using the bash shell, which is the default CS Department shell):

Run the following command:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib

This change is not persistent and will need to be re-run each time you log in.

Edit your .profile file (located at ~/.profile). Find the line that sets the $LD_LIBRARY_PATH variable, which should look similar to the following:

LD_LIBRARY_PATH="/usr/lib:/usr/openwin/lib:/usr/dt/lib:/X11.6/lib:/X11.5/lib:/uva/lib:/gnu/lib"

Modify that line to add the path to the CUDA libraries:

LD_LIBRARY_PATH="/usr/lib:/usr/openwin/lib:/usr/dt/lib:/X11.6/lib:/X11.5/lib:/uva/lib:/gnu/lib:/usr/local/cuda/lib"

After editing the file, you either need to log out and log back in or run the following command:

source ~/.profile

This solution is persistent and only needs to be performed once. 
@bpluly

This comment has been minimized.

Copy link

bpluly commented Jul 5, 2017

For Elementary Loki, Ubuntu 16.04 you need to install gcc-multilib otherwise it won't understand 64bit building 32bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.