How to Mine Monero Crypto Currency on your Raspberry Pi
You probably already asked yourself about mining with your Raspberry Pi.
Now that Bitcoin is becoming very hard to mine, Monero is the new Bitcoin.
In this tutorial you’ll learn how to mine Monero on Raspberry Pi.
Mining Monero on Raspberry Pi is easy when you have good tools.
You can download and install a miner for free, to start mining a few minutes later.
You also need an account on a mining pool to do this (I’ll show you how).
So, let’s start learning a little more about this topic.
I’ll start with a short introduction about cryptocurrencies, Monero and mining pool.
Then we’ll see how to install a miner on your Raspberry Pi.
And finally, we’ll talk a little about profitability when mining on Raspberry Pi.
What is Monero?
Crypto currencies reminder
A cryptocurrency is a decentralized digital currency.
This means that it isn’t managed by banks and states.
It’s a recent concept, and the first cryptocurrency was Bitcoin in 2009.
As it is decentralized, it allows anyone to be a part of the chain.
By being a part of the network, you lend your device resources to the community to help the network.
And the system can reward you, it’s what we call a miner.
The more resources you have, the more cryptocurrency you’ll get.
Monero
Monero is one of these cryptocurrencies, created in 2014.
I chose Monero for this tutorial, rather than Bitcoin because it’s easier to get something.
In the Bitcoin network, there are big miners, and most of the time you can’t get anything with a standard computer.
So, with a Raspberry Pi it’s even worse …
The advantage of Monero is that normal people with a classic CPU can help to get rewards.
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
Just $75 can create educational opportunities for a child in need.
Mining pool
Just a few words about the mining pool as we’ll use it later.
A mining pool is simply a network of miners.
When a block is found in a pool, all miners get rewarded depending on how they helped the entire network achieve this.
How to install a miner on your Raspberry Pi
Now that the vocabulary is clear, we can move on to the installation process.
You’ll get better result with a high-end Raspberry Pi model (I’m using this one for this tutorial), but any model should work if you just want to test it.
Create a MinerGate account
The first thing you need to do is to get access to a mining pool.
I recommend creating a MinerGate account.
It’s simple and you can use it anywhere, not only on Raspberry Pi.
- Go to the MinerGate registration form.
- Fill out the form.
- Confirm your email and log into your account.
- On the Dashboard, you can check which currency you are currently mining and your winnings.
We’ll check that later. - In the main menu, click on Mining Pools > Monero.
- Scroll down the page to the mining pool information:
- Keep this information safe, you’ll need it later.
Install Raspberry Pi OS
If you already have Raspberry Pi OS on your Raspberry Pi, you can move to the next paragraph.
If not, you can check my post on how to install Raspberry Pi OS and come back here later.
Once you have Raspberry Pi OS installed, the Internet configured and SSH enabled, you can move to the miner installation.
Install the Monero miner
To mine Monero, we’ll use the cpuminer-multi tool from Tanguy Pruvot.
You can check the GitHub project here.
Follow these steps to install it on your Raspberry Pi:
- I recommend connecting to the Raspberry Pi via SSH.
So you can just copy/paste commands from this page. - Update your system:
sudo apt update
sudo apt upgrade
- Install all needed dependencies:
sudo apt install git automake autoconf libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev
- Go into the folder you want to install in and run these commands:
cd /opt
sudo git clone https://github.com/tpruvot/cpuminer-multi
cd cpuminer-multi - You can do the compilation and installation with:
sudo ./autogen.sh
This can take some time on Raspberry Pi.
sudo ./configure
sudo ./build.sh
After this, your miner is ready to use.
Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.
Run it
The executable name is “cpuminer”.
I give you the entire command here:./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u YOUR_EMAIL
Replace YOUR_EMAIL with the email address you use to login on MinerGate.
Your password is not required.
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
A few seconds later, the mining process starts:

If you go back to the MinerGate dashboard, you can see the miner online.
That’s it, you’re mining on your Raspberry Pi!
Thoughts about mining on Raspberry Pi
Profitability
After this little excitement, let’s get back to reality.
In this profit calculator, we can convert H/s into profit estimation.
Even if I remove the electricity cost, with a 2H/s ratio, you won’t earn anything on Raspberry Pi 3B+.

This simulation shows us a $0.27 gain after one year.
If you consider the $35 of the Raspberry Pi (minimum), and the electricity cost (probably around $0.10 a week), you’ll lose money by mining Monero on your Raspberry Pi. That’s why I recommend other options to make money with a Raspberry Pi in this article, as crypto-mining is not the best choice.
And even if you can get a free Raspberry Pi and free electricity, this is not a good deal.
Raspberry Pi 4 has more hashing power (about 12H/s), but still not enough to make you rich :).
Building a Raspberry Pi cluster might seem a good idea to get better results, but it wouldn’t be more profitable if you look at the profit/power ratio.
Combine your passions and get paid. Write for RaspberryTips!
Education
Even if it’s not profitable, you can learn many things by installing a miner on your Raspberry Pi.
It doesn’t cost a lot and the installation is rather easy, so it’s a good first step in the cryptocurrency world.
You can now try it on bigger devices and win a little with cryptocurrencies 🙂
Video
If you prefer, here is a video I made on my YouTube channel to explain the steps to mine Monero on Raspberry Pi:
Related questions
My Raspberry Pi is heating when mining, what can I do? The mining process takes all the power of your CPU, so heating is normal to see. If you want to avoid this, you can mine with less CPU, by adding the -t option to the cpuminer command (“-t 2” for example, t stands for threads).
How to use MinerGate on other platforms? Create an account on MinerGate, then click on “Downloads” in the main menu. Choose the download file corresponding to your computer operating system (Windows/Mac/Ubuntu) and GPU, then install it. You’ll get a better rate on your computer. Here is an example on my laptop:
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.
Conclusion
That’s it, you now know how to mine a cryptocurrency (Monero here) with your Raspberry Pi, and on any Linux system.
I’m not an expert in cryptocurrency, so if you see some mistakes or have other suggestions for readers to enjoy this post, feel free to contact me.
If you want to try other cryptos with another miner, you can read my recent article on how to mine Dogecoin on Raspberry Pi.
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
Additional Resources
Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.
Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.
VIP Community
If you just want to hang out with me and other Raspberry Pi fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.
Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.
You can also find all my recommendations for tools and hardware on this page.
Good day,
I dont know exactly when was this posted but i got a message on my Pi that (libcurl4-openssl-dev) was not found, any ideas on how to proceed?
Thanks,
J
Hi Jose,
This package is available in the Raspbian repository
Did you try “apt install libcurl4-openssl-dev” ?
Hey! I’m getting this:
sudo: ./build-linux-arm: command not found
Any thoughts? I googled but was unsuccessful.
Hi kurt,
Could you try ./build-linux-arm.sh ?
That’s the file full name
Let me know, so I can edit the command in post
Hi
Have the same issue as Kurt, I tried ./build-linux-arm.sh but still same message: no such file or directory
Hello,
Can you try ./build-linux-arm.sh ?
If it’s ok I will edit the post
On Github there is a file named build-linux-arm.sh, so it should be that
with .sh it work.
Thanks for the notes..
Hi, I have been trying to do this on multiple websites, but all have been unsuccessful. None of the commands are working. Not even apt-get update. It runs for a while, but then returns a bunch of 404 errors. Any ideas?
Hi, Thanks for the awesome post first.
I started mining Monero as this tutorial, but I always got “invalid shares” on Dashboard.
Any ideas about this issue?
Hi,
Nope no ideas
And I tried this tutorial this week on Raspberry Pi 4 to see if the results are better and I didn’t see major issues with Buster
Are you using Minergate or another pool?
With Minergate you can probably ask them
check this link: https://minergate.com/faq/invalid-shares
Hi Herman, is there any chance you’d be able to upload an image of your setup. I’ve been trying to get this working for ages, have had to reinstall raspian from scratch 5-6 times. If you’ve got it working I’d be so grateful for a copy. Obviously, a version which is safe for you to upload, with your wallet info and wifi passwords removed etc. If you can, you can, if you can’t thats fine too. Thanks in advance, Jan
Just feeding back: It also didn’t work for me when I did sudo ./build-linux-arm but it DID work when I did sudo ./build-linux-arm.sh
It definately needs the sh on the end
So far so good.
The final step (sudo ./build-linux-arm.sh) takes about 2 minutes.
While doing sudo ./build-linux-arm.sh, I encountered the following error:
“algo/rainforest.c: In function ‘rf_crc32_32’:
algo/rainforest.c:411:7: error: ‘rf_crc32_table’ undeclared (first use in this function); did you mean ‘rf_crc32_32’?
crc=rf_crc32_table[crc&0xff]^(crc>>8);
^~~~~~~~~~~~~~
rf_crc32_32
algo/rainforest.c:411:7: note: each undeclared identifier is reported only once for each function it appears in
algo/rainforest.c: In function ‘rf_add64_crc32’:
algo/rainforest.c:461:7: error: ‘rf_crc32_table’ undeclared (first use in this function); did you mean ‘rf_crc32_32’?
crc=rf_crc32_table[crc&0xff]^(crc>>8);
^~~~~~~~~~~~~~
rf_crc32_32
make[2]: *** [Makefile:2410: algo/cpuminer-rainforest.o] Error 1
make[2]: *** Waiting for unfinished jobs….
mv -f algo/.deps/cpuminer-pluck.Tpo algo/.deps/cpuminer-pluck.Po
mv -f algo/.deps/cpuminer-neoscrypt.Tpo algo/.deps/cpuminer-neoscrypt.Po
mv -f sha3/.deps/cpuminer-sph_radiogatun.Tpo sha3/.deps/cpuminer-sph_radiogatun.Po
make[2]: Leaving directory ‘/opt/cpuminer-multi’
make[1]: *** [Makefile:2881: all-recursive] Error 1
make[1]: Leaving directory ‘/opt/cpuminer-multi’
make: *** [Makefile:694: all] Error 2
Compilation failed (make=0).
Common causes: missing libjansson-dev libcurl4-openssl-dev libssl-dev
If you pulled updates into this directory, remove configure and try again.”
(31/08/19, clean raspian install, raspberry pi 3B+)
i have the same errors but don’t know what to do
Has there been any resolution to this? I am having the same issue, ending with:
Compilation failed (make = 0)
Common causes: missing libjasson-dev libcurl4-openssl-dev libssl-dev
This software is obsolete
where do you executethe command to run? is it in the cd for cpuminer or just normal??
Not ./build-linux-arm… Just ./build
Same error. Was there ever a fix for this?
Hello,
Just tested this on Buster, and it works perfectly
As Mike wrote, we can now use “./build.sh”
I’ll edit the tutorial immediately to avoid this issue
And yes, you need to be in the correct path to execute the cpuminer command
Or use the complete location: /opt/cpuminer-multi/cpuminer
Hey! I’m getting this:
sudo: ./build-linux-arm.sh: command not found
Any thoughts?
i have tried
./build.sh
./build-linux-arm.sh
all to no luck
Hi Chris,
The command is : sudo ./build.sh
Make sure you’re in the correct folder
This post was updated 3 weeks ago for Buster, so it’s working as explained
Let me know if you have other issues
Hi, I am having problems when running it. When trying to run it I have this error message.
sudo: ./cpuminer.l: command not found
What can I do?
PS: I have a Pi zero V3, what is the hashing power of it?
Hi smoke,
Make sure you are in the correct path before running ./cpuminer
cd /opt/cpuminer-multi if you have followed the tutorial
This post was made on RPI 3, so you should get the same results
Patrick
Hi, I got this working just fine however it appears to crash after a random amount of time like the example below – anyone know what this means? Everything is up to date.
pi@Monero:/opt/cpuminer-multi $ ./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u
** cpuminer-multi 1.3.7 by tpruvot@github **
BTC donation address: 1FhDPLPpw18X4srecguG3MxJYe4a1JsZnd (tpruvot)
[2020-02-03 16:59:16] Using JSON-RPC 2.0
[2020-02-03 16:59:16] CPU Supports AES-NI: NO
[2020-02-03 16:59:16] Starting Stratum on stratum+tcp://xmr.pool.minergate.com:45700
[2020-02-03 16:59:16] 4 miner threads started, using ‘cryptonight’ algorithm.
[2020-02-03 16:59:17] Stratum difficulty set to 2000
[2020-02-03 16:59:39] CPU #3: 3.05 H/s
[2020-02-03 16:59:39] CPU #2: 3.03 H/s
[2020-02-03 16:59:40] CPU #0: 2.96 H/s
[2020-02-03 16:59:40] CPU #1: 2.94 H/s
[2020-02-03 16:59:54] CPU #2: 3.03 H/s
[2020-02-03 16:59:54] accepted: 1/1 (diff 0.000), 11.98 H/s yes!
[2020-02-03 17:00:21] CPU #1: 2.93 H/s
[2020-02-03 17:00:22] CPU #0: 2.91 H/s
[2020-02-03 17:00:43] CPU #3: 2.83 H/s
[2020-02-03 17:00:44] stratum_recv_line failed
[2020-02-03 17:00:44] Stratum connection interrupted
[2020-02-03 17:00:44] CPU #0: 2.68 H/s
[2020-02-03 17:00:44] CPU #1: 2.77 H/s
[2020-02-03 17:00:45] CPU #2: 2.87 H/s
[2020-02-03 17:01:26] CPU #3: 2.96 H/s
[2020-02-03 17:01:26] CPU #2: 2.92 H/s
[2020-02-03 17:01:27] CPU #1: 2.87 H/s
[2020-02-03 17:01:28] CPU #0: 2.80 H/s
[2020-02-03 17:01:35] stratum_recv_line failed
[2020-02-03 17:01:35] Stratum connection interrupted
[2020-02-03 17:01:35] CPU #3: 2.06 H/s
[2020-02-03 17:01:35] CPU #2: 2.48 H/s
[2020-02-03 17:01:35] CPU #1: 2.78 H/s
[2020-02-03 17:01:35] CPU #0: 2.42 H/s
stratum_recv_line failed
any idea what would cause this error?
worked all night without failure
Hi,
If it was working before, it’s probably an issue with the server
Your installation is correct but the server doesn’t work
You may need to try other servers or to contact Minergate
Patrick
stratum_recv_line failed
and is not a pool server issue (same time mining with other PC and their software is all ok)
I’m thinking Minergate won’t support mining from armhf hardwares.
Unable to mine XMR after update
Just got this up and going with zero problems on Raspbian. Very good guide and thank you so much!
Thanks!
Thank you for this! I just got this up and running on my Raspberry Pi 4!
I do have the errors coming up as it is mining… “stratum_recv_line failed” or Stratum connection interrupted” but I figure that is probably my connection. It always keeps going.
Oh, and a tip – When you set up your Minergate account, verify your email before you start mining. Otherwise it doesn’t count you as active.
Well I had it working, but for some reason now it keeps just timing out. Not sure what I did wrong. Too late to figure it out tonight.
I will say this though, make sure you verify your email account before you start mining. Otherwise it counts your shares as “invalid”
Last night I got this running at first, and actually had it running a few hours, but at some point all I get are error messages. Like the commands work, but all it keeps spitting back out at me is
stratum_recv_line timed out
…retry after 10 seconds
I tried updating my system again this morning because I left it running all night, hoping it would get through again, and it looks like it did, but I did a couple times, but I never got any shares on my dashboard after I went to bed. And now it does not even show that I am mining or trying to.
Also, I do not even see the process running if I open another terminal and run htop, even though it is clearly doing something.
Not sure where to check to get it working again, and any insight would be appreciated.
I tried it with my raspberry pi 3 and when i use the ”sudo ./build.sh” the pi reboot and i cant make it work
I was used this miner on my PI for one night with minergate, but I think this miner is too far out of date. As a result of it being so out of date the miner causes a lot of invalid shares resulting in the mining pool to banning you. When you are banned you can connect but the pool will never send you any hashes, so it just sits there like it isn’t working.
I was excited to setup an array of PIs and play around with CPU mining, but I have not been able to find any up to date miner that will work on a PI. I think most coins have gotten too difficult for a PI to handle. 🙁
Hello, I got everything working on Pi 4 B 8GB on the first install, after shutting down the pi i cant seem to get the miner working again. I’m a noob to the pi world and using Raspbian so I’m not familiar with a Linux system. I’m a PC user. How do i start the miner when I turn the pi back on?
Hi Dave,
You need to run the command after each reboot
If you want to run it automatically on boot, you can check this post: https://raspberrytips.com/autostart-a-program-on-boot/
Hello, I have the same problem. When I reboot and go to the path “/opt/cpuminer-multi $” and enter the start command (./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u myemailadress) it only gives errors:
[2021-01-08 23:54:28] Using JSON-RPC 2.0
[2021-01-08 23:54:28] CPU Supports AES-NI: NO
[2021-01-08 23:54:28] Starting Stratum on stratum+tcp://xmr.pool.minergate.com:45700
[2021-01-08 23:54:28] 4 miner threads started, using ‘cryptonight’ algorithm.
[2021-01-08 23:55:28] stratum_recv_line timed out
[2021-01-08 23:55:28] …retry after 10 seconds
[2021-01-08 23:56:38] stratum_recv_line timed out
[2021-01-08 23:56:38] …retry after 10 seconds
And this doesn’t stop anymore. Can you help me or do you know why this is happening. Did I do it wrong?
Anyway, thanks for the tutorial, everything worked smoothly.
Translated with http://www.DeepL.com/Translator (free version)
I am having the exact same problem with my Pi4 8GB. Has there been a fix for this yet? Has anyone else had this problem?
Thanks. 02-15-20221
Hello,
I just tested and updated this tutorial today.
Everything works fine (the MinerGate website was a bit laggy, but probably a temporary issue).
On Raspberry Pi 4, the results are much better, but still no profitability due to electricity cost 🙂
Patrick
Hello,
Can the above code used in Ubuntu Mate on raspberry pi?
Yes probably
hi everyone,
can someone explain me if there is a solution to boot it automatically on start up?
if there is i’m a 100% noob so be gentke, thanks 🙂
Salut Gaëtan,
You can try this tutorial: raspberrytips.com/autostart-a-program-on-boot/
Nice tool to see errors on the screen.
pi@raspberrypi:~ $ cd /opt
pi@raspberrypi:/opt $ sudo git clone https://github.com/tpruvot/cpuminer-multi
Cloning into ‘cpuminer-multi’…
remote: Enumerating objects: 4265, done.
remote: Counting objects: 100% (173/173), done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 4265 (delta 73), reused 167 (delta 73), pack-reused 4092
Receiving objects: 100% (4265/4265), 19.47 MiB | 1.60 MiB/s, done.
Resolving deltas: 100% (2904/2904), done.
Checking out files: 100% (293/293), done.
pi@raspberrypi:/opt $ cd cpuminer-multi
pi@raspberrypi:/opt/cpuminer-multi $ sudo ./autogen.sh
configure.ac:15: installing ‘./compile’
configure.ac:4: installing ‘./config.guess’
configure.ac:4: installing ‘./config.sub’
configure.ac:9: installing ‘./install-sh’
configure.ac:9: installing ‘./missing’
Makefile.am: installing ‘./depcomp’
pi@raspberrypi:/opt/cpuminer-multi $ ./cpuminer -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45700 -u xxx@xxxxxx
-bash: ./cpuminer: No such file or directory
You missed two commands in the procedure (configure and build)
Patrick
Help, it only submits invalid shares! What did I do wrong?
Well its back again
error stratum_recv_line failed and wont work anymore.
Has that issue been fixed or it’s still at it?