How To Mine Monero (XMR) with your CPU on Linux

Monero is a cryptocurrency similar to Bitcoin and in this blogpost we’re going to have a look at how to mine some Monero through a command line based miner on Linux.

In contrast to Bitcoin and Ethereum a strong mining GPU is not impacting the payoffs as much since the cryptonight algorithm is CPU friendlier.

Technically you can run the miner anywhere it compiles, but Linux is probably the most likely candidate for your private mining operation since Linux servers are widely available in the shape of virtual private servers for you to quickly try it out.

Disclaimer: unless you have a lot of CPUs at your disposal it might take a while until you reach a payout.

How to Mine Monero:

This article will go over:

  1. Creating a Monero Wallet
  2. Picking a mining pool
  3. Downloading and copiling the miner
  4. Start mining Monero
  5. Monitoring your hashrate

Creating a Monero Wallet

You can either create a Monero Wallet by downloading the official client or using an online wallet such as mymonero.

Note that the official client brings an about 20-30 GB download to store the entire Monero blockchain on your computer as well.

Picking a Monero Mining Pool

To get started, I suggest you pick a mining pool from any of the mining pool lists, I went with, but many of them run the same software on the backend and to monitor your mining efforts.

A mining pool combines the efforts of many miners and increases your chance of payouts, because you find new blocks quicker together. With the PPLNS pools you’ll be paid based on how much work you contributed to the new block. If you don’t have your own mining farm, but just run the miner on a couple of computers or even one, I’d recommend going with that option.

Note: Mining Monero on Windows

If you want a graphical user interface, you can make use of the Monero Spelunker GUI and get up and running right after creating your wallet.

Downloading the Miner for Linux

This tutorial is for the cpuminer-multi, you can also pick other miners depending on your CPU or GPU you want to use.

First, let’s install the require packages for Ubuntu, Linux Mint or other Debian-like systems:

sudo apt-get install git libcurl4-openssl-dev build-essential libjansson-dev autotools-dev automake

On Arch Linux you should have most pacakges available, else install them with pacman or pacaur.

Now let’s download the miner with git and change into the directory:

git clone
cd cpuminer-multi

It comes with a useful script called

CFLAGS="-march=native" ./configure
sudo make install

If the previous commands throw an error, try the following:

sudo make install

Now the binary minerd should be available system wide. You can test that out by typing:

which minerd

Example output:


Start Mining Monero

In order to start mining monero you can just run the below command:

sudo ./minerd -a cryptonight -o stratum+tcp://MININGPOOL:PORT -u WALLET_ADDRESS -p MINER_NAME

MININGPOOL and PORT depend on your miningpool.

Your WALLET_ADDRESS you either get from your wallet GUI or from your mymonero account.

MINER_NAME is up to you to define, I usually keep it to the host name of the machine.

By running the above command you will see output like:

[2017-12-24 13:13:25] Using JSON-RPC 2.0
[2017-12-24 13:13:25] Starting Stratum on stratum+tcp://
[2017-12-24 13:13:25] 8 miner threads started, using 'cryptonight' algorithm.
[2017-12-24 13:13:29] Pool set diff to 5000
[2017-12-24 13:13:29] Stratum detected new block
[2017-12-24 13:13:38] accepted: 1/1 (100.00%), 177.90 H/s at diff 5000 (yay!!!)

Whenever it states accepted that means that your calculations where accepted into the overall mining effort and should be visible in the dashboard of your mining pool.

Now you actually can wait for your machines to have accumulated enough shares to be considered as a large enough share of the payout in Monero to the wallet you specified.

Backgrounding the miner can be done by using screen or appending & to the command.

To kill the miner again you can use something like killall minerd.

Monitoring your Hashrate

Your mining pool will usually display an interface that shows how many hashes at once you’re going through per second. For each individual miner you can always check the output of the terminal.

If you’re curious how quickly you possibly will be rewarded by your mining pool, you can check out this helpful Monero mining calculator. You can even pick different options for solo mining, pool mining and if you rent or own the hardware.

Calculating Profits mining Monero

There are different profitability calculators online and they should all be taken with a grain of salt, since both difficulty of the network, amount of miners and some other factors will play a role in the development of the currency.

Further Reading

Monero recently sparked the interest of a lot of people, not least because a browser based miner exists, written in web assembly, which allows visitors of your website to donate Monero (mining effort) to you. I’ve covered the topic briefly: Testing Coin Hive Crowd Source Monero Mining.

Update: I’ve also tested the xmr-stak miner!

Thank you for reading! If you have any comments, additions or questions, please leave them in the form below! You can also tweet them at me

If you want to read more like this, follow me on feedly or other rss readers

11 thoughts on “How To Mine Monero (XMR) with your CPU on Linux”

  1. Do I have to login into the pool to start minning? Or just by putting the address and port I will start to get my calculations accepted?

  2. I see my minerd working properly I believe…

    [2018-01-20 06:32:13] accepted: 24/24 (100.00%), 35.64 H/s at diff 1650 (yay!!!)
    [2018-01-20 06:32:19] accepted: 25/25 (100.00%), 35.67 H/s at diff 1650 (yay!!!)
    [2018-01-20 06:32:29] accepted: 26/26 (100.00%), 36.00 H/s at diff 1650 (yay!!!)
    [2018-01-20 06:32:53] Pool set diff to 1950
    [2018-01-20 06:32:53] Stratum detected new block
    [2018-01-20 06:32:57] accepted: 27/27 (100.00%), 35.98 H/s at diff 1950 (yay!!!)
    [2018-01-20 06:33:21] accepted: 28/28 (100.00%), 35.52 H/s at diff 1950 (yay!!!)
    [2018-01-20 06:33:26] Stratum detected new block

    I am using How do I verify on that site that I’m doing everything correctly ? I tried to “Login” using my -u and -p parameters for the “payment address” and “password” respectively. I’m getting an error “Please check your login details”.

    Please help =)

    btw, great instructions… I just had to run some additional commands to get my linux up to date

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install -f

      1. Thank you for the response Jonathan.

        FYI.. for the ./minerd command, i used -p…. then on the website for Login, the password I used was only ‘’ and it worked.

        Thx again !


  4. I got the following log:

    [2018-02-14 01:39:35] Using JSON-RPC 2.0
    [2018-02-14 01:39:35] Starting Stratum on stratum+tcp://
    [2018-02-14 01:39:35] 3 miner threads started, using 'cryptonight' algorithm.
    [2018-02-14 01:39:35] Stratum connection failed: Could not resolve host:
    [2018-02-14 01:39:35] ...retry after 10 seconds
    [2018-02-14 01:39:45] Stratum connection failed: Could not resolve host:
    [2018-02-14 01:39:45] ...retry after 10 seconds
    [2018-02-14 01:39:55] Stratum connection failed: Could not resolve host:
    [2018-02-14 01:39:55] ...retry after 10 seconds
    [2018-02-14 01:40:05] Stratum connection failed: Could not resolve host:
    [2018-02-14 01:40:05] ...retry after 10 seconds
    [2018-02-14 01:40:15] Stratum connection failed: Could not resolve host:

    How can I solve this?

  5. Hi All,

    Can someone help me to install properly cpuminer-multi on Pi3 box.
    When I try to execute the command: sudo make install I am getting the following error:

    pi@raspberrypi:~/cpuminer-multi $ sudo make install
    Making install in compat
    make[1]: Entering directory ‘/home/pi/cpuminer-multi/compat’
    make[2]: Entering directory ‘/home/pi/cpuminer-multi/compat’
    make[3]: Entering directory ‘/home/pi/cpuminer-multi/compat’
    make[3]: Nothing to be done for ‘install-exec-am’.
    make[3]: Nothing to be done for ‘install-data-am’.
    make[3]: Leaving directory ‘/home/pi/cpuminer-multi/compat’
    make[2]: Leaving directory ‘/home/pi/cpuminer-multi/compat’
    make[1]: Leaving directory ‘/home/pi/cpuminer-multi/compat’
    make[1]: Entering directory ‘/home/pi/cpuminer-multi’
    gcc -DHAVE_CONFIG_H -I. -pthread -falign-loops=16 -falign-functions=16 -falign-jumps=16 -falign-labels=16 -Ofast -flto -fuse-linker-plugin -funroll-loops -fvariable-expansion-in-unroller -ftree-loop-if-convert-stores -fmerge-all-constants -fbranch-target-load-optimize2 -fsched2-use-superblocks -maes -MT minerd-cpu-miner.o -MD -MP -MF .deps/minerd-cpu-miner.Tpo -c -o minerd-cpu-miner.o `test -f ‘cpu-miner.c’ || echo ‘./’`cpu-miner.c
    gcc: error: unrecognized command line option ‘-maes’; did you mean ‘-mapcs’?
    Makefile:573: recipe for target ‘minerd-cpu-miner.o’ failed
    make[1]: *** [minerd-cpu-miner.o] Error 1
    make[1]: Leaving directory ‘/home/pi/cpuminer-multi’
    Makefile:776: recipe for target ‘install-recursive’ failed
    make: *** [install-recursive] Error 1

    I really would appreciate for your feedback what I am doing wrong and how to solve it.

    Thanks a lot in advance for your help.

  6. I have configured and seem to be getting results as below:

    [2018-03-10 08:47:57] accepted: 73/73 (100.00%), 74.87 H/s at diff 1740 (yay!!!)
    [2018-03-10 08:48:18] accepted: 74/74 (100.00%), 77.94 H/s at diff 1740 (yay!!!)
    [2018-03-10 08:48:32] Stratum detected new block
    [2018-03-10 08:48:34] accepted: 75/75 (100.00%), 71.23 H/s at diff 1740 (yay!!!)

    But I am unable to login at

    They need “Payment Address” which I thought is the Account Address (Public) at Is this true?

    On Password they need an email Identifier so I supplied my email address.

    Could you explain exactly how to login? Thanks.

Leave a Reply

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