Skip to content

How to set up XMRig on a Raspberry Pi

image

Introduction

Mining cryptocurrencies can be an exciting and potentially lucrative endeavor. With the rise of Monero (XMR) as a popular privacy-centric cryptocurrency, more and more people are looking into mining it using low-cost, energy-efficient devices like the Raspberry Pi. In this blog post, we will walk you through the entire process of setting up a Raspberry Pi to mine Monero using XMRig – from the initial setup of the Raspberry Pi to installing and configuring XMRig.

Step 1: Setting Up Your Raspberry Pi

Before we begin mining, let’s first set up the Raspberry Pi. We recommend using the Raspberry Pi Imager to flash the Raspbian 64-bit Lite version onto your Raspberry Pi. Here’s how to do that:

Download the Raspberry Pi Imager from the official website https://www.raspberrypi.org/software/

Install and launch the Raspberry Pi Imager.

Click on “Choose OS” and select “Raspberry Pi OS (other)” followed by “Raspberry Pi OS Lite (64-bit)”.

Click on “Choose SD Card” and select the SD card you want to flash the OS onto.

Click on “Write” to flash the OS onto the SD card.

Keep in mind you need to activate ssh, therefore, adjust the settings before writing to the SD card. Click on the Gear Icon.

Once the process is completed, remove the SD card from your computer and insert it into your Raspberry Pi. Connect your Raspberry Pi to a power supply and a Network Cable. Power it up.

Step 2: Loggin in

Now, you can log in to your Raspberry Pi remotely using an SSH client like PuTTY (Windows) or the terminal (macOS and Linux). Enter the following command:

Terminal window
ssh pi@your_pi_ip_address

Enter the default password “raspberry” when prompted. Or the password you’ve setup in the initial process.

Step 3: Installing Dependencies and XMRig

Before installing XMRig, update your Raspberry Pi’s package list and upgrade the installed packages by running these commands:

Terminal window
sudo apt update
sudo apt upgrade -y

Next, install the required dependencies for XMRig by executing the following command:

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

Now, it’s time to download and build XMRig. Run the following commands to clone the XMRig repository, create a build directory, and compile the miner:

Terminal window
git clone https://github.com/xmrig/xmrig.git
cd xmrig
mkdir build && cd build
cmake ..
make

Step 4: Running XMRig

Now that everything is installed you can start mining with your Raspberry Pi using the following command in the “build” directory:

Terminal window
./xmrig -o <miningpool-ip> -u <your-monero-address.worker-name> -a rx/0 -p x

Your done and can now mine Monero