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