blog‎ > ‎

Ubuntu 11.04 x64 Bitcoin Miner Tutorial

posted Sep 13, 2011, 9:28 AM by Josh Popham   [ updated Sep 13, 2011, 10:40 AM ]
Also as a bonus at the end, there's a little MD5-cracking with whitepixel.

I'm going to skip parts that I assume do not need instruction. These instructions were mostly "lifted" from the bitcointalk.org forums. Specifically, I found these links most helpful:

...the list goes on really


These instructions apply to pooled mining only and I'm not doing a headless install. So the first step is to install Ubuntu 11.04 x64 and get that working. So I'll be SKIPPING the headless portion and the json-rpc config and connecting back to your own bitcoin client for solo-mining in this tutorial. 

I'll also be skipping the install of the bitcoin client, set this up on your own. Instructions can be found in the links above.

The basic steps are:

  1. A working install of ATI proprietary drivers. 
  2. The ATI Stream SDK
  3. Python (comes with Ubuntu)
  4. pyopencl compiled and linked to the correct location of the ATI Stream SDK. pyopencl seems to be the hardest part for most.
  5. A bitcoin mining program to connect to a pool.

You can download and install the proprietary ATI drivers manually like detailed below OR you can just allow the Ubuntu GUI to install them. Just click "Activate" on the popup dialog that comes after you install Ubuntu and accept and install the ATI proprietary drivers. This method works fine, I've tried both with a Vanilla install. At this point I prefer the GUI ATI proprietary driver install.

If you want to grab them and install yourself:

wget http://www2.ati.com/drivers/linux/ati-driver-installer-11-8-x86.x86_64.run
sudo sh ati-driver-installer-11-5-x86.x86_64.run --buildpkg Ubuntu/natty
sudo dpkg -i *.deb
sudo apt-get -f install
sudo aticonfig -f --initial --adapter=all
sudo 
aticonfig --list-adapters
sudo reboot

So the instructions are to get your proprietary driver loaded, working, tested, and then reboot to use it before doing anything else. You should be able to list your video adapters using aticonfig You could of course choose to continue and reboot later. 

Continuing on with required dependencies:

sudo apt-get update
sudo apt-get install python-setuptools python-numpy subversion g++ libboost-all-dev git

Download, extract, and configure the AMD Stream SDK. I like to put stuff in /opt!

tar xvzf AMD-APP-SDK-v2.4-lnx64.tgz
sudo mv AMD-APP-SDK-v2.4-lnx64/ /opt
echo export AMDAPPSDKROOT=/opt/AMD-APP-SDK-v2.4-lnx64/ >> ~/.bashrc
echo export AMDAPPSDKSAMPLESROOT=/opt/AMD-APP-SDK-v2.4-lnx64/ >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=${AMDAPPSDKROOT}lib/x86_64:${LD_LIBRARY_PATH}' >> ~/.bashrc
source ~/.bashrc
cd /
sudo tar xfz $AMDAPPSDKROOT/icd-registration.tgz

Download, extract, configure, and compile pyopencl:

wget http://pypi.python.org/packages/source/p/pyopencl/pyopencl-0.92.tar.gz
tar xzvf pyopencl-0.92.tar.gz
sudo mv pyopencl-0.92 /opt
cd /opt/pyopencl-0.92
sudo ./configure.py --cl-inc-dir=${AMDAPPSDKROOT}include --cl-lib-dir=${AMDAPPSDKROOT}lib/x86_64
sudo make
sudo make install

Download a miner:

cd /opt
sudo git clone https://github.com/m0mchil/poclbm.git
cd /opt/poclbm    
./poclbm -u <user:pass@url.forthe.pool> -d<Device>
 
Full poclbm options explained here:  https://bitcointalk.org/?topic=4122.0

This should have you up and mining on a pool. There are other miners available that can be used also.

I think these steps are going to be most appropriate for the potential masses of bitcoin miners like myself that are most likely mining at slower speeds where solo mining may never prove profitable. 

If you would like to learn more about pooled mining, Read these links (in no particular order):
 


Bonus Round!

Other uses for GPGPU-accelerated computing other than bitcoin mining? How about MD5 hash bruteforcing and password auditing -> http://whitepixel.zorinaq.com/

Taking your working BTC mining config above, go grab a copy of whitepixel:

wget http://whitepixel.zorinaq.com/files/whitepixel-2.tar.bz2
sudo tar xjf whitepixel-2.tar.bz2
sudo mv whitepixel-2 /opt
cd /opt/whitepixel-2

Edit your whitepixel Makefile /opt/whitepixel-2/Makefile with the location of your ATI Stream SDK. 
It's in the first 4 lines:

# Update /usr/local/... to point to the ATI Stream SDK include path
CPPFLAGS = -I/usr/local/ati-stream/include

CFLAGS = -O1 -std=c99 -pedantic -Wextra -Wall -Werror \

I changed mine to:

# Update /usr/local/... to point to the ATI Stream SDK include path
CPPFLAGS = -I/opt/AMD-APP-SDK-v2.4-lnx64/include/CAL/

CFLAGS = -O1 -std=c99 -pedantic -Wextra -Wall  \

Notice also the removal of the " -Werror" in the 4th line. I had to remove this due to compile errors. Something about BFI_INT - google it if necessary

Now compile:

sudo make

It should work now. Test it out. The MD5 hash for the string "admin" is 21232f297a57a5a743894a0e4a801fc3:

./whitepixel -ec all 21232f297a57a5a743894a0e4a801fc3
Whitepixel v2
Enabling experimental BFI_INT instructions (integer bitfield insert)
Attacking search space: charset all, length 5
Initializing CAL
CAL version 1.4.1353
Found 4 devices
Launching 256 threads per SIMD
Device 0: unknown (tgt.rev 15.1), 22 SIMDs, launching 5632 threads
Device 1: Cypress GPU (tgt.rev 8.2), 14 SIMDs, launching 3584 threads
Device 2: unknown (tgt.rev 15.1), 22 SIMDs, launching 5632 threads
Device 3: unknown (tgt.rev 17.20), 12 SIMDs, launching 3072 threads
Overall rate: 12815 Mhash/sec...
Found message.
Length: 5
Bytes:  [61 64 6d 69 6e]
String: [admin]

Hopefully this will be found useful by someone. 







Comments