CPU Mining on a Raspberry Pi | xmrig

CPU Mining on a Raspberry Pi  (XMRig)

Originally published at blog.ijasoneverett.com on  

Monero is one of the most profitable cryptocurrencies that can still be mined using a CPU. Unlike other cryptocurrencies that rely on specialized hardware, you can mine XMR (RandomX) using your computer or, in this case, a raspberry pi. With that said if you’re going to use your raspberry pi to mine Monero don’t expect to get rich doing so. This is more of a learning experience if you have a spare raspberry pi lying around or if you simply want to support the coin.

To get started, you should already have Raspian running on your pi. If you haven’t done so already I suggest you follow one of the many tutorials out there. Its your choice whether you choose to have a monitor, keyboard and mouse attached to your pi or if you prefer to go headless and utilize SSH. I prefer the latter but this tutorial can be done either way. We’re going to be using XMRig to mine Monero with a mining pool. XMRig only runs on 64-bit so we’ll be using a 64-bit container called raspbian-nspawn-64

First let’s make sure you’re raspberry pi is up to date. Using terminal lets run the following commands:

sudo apt update
sudo apt full-upgrade

For good measure, lets run clean up to free up some space:

sudo apt-get clean

Reboot if necessary:

sudo shutdown -r now

Once you’re pi is up to date, we can get started installing raspbian-nspawn-64 using the following command: **Note!! Inorder for you to be able to perform the below commands you will need to be on 64-bit

sudo apt-get install -y raspbian-nspawn-64

If you’re not currently using the official 64-bit kernel, you’ll be prompted to enable it during installation. Select Yes and you should be prompted to reboot afterwards. If you were already using the 64-bit kernel then a reboot isn’t necessary. Once everything is installed and you’ve rebooted if necessary, you can start using the 64-bit container with the following command:



To return to 32-bit simply type exit. You can toggle between 32-bit and 64-bit with these commands.

Now let’s install XMRig from within your 64-bit shell. First you’ll need to install all the dependencies.

sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev

Once thats finished with hopefully no errors run the following commands: **Note!! Inorder for you to be able to perform the below commands you will need to be on 64-bit

git clone https://github.com/xmrig/xmrig.git
cd xmrig
mkdir build
cd build
cmake ..

The build process can take some time to complete so be patient. After installation the next step is to choose a mining pool and start mining. I choose supportxmr because of their low pool fee but feel free to choose what best works for you. 

To start mining type: 

./xmrig --donate-level 1 -o pool.supportxmr.com:3333 -u 41nQCM9dLAH5NYycB46pfcUc85UpHkXY11gRDeSfh3rJQ5bKGXjtTrxiwyZfKJehjKeoyBRKpYo6gWqF1Jrsp17dFbMq9B3 -p YourWorkerName

Make sure you run this from the build folder. If you aren’t already there then type


cd xmrig/build

–donate-level can be set to whatever you feel like donating to the pool.
-o is the URL of your pool.
-u should be your Monero wallet address. Make sure to change that to your address or else you’ll be giving to me free XMR!
-p stands for password but since SupportXMR doesn't require a password, this is used to identify your worker so give it a unique name.

That's all you need to get started mining Monero on your Raspberry Pi.

For other XMRig options use 

./xmrig -h

Below is the outcome screenshot to show you that it has started mining