Bitcoin Mining with Ubuntu

Tech Rescue Labs recently got a Butterfly Labs branded ASIC to “mine” Bitcoins. This is how we set it up using an old Intel Atom based EEE Box and Ubuntu 12.04

Once you get Ubuntu installed, it takes a few minor configurations to get it working.

Add SSHD for remote administration and Screen for detaching the session
sudo apt-get install openssh-server
sudo apt-get install screen

Add a Personal Package Archive that some gentlemen have created for ASIC mining.
add-apt-repository ppa:unit3/bfgminer

Update Apt repositories, including the new PPA and Install.
apt-get update
apt-get install bfgminer

The following command will add it to /etc/modules so it shows up on reboot
modprobe ftdi_sio

We then created the bash file to run bfgminer and connect to our mining pool (Eclipse, in our case).
nano miner.sh and add the following:

#!/bin/bash
bfgminer -o us3.eclipsemc.com:3333 -u username_worker -p password

We saved this to /usr/bin/ so any user account can make use of it. We also had to make it executable.
sudo chmod +x /usr/bin/miner.sh

After the bash file was tested as working, we had to make it start automatically on reboot and run both interactivley and non-interactively. This was accomplished using another bash script that has “screen” call /usr/bin/miner.sh.

#!/bin/bash
screen -S miner -d -m su – username /usr/bin/miner.sh

We moved this to /etc/init.d and made it executable as well.
sudo chmod +x /etc/init.d/start_miner.sh

To have this start with the computer we added a link to /etc/rc3.d.
ln -s /etc/init.d/start_miner /etc/rc3.d/S99start_miner

As far as I know, this should work on any Ubuntu version that supports PPAs (Personal Package Archives). Also, I heard somewhere that future versions of Ubuntu will have some or all of this built in so the only needed would be to create the startup scripts.

Leave a Reply

Your email address will not be published. Required fields are marked *