SHARE
TWEET

Bitcoin Mining with Ubuntu 12.04 LTS and CGMiner

a guest Oct 9th, 2014 659 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <a href="http://debianhelp.files.wordpress.com/2012/01/image012.jpg"><img class="aligncenter size-large wp-image-9523" src="http://debianhelp.files.wordpress.com/2012/01/image012.jpg?w=625" alt="image012" width="625" height="400" /></a><strong>CGMiner</strong> is a GPU miner written in C, cross platform for Windows, Linux and OS X, based on the original code Cpu Miner, with limited FPGA support merged from BFGMiner. This document should be complete enough to get you started mining Bitcoins using a graphics card.
  2.  
  3. <!--more-->
  4.  
  5. <strong>Hardware</strong>
  6.  
  7. Staging was done on the following hardware:
  8. <ul>
  9.         <li>CPU: <a title="CPU" href="http://www.newegg.com/Product/Product.aspx?Item=N82E16819113282" target="_blank">AMD A6-5400K Trinity 3.6GHz</a></li>
  10.         <li>Motherboard: <a title="Motherboard" href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813128586" target="_blank">GIGABYTE GA-F2A85XM-HD3 FM2 AMD A85X</a></li>
  11.         <li>Graphics Card: <a title="Graphics Card" href="http://www.newegg.com/Product/Product.aspx?Item=N82E16814125414" target="_blank">GIGABYTE GV-R795WF3-3GD Radeon HD 7950 3GB</a></li>
  12.         <li>RAM: <a title="RAM" href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820231568" target="_blank">G.SKILL Ripjaws X Series 16GB (2 x 8GB)</a></li>
  13.         <li>Power: <a title="Power Supply" href="http://www.newegg.com/Product/Product.aspx?Item=N82E16817171054&amp;Tpk=Cooler%20Master%20Extreme%20Power%20Plus%20700W&amp;IsVirtualParent=1" target="_blank">Cooler Master Extreme Power Plus 700W</a></li>
  14.         <li>Hard Drive: A used re-formatted spare 300 GB Sata hard drive I salvaged from another machine</li>
  15. </ul>
  16. <strong>STEP 1: Install Ubuntu 12.04 LTS</strong>
  17.  
  18. Download and install Ubuntu 12.04 LTS:
  19.  
  20. <a href="https://debianhelp.wordpress.com/2012/11/10/to-do-list-after-installing-ubuntu-12-04-lts-aka-precise-pangolin/" target="_blank">https://debianhelp.wordpress.com/2012/11/10/to-do-list-after-installing-ubuntu-12-04-lts-aka-precise-pangolin/</a>
  21.  
  22. <strong>STEP 2: Install proprietary drivers for your graphics card</strong>
  23.  
  24. With the Radeon HD 7950, Ubuntu automatically suggested proprietary drivers after install. I selected and installed ATI/AMD proprietary FGLRX graphics driver (post-release updates). I avoided the beta drivers.
  25.  
  26. <strong>STEP 3: Install Ubuntu Updates</strong>
  27.  
  28. NOTE: I am using the terminal window to run these commands.
  29. <pre>sudo apt-get update</pre>
  30. NOTE: I recommend rebooting again here once updates are complete. Type sudo reboot in the terminal window. After you reboot your system make sure to install synaptic package package manager and check for updates manually with that application too, just to make you have the latest kernel image. Don't install your graphics drivers until there are no more updates available to download or found.
  31.  
  32. <strong>STEP 4: Install vim</strong>
  33. <pre>sudo apt-get install gedit vim</pre>
  34. <strong>STEP 5: Update grub</strong>
  35. <pre>sudo gedit /etc/default/grub</pre>
  36. In this file, update the following line:
  37. change GRUB_TIMEOUT=10 to GRUB_TIMEOUT=”10″
  38. <pre>sudo update-grub</pre>
  39. <strong>STEP 6: Install other needed packages</strong>
  40. <pre>sudo apt-get install subversion git-core</pre>
  41. <strong>STEP 7: Install ATI OpenCL Drivers</strong>
  42.  
  43. NOTE: Release 2.8 is current at time of writing this how-to. For more information, visit <a title="ATI OpenCL Drivers" href="http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/#one" target="_blank">http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/#one</a>
  44. <pre>mkdir amdapp_2-8
  45. cd amdapp_2-8</pre>
  46. Download the appropriate AMD APP SDK for your machine, i.e. AMD-APP-SDK-v2.8-lnx32.tgz or AMD-APP-SDK-v2.8-lnx64.tgz from here: <a title="Drivers Download" href="http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/#one" target="_blank">http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/#one</a>
  47. <pre>tar -zxvf ~/Downloads/AMD-APP-SDK-v2.8-lnx32.tgz</pre>
  48. By default on a new Ubuntu install, your Firefox downloads should be located in ~/Downloads unless you modified your download folder in Firefox preferences.
  49. <pre>sudo ./Install-AMD-APP.sh</pre>
  50. <strong>STEP 8: Reboot again</strong>
  51. <pre>sudo reboot</pre>
  52. <strong>STEP 9: Install cgminer’s prerequisites</strong>
  53.  
  54. NOTE: At this point, I am using some of the instructions from this post: <a title="Cgminer Install Tutorial" href="http://bitcoin-mining-headless.blogspot.com/2011/09/finally-cgminer-install-tutorial.html" target="_blank">http://bitcoin-mining-headless.blogspot.com/2011/09/finally-cgminer-install-tutorial.html</a>
  55. <pre>sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm</pre>
  56. <strong>STEP 10: Get cgminer</strong>
  57. <pre>git clone git://github.com/ckolivas/cgminer.git cgminer</pre>
  58. <strong>STEP 11: Install ADL SDK 5.0</strong>
  59.  
  60. NOTE: This will allow cgminer adjustments of such things as your GPU’s clocking, voltage and fan speed.
  61.  
  62. Special Note: Download ADL_SDK_5.0.ZIP from <a title="ADL SDK 5.0" href="http://developer.amd.com/amd-license-agreement/?f=ADL_SDK_5.0.zip" target="_blank">http://developer.amd.com/amd-license-agreement/?f=ADL_SDK_5.0.zip</a>. You might want to check if 5.0 is still the most current version first, and download whatever is most current. Modify the commands below according to the version you’re going to download.
  63. <pre>mkdir ADL_SDK
  64. cd ADL_SDK
  65. mv ~/Downloads/ADL_SDK_5.0.zip .
  66. unzip ADL_SDK_5.0.zip
  67. cp include/* ~/cgminer/ADL_SDK
  68. cd ~/cgminer
  69. ./autogen.sh</pre>
  70. Special Note: After running the autogen.sh command, you should see a summary similar to this one:
  71. <pre>Configuration Options Summary:
  72. curses.TUI...........: FOUND: -lncurses
  73. OpenCL...............: FOUND. GPU mining support enabled
  74. scrypt...............: Disabled
  75. ADL..................: SDK found, GPU monitoring support enabled
  76.  
  77. BFL.ASICs............: Disabled
  78. BitForce.FPGAs.......: Disabled
  79. Icarus.FPGAs.........: Disabled
  80. ModMiner.FPGAs.......: Disabled
  81. Ztex.FPGAs...........: Disabled
  82.  
  83. Compilation............: make (or gmake)
  84. CPPFLAGS.............:
  85. CFLAGS...............: -g -O2
  86. LDFLAGS..............: -lpthread
  87. LDADD................: -ldl -lcurl compat/jansson/libjansson.a -lpthread -L/opt/AMDAPP/lib/x86 -lOpenCL -lm
  88. Installation...........: make install (as root if needed, with 'su' or 'sudo')
  89. prefix...............: /usr/local</pre>
  90. Continue with the next command (it is formatted for a 64 bit Ubuntu environment):
  91. <pre>CFLAGS="-O2 -Wall -march=native -I /opt/AMDAPP/include/" LDFLAGS="-L/opt/AMDAPP/lib/x86_64" ./configure</pre>
  92. Special Note: After running the above command, you should see a summary again, similar to this one:
  93. <pre>Configuration Options Summary:
  94. curses.TUI...........: FOUND: -lncurses
  95. OpenCL...............: FOUND. GPU mining support enabled
  96. scrypt...............: Disabled
  97. ADL..................: SDK found, GPU monitoring support enabled
  98.  
  99. BFL.ASICs............: Disabled
  100. BitForce.FPGAs.......: Disabled
  101. Icarus.FPGAs.........: Disabled
  102. ModMiner.FPGAs.......: Disabled
  103. Ztex.FPGAs...........: Disabled
  104.  
  105. Compilation............: make (or gmake)
  106. CPPFLAGS.............:
  107. CFLAGS...............: -O2 -Wall -march=native -I /opt/AMDAPP/include/
  108. LDFLAGS..............: -L/opt/AMDAPP/lib/x86 -lpthread
  109. LDADD................: -ldl -lcurl compat/jansson/libjansson.a -lpthread -L/opt/AMDAPP/lib/x86_64 -lOpenCL -lm
  110. Installation...........: make install (as root if needed, with 'su' or 'sudo')
  111. prefix...............: /usr/local</pre>
  112. Continue with the next command (You are still in Terminal, in your cgminer folder):
  113. <pre>make</pre>
  114. <strong>STEP 12: Testing</strong>
  115. <pre>export DISPLAY=:0
  116. export GPU_USE_SYNC_OBJECTS=1
  117. ./cgminer -n</pre>
  118. On my machine, I have one Radeon HD 7950, so this is the summary I see:
  119. <pre>[2013-03-20 14:35:32] CL Platform 0 vendor: Advanced Micro Devices, Inc.
  120. [2013-03-20 14:35:32] CL Platform 0 name: AMD Accelerated Parallel Processing
  121. [2013-03-20 14:35:32] CL Platform 0 version: OpenCL 1.2 AMD-APP (1113.2)
  122. [2013-03-20 14:35:32] Platform 0 devices: 1
  123. [2013-03-20 14:35:32] 0 Tahiti
  124. [2013-03-20 14:35:32] GPU 0 AMD Radeon HD 7900 Series hardware monitoring enabled
  125. [2013-03-20 14:35:32] 1 GPU devices max detected</pre>
  126. <strong>STEP 13: Run cgminer</strong>
  127.  
  128. Special Note: There is up-to-date information on cgminer on the <a title="Bitcoin Talk Forum" href="https://bitcointalk.org/" target="_blank">Bitcoin Talk Forum</a> here: <a title="CGMiner on Bitcoin Talk" href="https://bitcointalk.org/index.php?topic=28402.0" target="_blank">https://bitcointalk.org/index.php?topic=28402.0</a>.
  129.  
  130. You will most likely need to join a <a title="What is Pooled Mining?" href="https://en.bitcoin.it/wiki/Pooled_mining" target="_blank">mining pool</a>. I recommend <a title="AKA Slush" href="http://mining.bitcoin.cz" target="_blank">Slush’s pool</a>, but there are several other good ones.
  131.  
  132. Starting cgminer: Once you’re registered on a mining pool, you can simply run the following basic Terminal command in your cgminer folder:
  133. <pre>cgminer -o http://pool:port -u username -p password</pre>
  134. <ul>
  135.         <li>Where
  136. <pre>http://pool:port</pre>
  137. is the URL the pool requires you point your miner to.</li>
  138.         <li>Where username is the worker username you created on the pool. See your pool’s instructions.</li>
  139.         <li>Where password is the worker password (not your pool account password) you created on the pool. See your pool’s instructions.</li>
  140. </ul>
  141. <strong>STEP 14: Running cgminer with a configuration script</strong>
  142.  
  143. Once I experimented a bit with cgminer settings, I created a configuration script as shown on <a title="Complete Guide to Mine Bitcoin on Xubuntu 12.04" href="https://docs.google.com/document/d/1Gw7YPYgMgNNU42skibULbJJUx_suP_CpjSEdSi8_z9U/edit?pli=1" target="_blank">Complete Guide to Mine Bitcoin on Xubuntu 12.04</a>.
  144.  
  145. To make your first cgminer configuration script, you simply cut and paste the following into a text document and save it in your cgminer folder as cg.sh. Don’t forget to add your pool credentials.
  146. <pre>#!/bin/sh
  147. export DISPLAY=:0
  148. export GPU_USE_SYNC_OBJECTS=1
  149. cd /home/worker1/cgminer
  150. ./cgminer -o http://pool:port -u username -p password --api-listen --api-network -I 9 --gpu-reorder --auto-fan --gpu-powertune 20 --gpu-engine 920,920,920,1125 --gpu-memclock 795,795,795,975</pre>
  151. Once the file is saved, update it with:
  152. <pre>chmod +x cg.sh</pre>
  153. Then, start cgminer:
  154. <pre>./cg.sh</pre>
  155. That’s it. This should get you running. If you have a HD 7950, you might want to tweak the cgminer settings a bit to get more hashing power, adjust the fan speed etc.
  156.  
  157. See this post: <a title="The 7950 Megahash Thread" href="https://bitcointalk.org/index.php?topic=102279.0" target="_blank">The 7950 Megashash Thread</a>.
  158.  
  159. <strong>References:</strong>
  160. <ul>
  161.         <li><a title="Bitcoin headless miner configuration" href="http://bitcoin-mining-headless.blogspot.com/2011/08/ubuntu-1104-x8664-dedicated-crypto.html" target="_blank">Bitcoin headless miner configuration</a></li>
  162.         <li><a title="Complete Guide to Mine Bitcoin on Xubuntu 12.04" href="https://docs.google.com/document/d/1Gw7YPYgMgNNU42skibULbJJUx_suP_CpjSEdSi8_z9U/edit?pli=1" target="_blank">Complete Guide to Mine Bitcoin on Xubuntu 12.04</a></li>
  163.         <li><a title="ATI OpenCL Drivers" href="http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/#one" target="_blank">ATI OpenCL Drivers</a></li>
  164.         <li><a title="CGMiner Installation Tutorial" href="http://bitcoin-mining-headless.blogspot.com/2011/09/finally-cgminer-install-tutorial.html" target="_blank">Cgminer Install Tutorial</a></li>
  165.         <li><a title="ADL_SDK_5.0.ZIP" href="http://developer.amd.com/amd-license-agreement/?f=ADL_SDK_5.0.zip" target="_blank">ADL SDK 5.0</a></li>
  166.         <li><a title="The 7950 Megahash Thread" href="https://bitcointalk.org/index.php?topic=102279.0" target="_blank">The 7950 Megahash Thread</a></li>
  167.         <li><a title="CGMINER Information on the Bitcoin Talk Forum" href="https://bitcointalk.org/index.php?topic=28402.0" target="_blank">CGMINER GPU FPGA overc monit fanspd RPC stratum linux/windws/osx/mip/r-pi 2.11.3</a></li>
  168. </ul>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top