Complete Guide To Mine Bitcoin on Xubuntu12.04

  • Upload
    dkg567

  • View
    219

  • Download
    0

Embed Size (px)

Citation preview

  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    1/12

    Complete Guide To Mine

    Bitcoin on Xubuntu 12.04

    -- by Leonard Huang([email protected])

    -- Latest version could be found on http://goo.gl/vP3G9

    -- If you think this article is useful to you, please make a donation to:

    1M1mB5BQX5QthTojfHxXxJQJr8ro5xLcKR

    Firstly, Id like to thank Kanoi, who wrote an excellent howto guide on How to setup a cgminer

    using xubuntu 11.04 live on a USB. However, I dont need to mine on a USB (its slow

    compared to a HDD). Also, his guide didnt update with the latest version of Xubuntu (12.04),

    which in my opinion is the easiest version of Xubuntu ever to mine bitcoin with. Although its

    relatively easy, there are still some pitfalls I want to you to avoid, so I wrote this guide.

    I had been mining Bitcoin since July, 2011. I had used Windows 7 for mining until May, 2012.

    The reason I use Windows 7 is as the following:

    1. AMD driver got better support on Windows.

    2. Much more overclock tools on Windows(MSI AfterBurnerrocks!).

    3. Less time wasting on trouble shooting.

    4. With (3), I can focus on tweaking the best CPU/MEM clock combination for maximizing

    profit.

    I had tried to switch to a headless Linux solution but failed, due to the following problems:

    1. My machine constantly crashed after operating 3 hours.

    2. The lan port on my motherboard didnt get support well on Linux at that time(r8169 on a

    Gigabyte motherboard - buggy driver on Ubuntu 11.04 and 11.10).

    3. I wasted 5 days struggling on troubleshooting linux problems. Not worth it.

    I decided to give Xubuntu 12.04 a try, since Ive heard that 12.04 is not only getting

    Long-Term-Support, but also fixing various bugs since 11.04 and 11.10.

    The result is amazingly great! My machines never crash anymore!

    Enough for my experience. Lets move on.

    http://www.google.com/url?q=http%3A%2F%2Fevent.msi.com%2Fvga%2Fafterburner%2Findex.htm&sa=D&sntz=1&usg=AFQjCNHbwJhn5Ecq7xNKXQ0_rOYq9YfLoQhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fkanoi%2Flinux-usb-cgminer%2Fblob%2Fmaster%2Flinux-usb-cgminer&sa=D&sntz=1&usg=AFQjCNGriE8wJiMTwiSlWKuriq0j3H5wGwhttp://www.google.com/url?q=http%3A%2F%2Fevent.msi.com%2Fvga%2Fafterburner%2Findex.htm&sa=D&sntz=1&usg=AFQjCNHbwJhn5Ecq7xNKXQ0_rOYq9YfLoQhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fkanoi%2Flinux-usb-cgminer%2Fblob%2Fmaster%2Flinux-usb-cgminer&sa=D&sntz=1&usg=AFQjCNGriE8wJiMTwiSlWKuriq0j3H5wGwhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fkanoi%2Flinux-usb-cgminer%2Fblob%2Fmaster%2Flinux-usb-cgminer&sa=D&sntz=1&usg=AFQjCNGriE8wJiMTwiSlWKuriq0j3H5wGwhttps://www.google.com/url?q=https%3A%2F%2Fbitcointalk.org%2Findex.php%3Faction%3Dprofile%3Bu%3D36044&sa=D&sntz=1&usg=AFQjCNEH_QgHB0pUeQkGBBbpdeSS_QTnqwhttp://goo.gl/vP3G9mailto:[email protected]
  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    2/12

    Table of Content

    Pre-stage - Installation Media

    Install Xubuntu 12.04

    Install AMD Driver on Xubuntu

    Config AMD Driver

    Install SSH for remote login

    Install CGMinerFurther reading

    Install Bitcoin 0.6.2 on Xubuntu (optional)

  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    3/12

    I. Pre-stage - Installation Media

    The first thing you need is a USB to load Xubuntu in (Yap, a USB is still

    essential to get rid of CD-ROMs).

    Then, download Unetbootin to load your Xubuntu CD image on the USB.

    Now youre ready to roll!

  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    4/12

    II. Install Xubuntu 12.04

    Try follow this article: The Perfect Desktop - Xubuntu 12.04 until you get a working desktop.

    http://www.google.com/url?q=http%3A%2F%2Fwww.howtoforge.com%2Fthe-perfect-desktop-xubuntu-12.04&sa=D&sntz=1&usg=AFQjCNHe9vEuL7ZIbg2K-C2q3gcLJWKjBQ
  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    5/12

    Remember to check Log in automaticallywhen you create a superuser.

    Well need a logged user to mine headlessly.

    Oh! You forget to check the option?

    Thats all right, you can edit the /etc/lightdm/lightdm.conf like this after installation.

    [SeatDefaults]

    autologin-guest=false

    autologin-user=

    autologin-user-timeout=0

    autologin-session=lightdm-autologin

    greeter-session=lightdm-gtk-greeteruser-session=xubuntu

  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    6/12

    III. Install AMD Driver on Xubuntu

    Caution: Choose your driver wisely, or youll lose 10% ~ 20% hash power!

    [ For AMD Raedon 7xxx Series ]

    If any of your cards on board is AMD Raedon 7xxx Series cards, youll need AMD APP

    SDK 2.6+, which is included in Catalyst 11.12+ and beyond1

    (I recommend Catalyst 12.3 - which include SDK 2.6).

    Reason: 7xxx Series use some kind of new architecture called GCN, which can

    only be recognized with SDK 2.6+.

    Now follow the steps (in commandline):

    (Dont use the GUI (Settings -> Additional drivers) to install thepost-releasedriver. It will fail and I

    dont know why.)

    sudo apt-get install fglrx-updatesfglrx-amdcccle-updates fglrx-updates-dev

    Done!

    [ For AMD Raedon 6xxx, 5xxx Series ]

    If you dont have any AMD Raedon 7xxx Series cards (like 6xxx, 5xxx), you should use

    SDK 2.5, which is included in Catalyst 11.7 ~ 11.11.

    (Recommend Catalyst 11.11)

    Reason: Non-7xxx Series with SDK 2.6 will lose about 10% performance.

    Now follow the steps .2

    Install the prerequisite packages:

    sudo apt-get install build-essential cdbs dh-make dkms execstack dh-modaliases

    fakeroot libqtgui4

    If you are using the x86_64 architecture (64 bit):

    sudo apt-get install ia32-libs-multiarch:i386 lib32gcc1 libc6-i386

    sudo apt-get install ia32-libs

    1Complete Table of the relationship between Catalyst and APP SDK could be found on AMD website2Thanks for the instruction on Unofficial Wiki for the AMD Linux Driver

    http://www.google.com/url?q=http%3A%2F%2Fwiki.cchtml.com%2Findex.php%2FUbuntu_Precise_Installation_Guide&sa=D&sntz=1&usg=AFQjCNFFeQyUXS9wqf8fL-74qrydB0rNTAhttp://www.google.com/url?q=http%3A%2F%2Fdeveloper.amd.com%2Fsdks%2FAMDAPPSDK%2Fpages%2FDriverCompatibility.aspx&sa=D&sntz=1&usg=AFQjCNFIBx2TQbvE-PW1QLIbZnwE8W3lZg
  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    7/12

    Compile and install the driver:

    wget http://www2.ati.com/drivers/linux/ati-driver-installer-11-11-x86.x86_64.run

    sudo sh ./ati-driver-installer-11-11-x86.x86_64.run --buildpkg Ubuntu/precise

    sudo dpkg -i fglrx*.deb

    Done!

    IV. Config AMD Driver

    Check if all your cards can be detected and then write configuration to /etc/X11/xorg.conf.

    aticonfig --lsa

    sudo aticonfig --adapter=all --initial

    If everything went fine, reboot the computer by sudo reboot.

    After that, check if everything works:

    sudo aticonfig --adapter=all --odgt

    V.Install SSH for remote login

    Install openssh-serverand byobu to perform remote login.

    sudo apt-get install openssh-server byobu

    Now you can pull out the cables of your monitor, mouse and keyboard and enjoy a headless

    Xubuntu!

  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    8/12

    VI. Install CGMiner

    Go to CGMINER on bitcointalk pageand download the latest versionof cgminer.

    Or on the command line:

    wget http://ck.kolivas.org/apps/cgminer/cgminer-2.9.5-x86_64-built.tar.bz2

    Then unzip it to a directory.

    tar jxvf cgminer-2.9.5-x86_64-built.tar.bz2

    Note: If you got libcurl4 error, install the lib:

    sudo apt-get install curl

    Go to the directory and check if cgminer detects all your cards.

    cd cgminer-2.9.5-x86_64-built

    export DISPLAY=:0

    export GPU_USE_SYNC_OBJECTS=1

    ./cgminer -n

    The correct result should show like the left diagram..

    Note that both the OpenCL and the ADL

    detects 4 devices.

    Note that the ADL cant be initialized.(you forgot to setexport GPU_USE_SYNC_OBJECTS=1)

    http://www.google.com/url?q=http%3A%2F%2Fck.kolivas.org%2Fapps%2Fcgminer%2Fcgminer-2.4.2-x86_64-built.tar.bz2&sa=D&sntz=1&usg=AFQjCNHDcVfSRywe5RmVEMNG1575gzH1Kghttps://www.google.com/url?q=https%3A%2F%2Fbitcointalk.org%2Findex.php%3Ftopic%3D28402.0&sa=D&sntz=1&usg=AFQjCNG5umLQd2-nAnJm9JoSCszOiRA4Ng
  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    9/12

    Write a script for your favorite mining pool:

    Ordinary pool

    (like deepbit, BTC Guild, OzCoin, etc.)

    #!/bin/shexport DISPLAY=:0

    export GPU_USE_SYNC_OBJECTS=1

    cd /home//cgminer-2.9.5-x86_64-built

    ./cgminer -o http://:-u -p

    --api-listen --api-network -I 9--gpu-reorder --auto-fan --gpu-powertune 20--gpu-engine 920,920,920,1125--gpu-memclock 795,795,795,975

    P2Pool

    You can mine at my pool for testing: http://btcm.dyndns.org:9332/

    Or try any of the public available p2pool instances. Remember to replace with your BTC addresswhere the

    payments are to be sent

    #!/bin/sh

    export DISPLAY=:0

    export GPU_USE_SYNC_OBJECTS=1

    cd /home//cgminer-2.9.5-x86_64-built

    ./cgminer -o http://:-u -p

    --api-listen --api-network -I 8-g 2--gpu-reorder --auto-fan --gpu-powertune

    20 --gpu-engine 920,920,920,1125--gpu-memclock 795,795,795,975

    http://www.google.com/url?q=https%3A%2F%2Fbitcointalk.org%2Findex.php%3Ftopic%3D66182.0&sa=D&sntz=1&usg=AFQjCNFxuMMalyX7hV7Nexf6e_eehugiAQhttp://www.google.com/url?q=http%3A%2F%2Fbtcm.dyndns.org%3A9332%2F&sa=D&sntz=1&usg=AFQjCNHgqst8e1A_gAqtYPPg_UFLrvL5jwhttps://www.google.com/url?q=https%3A%2F%2Fbitcointalk.org%2Findex.php%3Ftopic%3D18313.0&sa=D&sntz=1&usg=AFQjCNGU1qiKWlhOad90pjnml3OcORKVDQ
  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    10/12

    Save it as a file and change the permission to execute it.

    nano cg.sh

    chmod +x cg.sh

    ./cg.sh

    You now have a headess bitcoin mining machine! Just SSH to your machine with byobuand

    execute you script.

    byobu

    ./cg.sh

    You can safely press F6 and exit since your mining session will be kept in byobu.

    -- If you think this article is useful to you, please make a donation to:

    1M1mB5BQX5QthTojfHxXxJQJr8ro5xLcKR

  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    11/12

    VII. Further reading

    P2Pool

    If you want to setup a private p2pool:

    https://bitcointalk.org/index.php?topic=62842.0

    If you dont waste your time on setting up p2pool, you can test on my p2pool

    node:

    http://btcm.dyndns.org:9332/

    username:

    password:

    Exchange

    If you want to buy or exchange Bitcoin with the following currency company, you

    can use my affiliate link ofAurumXchange. It is the official partner of Mt. Gox to

    transfer Bitcoin to LibertyReserve.

    Liberty Reserve

    MTGox

    Perfect Money

    CryptoXchange PecUnix

    Vouchx

    HDMoney

    Cosmicpay

    C-Gold

    SolidTrustPay

    http://goo.gl/gJqZS

    http://goo.gl/gJqZShttp://goo.gl/gJqZShttp://www.google.com/url?q=http%3A%2F%2Fbtcm.dyndns.org%3A9332%2F&sa=D&sntz=1&usg=AFQjCNHgqst8e1A_gAqtYPPg_UFLrvL5jwhttps://www.google.com/url?q=https%3A%2F%2Fbitcointalk.org%2Findex.php%3Ftopic%3D62842.0&sa=D&sntz=1&usg=AFQjCNGtxJUWY4Irq-urC4UY679pMuE73A
  • 8/10/2019 Complete Guide To Mine Bitcoin on Xubuntu12.04

    12/12

    VIII. Install Latest Bitcoind on Xubuntu (optional)

    If you want to run bitcoin daemon on your Xubuntu system, open your terminal and installpackages by typing the following commands :3

    sudo apt-get install python-software-properties

    sudo add-apt-repository ppa:bitcoin/bitcoin

    sudo apt-get install bitcoind

    Now you have the latest version of bitcoind installed. Pretty easy, right?

    -- If you think this article is useful to you, please make a donation to:

    1M1mB5BQX5QthTojfHxXxJQJr8ro5xLcKR

    3Follow the instruction of an excellent answer on AskUbuntu

    http://www.google.com/url?q=http%3A%2F%2Faskubuntu.com%2Fquestions%2F55478%2Fhow-can-i-install-add-apt-repository&sa=D&sntz=1&usg=AFQjCNEvo5KNBjj_7-p6jfLaRHN3V_E9Qg