How To Configure Linux, and build Cgminer for bitcoin and litecoin.

How To Configure Linux, and build Cgminer for bitcoin and litecoin.

For those of us Windows (or Apple) users, Linux can be daunting at first.  It's the wild west of operating systems.  In many ways is far superior than it's Microsoft and Apple counterparts; however, there are some strong caveats.  To make bitcoin and litecoin even more confusing to the average person, try adding Linux to the mix.  Frustration typically ensues.  

I hope to break down a few of the barriers to entry in the bitcoin/litecoin mining arena, in the world of Linux.

Let's begin. I'm using a fresh install of Linux, and the following hardware: 

System details

Motherboard: ASUS M5A99FX PRO

Processor: AMD FX 6100 6-Core Processor

Memory/RAM: Corsair Vengeance 8GB

Power Supply: Cooler Master Silent Pro M - 1000W 80 PLUS Bronze Power Supply

Graphics card: Sapphire AMD Radeon 7970 Dual-x Grahics Card (I'm using two gpu's)

Operating system:  Xubuntu 12.04

AMD Drivers: 13.8 Beta


AMD ADL: 5.0

Installing Xubuntu

First we must install Linux.  For this tutorial, I'm using Xubuntu 12.04 (see the link above).  Download the xubuntu distribution, and place it on a USB drive (or burn it to a DVDROM).  I use an application called: Linux live usb creator.  This is an easy way to get an install of linux on a USB drive, from a windows computer.

Insert the USB drive to the PC you want linux on, and boot into the BIOS.  Inside the BIOS, you'll need to change the boot order, so that the USB drive boots first.  You'll have to change it back once Linux is installed.  

The Linux install will begin upon bootup.  Select "Install Xubuntu", and it will begin.  It's best to let it use the automatic settings, if you don't know what you're doing.  When it prompts you for a username and password, be sure to select "log in automatically"

After the installation is complete, the computer will reboot.  At this point, you can remove the USB drive, and go back into the BIOS settings, and change the boot order back to your hard drive.

Boot into Linux for the first time, you'll be prompted to update the system.  It's always a good practice to update your system before you begin.  

Getting prepared for Cgminer

Note:  Using sdk & driver versions different from the versions listed above may cause problems.  

After you've updated your Linux installation, we are ready to begin.  Open up your web browser, and download to your "home/username" directory the AMD driver, AMD SDK, and AMD ADL (links are above).  Navigate to your "Home/username" directory, and verify that you've downloaded these files.

Open up the Terminal Emulator program.

Type the following:

sudo apt-get install libcurl4-openssl-dev pkg-config libtool libncurses5-dev libudev-dev screen xterm
sudo apt-get install git-core
sudo apt-get install openssh-server byobu
sudo apt-get install autoconf
sudo apt-get install automake

Downloading Cgminer

ATTENTION:  If you are mining with a GPU, you must use Cgminer version 3.7 or below!  The GPU portion of the code has been removed.  

Inside your home directory, download Cgminer 3.7

git clone

Installing AMD drivers

Now it's time to install the AMD drivers.  We downloaded them into our Home directory.  Inside your terminal emulator, do the following:

cd /opt
sudo tar xvzf /home/username/AMD-APP-SDK-v2.8.1.0-lnx32.tgz
cd /
sudo tar xvzf /opt/icd-registration.tgz
cd /opt
sudo tar xvzf AMD-APP-SDK-v2.8.1.0-RC-lnx32.tgz
sudo ln -s /opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/include/CL /usr/include
sudo ln -s /opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/lib/x86/* /usr/lib/

Now we will install the ADL drivers.  Inside the home/username directory

mkdir ADL
mv ADL
cd ADL
sudo cp include/*.h /home/username/cgminer/ADL_SDK

Build Cgminer with Bitcoin, and Litecoin (scrypt) support.

cd cgminer
./       # Only needed if building from git
CFLAGS="-O2 -Wall -march=native -I/opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/include" LDFLAGS="-L/opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/lib/x86" ./configure --enable-opencl --enable-scrypt 

Your output should look something like this


Then type the following commands:

sudo make
sudo make install

Install the AMD Catalyst driver (fglrx).

In your terminal, go into your home/username directory, and lets finish!  This will prompt you with the AMD installation window (pictures).

chmod 700
sudo ./

b2ap3_thumbnail_Linux_002.jpg    b2ap3_thumbnail_Linux_004.jpg


Final driver configuration

Once the system has rebooted, open your Terminal emulator, and type the following commands:

sudo aticonfig --adapter=all --initial

Now we can see if our installation has been successful. Type the following commands:

sudo aticonfig --lsa
sudo aticonfig --adapter=all --odgt

This will give you an output that looks something like this:


Now, we have to make sure that cgminer recognizes our drivers, and our GPU cards.  In terminal: 

cd cgminer
./cgminer -n

It should look like this, with no errors.


You can start cgminer, and enter the pool information manually.  This will be the final confirmation, that you've installed, and configured everything properly.


Here is a fresh install, with no overclock settings.  Hashing away.


That's it!  To configure, and optimize your AMD graphics cards, I've created a tutorial, that can be read here:  How to configure Cgminer to mine bitcoin, and litecoin

Rate this blog entry:
Poland confiscates pension funds, bitcoin still fr...
Bitcoin - An Emerging Global Payment System - Coin...
  • Guest - Tracer

    Hey guys , i'm having this error "configure: error: Could not find pthread library - please install libpthread" and i have installed it. I have this error when i'm running ./configure. Any ideas ?


  • Guest - L0laapk3

    when I tried to perform

    CFLAGS="-O2 -Wall -march=native -I/opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/include" LDFLAGS="-L/opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/lib/x86" ./configure --enable-opencl --enable-scrypt 

    it will say openCL not found, GPU mining support disabled. is this because I am using ADL 6.0 (I can't seem to find the 5.0 download), or is it caused by the following thing:

    when I run the amd catalyst installer, it'll give me an error when it is pretty much finished, but it will act like the installation succeeded and let me reboot my pc ect... here's what the log file says: also when I perform the
    sudo aticonfig --adapter=all --odgt
    command, it says this: ERROR - OD Get Version failed. but
    sudo aticonfig --adapter=all --odgt
    gives me the correct output. I have a no clue how to fix this, any idea how to?

    Thanks in advance!

  • Guest - L0laapk3

    Guest - L0laapk3

    the second problem was also solved by performing this alternative way to install amd catalyst.

  • Guest - L0laapk3

    Guest - L0laapk3

    ok the first problem is fixed, I don't exactly know how I fixed it, I just got myself a fresh install and started over and it was working :)
    the fglrx still gives me an error, and causes cgminer to also give me an error. :(

  • Guest - Kevin

    Hey guys, has anyone else had difficulty with the codes:

    ;;sudo ln -s /opt/AMD-APP-SDK-v2.8.1.0-RC-lnx64/include/CL /usr/include
    ;;ln: failed to create symbolic link `/usr/include/CL': File exists

    and the line after it:
    sudo ln -s /opt/AMD-APP-SDK-v2.8.1.0-RC-lnx64/lib/x86/* /usr/lib/
    ln: failed to create symbolic link `/usr/lib/': File exists
    ln: failed to create symbolic link `/usr/lib/': File exists
    ln: failed to create symbolic link `/usr/lib/': File exists
    ln: failed to create symbolic link `/usr/lib/': File exists
    ln: failed to create symbolic link `/usr/lib/': File exists

    I am not sure if this is a good thing or a bad thing and if I should write over the existing files or not. Thanks for your help, this is a great guide.

  • Guest - L0laapk3

    Guest - Kevin

    its because you already ran the command before and the files it is trying to create already exist. use the -f flag to make it overwrite the files

  • Guest - Ian

    1. Looking a the ordering above, you are suggesting that it's ok to install the AMD driver _after_ compiling cgminer?
    2. I ask, as after running cgminer, I get
    “OpenCL……………: Detection overrided. GPU mining support DISABLED"
    So I was thinking that it was unable to detect my card due to drivers not being installed/correct.
    3. I can force the option true with “–enable-opencl” when using autogen & configure, but that results in "cgminer -n" itself to not run with
    [2014-02-19 01:13:29] CL Platform 0 vendor: Advanced Micro Devices, Inc.
    [2014-02-19 01:13:29] CL Platform 0 name: AMD Accelerated Parallel Processing
    [2014-02-19 01:13:29] CL Platform 0 version: OpenCL 1.2 AMD-APP (1214.3)
    [2014-02-19 01:13:29] Error -1: Getting Device IDs (num)
    [2014-02-19 01:13:29] clDevicesNum returned error, no GPUs usable
    [2014-02-19 01:13:29] 0 GPU devices max detected
    (I have a Ubuntu 13.10 & a R9 290)
    Any help much appreciated!

  • Ian, the steps above will work fine, even if cgminer is compiled first. When compiling Cgminer 3.7, you must include the --enable-opencl (like stated above).
    After the installation of the GPU driver, you must initialize it:

    sudo aticonfig --adapter=all --initial

    After that, the command cgminer -n should result with no errors. Hope that sheds some light. Let me know how it works.

  • Guest - Barretto

    Hi. After install I reboot and when back to the system the video it's not working properly I can't see the mouse cursor and the background is black. Do you know a command at terminal to change config back? Thanks for the tutorial btw

  • I need more information. Can you explain the problem in more detail? Give specifics like linux & AMD driver versions etc...

  • Guest - goblin

    Hi there, i used your tutorial and i get the miner to work somehow. I also have 2x HD7970 Saphire DualX. The only problem is i can't get more than 420 kH/s on each card. I tried to change parameters, but that didn't help too much. I use the same config as you, and the hardware is almost the same... what could be the problem?

  • Guest - dave

    sudo tar xvzf /home/username/AMD-APP-SDK-v2.8.1.0-lnx32.tgz
    [email protected]:/$ sudo tar xvzf/home/dave/AMD-APP-SDK-v2.8.1.0-lnx32.tgz
    tar: Old option `f' requires an argument.
    Try `tar --help' or `tar --usage' for more information.
    [email protected]:/$

    essed up i downloaded everything for it to not workat install why make one that doesnt work

  • Are you saying the AMD SDK does not work for you? What have you installed/downloaded so far?

  • Guest - Voytek

    OK, i downloaded cgminer-3.7 , but when i do ./configure --enable-scrypt --enable-opencl
    i get :
    bash: ./configure: No such file or directory
    of course i am doing that in the cgminer-3.7 directory, there is a file
    any help would be appreciated

  • Guest - goblin

    Guest - Voytek

    first of all rename it to "configure" and then chmod +x

  • You are entering the entire command line? Can you copy & paste the input & output when you run this command?

    CFLAGS="-O2 -Wall -march=native -I/opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/include" LDFLAGS="-L/opt/AMD-APP-SDK-v2.8.1.0-RC-lnx32/lib/x86" ./configure --enable-opencl --enable-scrypt

  • Guest - voytek


    after you download cgminer-3.7 and cd into the cgminer-3.7 directory
    you have to run ./
    only after that you can run ./configure --enable-opencl --enable-scrypt

  • Guest - rbotz204

    when i get to the downloading cgminer 3.7 i get the following message.

    i get the follwoing error message.
    fatal: repository '' not found

    any suggestions?

  • Guest - Voytek

    Guest - rbotz204

    go to and download the .zip
    there is a download .zip button on the right

  • Guest - Aesadai

    Linux has been such a pain.... I think the thing to do at this point if you want to mine in Linux is to boot off of a usb drive with it all set up already.... LTCRabbit has a really nice set up with instructions

  • Guest - LaloHao

    I keep getting this error.
    [2013-12-11 11:41:55] cgminer: --scrypt: unrecognized option

    I did:
    git clone 3.7
    cd 3.7
    ./configure --enable-scrypt
    sudo make
    sudo make install

    what could possibly be wrong? (besides my lack of knowledge about the subject lol)

  • I will rewrite the parts of this tutorial that have changed, but until then. If you are using 3.7, you must add the following (as you have above)

    ./configure --enable-scrypt --enable-opencl

    Let me know if that works.

  • Guest - Aesadai

    This doesn't seem to work when I use "./cgminer -n" because that is not recognized in the latest cgminer that got downloaded by following these instructions. Any idea how to do this with CGMINER 3.8.4 or do I need to unistall and go to an earlier version?

  • I apologize, I need to update the tutorial. The developer removed the GPU function in Cgminer 3.8+. In order to use Cgminer, you will need to download 3.7 or below. Should be here:
    Hope that helps!

  • Guest - Aesadai


    I wish it did help :(

    I've tried this a few different ways and it always says that -n is not a recognized command. An updated version would really be fantastic!


  • Tutorial has been updated to include Cgminer changes

  • Guest - Jaap

    Did you actually try to scrypt mine with this? I had it working with my HD7950, catalyst 13.4, but had to switch to catalyst 13.8 because my LMDE upgraded to a 3.10 kernel, which isn't supported by 13.4. Now my screen gets garbled and I get HW errors. Looks like the scrypt kernel uses the same video memory as the X-Server or something like that.

  • Yes, this tutorial was from a fresh OS install, cgminer build, and then scrypt mining.
    I had similar issues when I tested using Fedora 19. Screen garbled etc... Maybe your LMDE is exhibiting the same. That's why I went back to Ubuntu/Xubuntu. Seems more stable.
    This is what I found on LMDE & ATI. This may not be an exact fix with LMDE & this tutorial, but it might help. Let me know if you can't get it working.

Leave your comments

Post comment as a guest

0 / 1000 Character restriction
Your text should be in between 10-1000 characters
Your comments are subject to administrator's moderation.

Popular Articles

How to configure Cgminer to mine bitcoin, and litecoin. System details Motherboard: Gigabyte 990FXA-UD3 Processor: AMD FX 4100 4-Core Processor Memory/RAM: Gskill Ripj...
Rate this blog entry:
For those of us Windows (or Apple) users, Linux can be daunting at first.  It's the wild west of operating systems.  In many ways is far superior than it's Microsoft and Apple counterpart...
Rate this blog entry:
How to configure Cgminer to mine bitcoin, and litecoin. This seems to be a popular issue with mining crypto-currencies.  There are many nuances to get your mining configuration correct, an...
Rate this blog entry:
How to buy Litecoin I often get this question from people interested in litecoin, but don't know exactly how to buy them.  Litecoin is faster version of bitcoin that uses a more memory int...
Rate this blog entry: