Debian Linux cryptocoin mining rig setup guide

From lurkmore wiki
Revision as of 16:05, 23 September 2013 by Kyrio (talk)
Jump to navigationJump to search
If this guide helps you at all, please donate to the original author: LYNFisPEmoEJRuVNKWWaUaxskTZUxMCz1G

This guide will give you detailed information on installing Debian Linux, the AMD video drivers (GPU), the AMD APP SDK, and cgminer (with temperature readings and changing graphics card clock speeds, voltages, etc).

Preparation

Download either UNetbootin or Rufus to copy your Debian image to a USB memory stick. Rufus is supposedly twice as fast as the other available options.

If using Rufus, you must first download a copy of Debian, the 32-bit (i386, x86) version should be fine regardless of your system configuration.

Within Rufus, click on the disc image located beside Copy a bootable disk using: and select the Debian Linux ISO that you've downloaded. Make sure the associated checkbox is checked and that the dropdown says ISO Image. Make sure you select the correct USB stick and click Start.

If using UNetbootin: (*) Distribution -> Debian -> Stable_NetInstall

Install Debian Linux

Start the computer with the key plugged in. When the installer begins, select Install. Select your language. Select your country. The default keymap is usually what you want.

You can just select Continue for the hostname screen. The default is fine. The domain name can be blank, select Continue.

Choose a secure password for your root account. The root account controls the entire system and can be logged in to by any computer on the network. If a person gains access to your router, they can also access that PC. A secure password will prevent anyone else from gaining access to the computer.

Either type in a name for your user account, or leave it blank. Select a new username for your account, it can be anything that you want to log in to. Select a secure password for that new account.

The new user creation can generally be 'skipped'. If you don't set up the PHP monitoring script, you won't need the new user and we'll be deleting it anyway.

Select your time zone.

During the disk setup, there are two methods. The simplest method is to select the following:

This method creates a swap partition which may degrade the performance or lifespan of a USB stick. A mechanical hard disk would benefit from the swap file.
Partitioning method: Guided - use entire disk
Select the correct USB key or disk drive that you are installing the system to.
Partition scheme: All files in one partition
Finish partitioning...
Select Yes to write the changes.

A more advanced method would be to remove the swap partition and save writes to your USB key:

Instead of using the Guided method, select Manual.
Select the correct USB key or disk drive that you are installing the system to.
Select the pri/log line.
Create a new partition
Continue
Primary
Select Mount options, select noatime using the Spacebar.
Select Bootable flagg to set it to on.
Done setting up the partition
Finish partitioning...
Select No when it warns you about the swap partition. You don't want a swap partition.
Select Yes to write the changes.

Select your country to get a list of download mirrors local to you. Select a mirror which you believe to be closest. Leave the page asking about a proxy blank, just select Continue.

Configuring popularity-contest: select No.

Software selection: Deselect all default options (Spacebar) and enable [*] SSH server.

Install the GRUB boot loader...: Yes.

Continue

Linux is finally installed!

Post-install system setup

Now that Debian Linux is installed, you no longer have to sit in front of the rig's monitor. You can log in to your system remotely with any SSH, SCP or SFTP program. If you are using Windows, I suggest WinSCP and PuTTY.

Log in as username root, using your root password.

PuTTY would be the program we need for the rest of this guide, though you can run WinSCP first, add the connection info, then when logged in with WinSCP, hit ctrl+p to open PuTTY.

# nano /etc/apt/sources.list

Add to the end of each line that starts with deb: contrib non-free
To exit the editor (nano), hit ctrl+x, then Y, and finally, just hit Enter.

# apt-get update && apt-get upgrade

# apt-get install bzip2 fglrx-driver libcurl4-openssl-dev libncurses5-dev libudev-dev ntp screen unzip xdm xorg

# apt-get purge libfglrx

# apt-get clean

Install video card drivers (AMD GPU)

The fastest AMD drivers are version 12.8.

# wget http://www2.ati.com/drivers/linux/amd-driver-installer-12-8-x86.x86_64.zip

# unzip amd-driver-installer-12-8-x86.x86_64.zip && sh amd-driver-installer-8.982-x86.x86_64.run --force

When the installer starts, just press Enter on any screens until the driver finishes installing.

Initial graphics card setup (also do this after adding or removing cards):

# rm /etc/X11/xorg.conf && aticonfig --adapter=all --initial

Install AMD APP SDK

# wget http://developer.amd.com/wordpress/media/2012/11/AMD-APP-SDK-v2.8-lnx32.tgz && tar xzf AMD-APP-SDK-v2.8-lnx32.tgz && sh Install-AMD-APP.sh

# nano /etc/profile

Add the following to the bottom of the file:
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
export XAUTHORITY=/.Xauthority

REBOOT!!!

# reboot

Install cgminer

cgminer 3.1.1 is what we use. All versions tend to have the same mining performance, later versions generally just include support for newer Bitcoin mining hardware. In fact, the latest version (as of September 2013) calculates the accepted shares incorrectly. You can use any version you want by changing the download URL and updating the filenames in the commands below.

Keep in mind that these versions only directly support GPUs up to the 7900 series. If you have a newer GPU, you will likely have to use a newer version of cgminer.

# wget http://ck.kolivas.org/apps/cgminer/3.1.1/cgminer-3.1.1.tar.bz2

# tar jxf cgminer-3.1.1.tar.bz2

# cd cgminer-3.1.1/ADL_SDK && wget http://mein.intern3ts.com/ADL_SDK_5.0.zip && unzip -j ADL_SDK_5.0.zip 'include/adl_*.h'

# cd .. && ./configure --enable-scrypt && make && make install

# cd .. && rm -rf cgminer-3.1.1 cgminer-3.1.1.tar.bz2

Put your cgminer.conf file in /root/.cgminer and add your configuration information (pools, thread-concurrency, etc).

Running cgminer and mining

Your setup is now complete.

You can type cgminer in any location to begin mining. The .bin file for your GPUs will be generated, on first run, in the directory where you've run cgminer.

If you want cgminer to start every time you reboot, add the following to the bottom of /etc/rc.local:

screen -dmS cgminer bash -lc 'sleep 10; export HOME=/root; cgminer;'

PHP stats script

cgminer is shipped with a PHP script that will show you your cgminer information using the cgminer API. You can access this script from a web browser after configuring the script, cgminer and an httpd.

If you do not plan to use this script, you can delete the user account that was created during the Debian install process.

# deluser <username> && rm -rf /home/<username> (Replace <username> with the username you created.)

The setup procedure will be added at a later time, though the documentation is available through web searches.

If this guide helps you at all, please donate to the original author: LYNFisPEmoEJRuVNKWWaUaxskTZUxMCz1G