Debian Linux cryptocoin mining rig setup guide: Difference between revisions

From lurkmore wiki
Jump to navigationJump to search
No edit summary
m 54 revisions imported
 
(23 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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).
This guide will give you detailed information on installing [[Debian]] GNU/[[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
  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 ==
== Preparation ==
'''Please note that using this guide with [https://www.debian.org/releases/squeeze/debian-installer/ Debian 6.0.9], instead of the latest Debian, will result in 100% success. Do not use the latest version of Debian!!!!!!!'''
Download either [http://unetbootin.sourceforge.net/ UNetbootin] or [http://rufus.akeo.ie/ Rufus] to copy your Debian image to a USB memory stick. Rufus is supposedly twice as fast as the other available options.
Download either [http://unetbootin.sourceforge.net/ UNetbootin] or [http://rufus.akeo.ie/ 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 [http://www.debian.org/distrib/netinst download a copy of Debian], the 32-bit (i386, x86) version should be fine regardless of your system configuration.
If using Rufus, you must first [http://www.debian.org/distrib/netinst 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 <code>Copy a bootable disk using:</code> and select the Debian Linux ISO that you've downloaded. Make sure the associated checkbox is checked and that the dropdown says <code>ISO Image</code>. Make sure you select the correct USB stick and click <code>Start</code>.
: Within Rufus, click on the disc image located beside <code>Copy a bootable disk using:</code> and select the Debian GNU/Linux ISO that you've downloaded. Make sure the associated checkbox is checked and that the dropdown says <code>ISO Image</code>. Make sure you select the correct USB stick and click <code>Start</code>.


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


== Install Debian Linux ==
== Install Debian GNU/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 GNU/Linux as described below.
 
Start the computer with the key plugged in. When the installer begins, select <code>Install</code>. Select your language. Select your country. The default keymap is usually what you want.
Start the computer with the key plugged in. When the installer begins, select <code>Install</code>. Select your language. Select your country. The default keymap is usually what you want.


Line 35: Line 42:
: Select the correct USB key or disk drive that you are installing the system to.
: Select the correct USB key or disk drive that you are installing the system to.
: Select the <code>pri/log</code> line.
: Select the <code>pri/log</code> line.
* ''Depending on your system, it may be necessary to add another partition to make your system bootable, an <code>EFIboot</code> partition, which doesn't need to be more than 512MB. If you have to use this method, the partition below should not be selected as "bootable"''
: <code>Create a new partition</code>
: <code>Create a new partition</code>
: <code>Continue</code>
: <code>Continue</code>
Line 56: Line 62:
<code>Continue</code>
<code>Continue</code>


Linux is finally installed!
GNU/Linux is finally installed!


== Post-install system setup ==
== 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 [http://winscp.net WinSCP] and [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY].
Now that Debian GNU/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 [http://winscp.net WinSCP] and [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY].


Log in as username <code>root</code>, using your root password.
Log in as username <code>root</code>, using your root password.
Line 70: Line 76:
<nowiki>#</nowiki> <code>apt-get update && apt-get upgrade</code>
<nowiki>#</nowiki> <code>apt-get update && apt-get upgrade</code>


<nowiki>#</nowiki> <code>apt-get install bzip2 fglrx-driver libcurl4-openssl-dev libncurses5-dev libudev-dev ntp screen unzip xdm xorg</code>
<nowiki>#</nowiki> <code>apt-get install autoconf bzip2 fglrx-driver git libcurl4-openssl-dev libncurses5-dev libtool libudev-dev ntp screen unzip xdm</code>
 
<nowiki>#</nowiki> <code>apt-get purge libfglrx</code>


<nowiki>#</nowiki> <code>apt-get clean</code>
<nowiki>#</nowiki> <code>apt-get clean</code>


=== Install video card drivers (AMD GPU) ===
=== Install video card drivers (AMD GPU) ===
: ''The fastest AMD drivers are version 12.8.''
: ''The fastest AMD drivers are version 12.8. Unfortunately, you might need to use the latest drivers with Rx series video cards!''
<nowiki>#</nowiki> <code>wget --referer=http://www2.ati.com http://www2.ati.com/drivers/linux/amd-driver-installer-12-8-x86.x86_64.zip</code>
<nowiki>#</nowiki> <code>wget --referer=http://www2.ati.com http://www2.ati.com/drivers/linux/amd-driver-installer-12-8-x86.x86_64.zip</code>


Line 88: Line 92:


=== Install AMD APP SDK ===
=== Install AMD APP SDK ===
: ''Rx series video cards might require the latest SDK!''
<nowiki>#</nowiki> <code>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 ..</code>
<nowiki>#</nowiki> <code>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 ..</code>
* ''If you use Debian x64, modify the URL and filename to lnx64 instead of lnx32.''
* ''If you use Debian x64, modify the URL and filename to lnx64 instead of lnx32.''
Line 105: Line 110:


=== Install cgminer ===
=== 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.
[[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.


Keep in mind that these versions only directly support GPUs up to the 7900 and Rx series. If you have a newer GPU, you will likely have to use a newer version of cgminer (after version 3.7.2, you'll likely have to find a new miner altogether).
<nowiki>#</nowiki> <code>git clone https://github.com/ckolivas/cgminer</code>


<nowiki>#</nowiki> <code>wget http://ck.kolivas.org/apps/cgminer/3.1/cgminer-3.1.1.tar.bz2</code>
<nowiki>#</nowiki> <code>cd cgminer && git checkout v3.1.1</code>


<nowiki>#</nowiki> <code>tar jxf cgminer-3.1.1.tar.bz2</code>
<nowiki>#</nowiki> <code>cd ADL_SDK && wget http://www.lurkmore.com/mining/ADL_SDK.zip && unzip -j ADL_SDK.zip 'include/adl_*.h'</code>


<nowiki>#</nowiki> <code>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'</code>
<nowiki>#</nowiki> <code>cd .. && ./autogen.sh && ./configure --enable-opencl --enable-scrypt && make && make install</code>


<nowiki>#</nowiki> <code>cd .. && ./configure --enable-scrypt && make && make install</code>
<nowiki>#</nowiki> <code>cd && rm -rf cgminer && mkdir .cgminer</code>
 
<nowiki>#</nowiki> <code>cd .. && rm -rf cgminer-3.1.1 cgminer-3.1.1.tar.bz2</code>


Put your <code>[[cgminer.conf]]</code> file in <code>/root/.cgminer</code> and add your configuration information (pools, thread-concurrency, etc).
Put your <code>[[cgminer.conf]]</code> file in <code>/root/.cgminer</code> and add your configuration information (pools, thread-concurrency, etc).
Line 129: Line 132:
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.
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: <code>screen -R cgminer</code>. After that, you can type <code>cgminer</code> as you usually would.
Before starting cgminer, use the following command to open a screen window that you can attach to again later: <code>screen -S cgminer</code>. After that, you can type <code>cgminer</code> 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 <code>ctrl+a d</code>.
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 <code>ctrl+a d</code>.
Line 138: Line 141:


=== cgminer on boot ===
=== cgminer on boot ===
If you want cgminer to start every time you reboot, add the following to the bottom of <code>/etc/rc.local</code>:
If you want cgminer to start every time you reboot, add the following to the cron job by typing <code>crontab -e</code> and scrolling to the bottom of the editor:


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


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.
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.
Line 154: Line 157:


  Donations to the original author: LTC LYNFisPEmoEJRuVNKWWaUaxskTZUxMCz1G or BTC 1K3D82nFruLa5pJwEMYS1XXvC1suQhNGdb
  Donations to the original author: LTC LYNFisPEmoEJRuVNKWWaUaxskTZUxMCz1G or BTC 1K3D82nFruLa5pJwEMYS1XXvC1suQhNGdb
== Related articles ==
* [[cgminer.conf]]
* [[cgminer]]
* [[cgminer README]]
* [[sgminer]]
* [[Auto-flash AMD/ATI video card firmware]]


== External links ==
== External links ==
Line 161: Line 171:
* [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]
* [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]
* [http://winscp.net/ WinSCP]
* [http://winscp.net/ WinSCP]
* [http://ck.kolivas.org/apps/cgminer cgminer downloads, all versions]
* [https://github.com/ckolivas/cgminer/tree/v3.1.1 cgminer source code for tag 3.1.1]


[[Category:Cryptocurrency]][[Category:Technology]]
[[Category:Cryptocurrency]][[Category:Technology]]

Latest revision as of 00:16, 1 April 2022

This guide will give you detailed information on installing Debian GNU/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 GNU/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 GNU/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 GNU/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

GNU/Linux is finally installed!

Post-install system setup

Now that Debian GNU/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 v3.1.1

# 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