Debian Linux cryptocoin mining rig setup guide

From lurkmore wiki
Revision as of 14:43, 8 June 2014 by Kyrio (talk)
Jump to navigationJump to search

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).

Donations to the original author: LTC LYNFisPEmoEJRuVNKWWaUaxskTZUxMCz1G or BTC 1K3D82nFruLa5pJwEMYS1XXvC1suQhNGdb

Note: This guide sets you up to run cgminer as root; if you need a different configuration, be sure to modify your install process. The warning to use strong passwords exists for a reason!

Preparation

Please note that using this guide with Debian 6.0.9, instead of the latest Debian, will result in 100% success. Do not use the latest version of Debian!!!!!!!

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

Note: There have been issues getting mining started on UEFI motherboards. The Debian install is successful but installing drivers or getting cgminer to run is impossible.
If you have a UEFI motherboard, you need to enter the BIOS (with the key plugged in already) and find a section along the lines of Boot Override, or if that section doesn't exist, the section to change boot order. You need to select USB boot or legacy boot, but definitely not anything called UEFI boot. Select the non-UEFI option for your USB key and install Linux as described below.

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 flag 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

For each line that starts with deb, add the following to the end: 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 autoconf bzip2 fglrx-driver git libcurl4-openssl-dev libncurses5-dev libtool libudev-dev ntp screen unzip xdm

# apt-get clean

Install video card drivers (AMD GPU)

The fastest AMD drivers are version 12.8. Unfortunately, you might need to use the latest drivers with Rx series video cards!

# wget --referer=http://www2.ati.com 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

Rx series video cards might require the latest SDK!

# mkdir app-sdk && cd 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 && cd ..

  • If you use Debian x64, modify the URL and filename to lnx64 instead of lnx32.

Type Yes when prompted.

# 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, though the newer Rx series video cards may require version 3.7.2. All versions tend to have the same mining performance, later versions generally just include support for newer Bitcoin mining hardware. You can use any version you want by changing the download URL and updating the filenames in the commands below.

# git clone https://github.com/ckolivas/cgminer

# cd cgminer && git checkout 3.5

# cd ADL_SDK && wget http://www.lurkmore.com/mining/ADL_SDK.zip && unzip -j ADL_SDK.zip 'include/adl_*.h'

# cd .. && ./autogen.sh && ./configure --enable-opencl --enable-scrypt && make && make install

# cd && rm -rf cgminer && mkdir .cgminer

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.

Using Screen

You can use a program--which we installed near the beginning of the setup--called Screen to run cgminer without having to keep an SSH session open at all times. Using Screen, you can also have the system autostart cgminer while giving you the ability to check on it after it's started.

Before starting cgminer, use the following command to open a screen window that you can attach to again later: screen -S cgminer. After that, you can type cgminer as you usually would.

Now that you've got cgminer running properly, you might want to close your SSH window, or maybe just go back to the command line and do other things. You can exit that Screen session (detach) by hitting the keys ctrl+a d.

You can get back in to your Screen session (reattach) by simply typing screen -r.

You can also use Screen for any other long running task which you may not want to have a window open for the duration of its run time.

cgminer on boot

If you want cgminer to start every time you reboot, add the following to the cron job by typing crontab -e and scrolling to the bottom of the editor:

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

Using this method, you won't have to log in to your rig to start cgminer every time you reboot. Also, you can log in to your rig and use the screen commands to monitor cgminer at any time after it boots.

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.

Donations to the original author: LTC LYNFisPEmoEJRuVNKWWaUaxskTZUxMCz1G or BTC 1K3D82nFruLa5pJwEMYS1XXvC1suQhNGdb

Related articles

External links