2018: End-to-end simple instructions on how to set up a raspberry pi 3 altcoin miner

in altcoin •  7 years ago  (edited)

This post comes after a lot of Googling and finding quite outdated information online that just let to more Googling. I've documented the steps I followed from start to finish on how I successfully got my Raspberry Pi 3 up and running mining altcoins, to hopefully save time for others reading this.

1. Sign up to MinerGate

Go to https://minergate.com/ and create an account. You'll need your email address and password later on.


2. Installation

Run these commands:

sudo apt-get update -y
sudo apt-get install autoconf libcurl4-openssl-dev libjansson-dev openssl libssl-dev gcc gawk
git clone https://github.com/tpruvot/cpuminer-multi
cd cpuminer-multi
./autogen.sh
./configure --with-crypto --with-curl
make

Any errors in the above commands, and uncle Google will sort you out.


3. Test Run

You should now be in the cpuminer-multi folder. Run the following command, but change the uppercase params to your MinerGate details. This will start the cpuminer to mine XMR (Monero). You can run cpuminer --help for more info on the parameters. If this fails to run, off you go Googling. If you start seeing debug logging info you're good. After a few minutes, check your MinerGate account - the Dashboard should soon show your one worker diligently mining away.

./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u YOUR_MINERGATE_EMAIL_ADDRESS -p YOUR_MINERGATE_PASSWORD -t 4


4. Let It Run

The problem with the command above, is the moment you kill your Raspberry Pi session (this assumes you've SSH'd in), your cpuminer will also be killed. That's no good.

We can use the nohup command to keep it running as a background process. Kill the process above (either by exiting your session and logging back in, or ps -ef | grep cpuminer, find the process number, and kill -9 it). Then run:

nohup ./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u YOUR_MINERGATE_EMAIL_ADDRESS -p YOUR_MINERGATE_PASSWORD -t 4 &

The nohup command writes the output of your ./cpuminer command to a nohup.out file. So, if you ls in the cpuminer-multi folder, you'll see this nohup.out file containing all the output of the miner. Obviously this will become a problem as it grows and grows. 


5. Housekeeping

At this point I spent some time trying to work out how to stop this output into the nohup.out file through various > /dev/null commands and variants and lots of Googling, but nothing seemed to work successfully - some commands appeared to work, but the miner wouldn't actually start.

Hence, I've just gone the logrotate option - these instructions will rotate the nohup.out file each day, and delete the previous day's.

Run:

sudo nano /etc/logrotate.conf

Go to the end, and add the following - this assumes you followed the steps above, and hence the cpuminer-multi folder is located under ~ (/home/pi) - if not, change the path to the nohup.out file accordingly:

/home/pi/cpuminer-multi/nohup.out { 
  daily
  rotate 1
  missingok
}


6. Temperature of the Raspberry Pi

After an hour or so, concerned about the temperature the Pi might get to, I ran

cat /opt/vc/bin/vcgencmd measure_temp

to see current temperature. It had gone from the usual 55 degrees celcius, to about 75.  I decided that I'd like to be notified by email when the temperature exceeds 80 degrees. 

Under /home/pi/Desktop, I ran:

nano check_temp.sh

Contents of the file are below,  but note this assumes you've set up the mailer on your Raspberry Pi - if you haven't, off to Uncy Google you go.

temp=$(/opt/vc/bin/vcgencmd measure_temp | tr -dc '0-9')
a=$temp
b=800

if [ "$a" -gt "$b" ];
then
    echo "high temp";
    /opt/vc/bin/vcgencmd measure_temp > /home/pi/Downloads/systemp
    mail -s 'Raspberry Pi System Temperature' YOUR_EMAIL_ADDRESS < /home/pi/Downloads/systemp
fi

Then run a 

chmod +x check_temp.sh

to make it executable, then added it to my crontab to run every four hours:

crontab -e

and added the following to the bottom:

0 */4 * * * /home/pi/Desktop/check_temp.sh 


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

this sounds good but can you mine with 6 gpu rig nvidia 1060 gtx 6gb what do you think im asking bzc i have some rigs and looking to maximize earnings from mining thanks for the post tho

Congratulations @pman! You received a personal award!

1 Year on Steemit

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @pman! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!