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

19 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?

    1. One of the following in all probability
      The machine was either not connected to the internet.
      The address does not exist on port 3333
      You have a firewall on your machine or at your location that is blocking that domain and or a combination of that domain and that port 3333.
      If ur running this from your local machine and suspect the firewall is not on your machine but perhaps in your building, go to starbucks or an internet cafe, if u can.
      If you’re running on from ubuntu, know that sometimes ufw firewall is installed automatically for you by some ISP’s and it may block outgoing connections on port 3333

  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.

  7. Repository mentioned above is very old and seems not maintained. Are you sure that the miner supports new version of monero?

    1. That’s exactly my problem, I think Monero hard-forked and this repository maintainer left it for dead…

      I keep getting 100% rejected shares ๐Ÿ™ This is the only miner that compiles on some of my cpu because they are older… Wish the maintainer would fix it…!

  8. hello how I have a computer that has 2 GPU AMD RX580 cards and an AMD ryzen 7 processor and wish to mine with ubuntu with the 3 prerifericos. What do you recommend to start?

  9. Thanks for this! One of the better guides I saw for Linux

    Though for anyone still trying to do this, it might be good to note that MyMonero released desktop and iOS apps recently. They’re actually very nice and you don’t have to download the Monero blockchain which is more than double the size since you wrote!

    I also like Exodus’ Monero wallet as another alternative to the official GUI wallet ( You don’t have to download the blockchain but there’s also an anonymous exchange in the app which is good if you ever want to use XMR profits to buy other cryptos

  10. I have followed the instructions and have gotten my terminal to say this:
    2021-03-02 11:04:33] Pool set diff to 7000.01
    [2021-03-02 11:04:33] Stratum detected new block
    [2021-03-02 11:05:26] Pool set diff to 5060
    [2021-03-02 11:05:26] Stratum detected new block
    [2021-03-02 11:06:26] Pool set diff to 3373
    [2021-03-02 11:06:26] Stratum detected new block
    [2021-03-02 11:07:26] Pool set diff to 2249
    [2021-03-02 11:07:26] Stratum detected new block
    [2021-03-02 11:08:26] Pool set diff to 1499
    [2021-03-02 11:08:26] Stratum detected new block

    It continues like this for forever. I have signed into the xmrpool, and I get 0 h/ps. I have seen other successful comments with a confirming message afterwards:
    accepted: 28/28 (100.00%), 35.52 H/s at diff 1950 (yay!!!)

    Mine does not show that. I also want to know how to turn down the amount of connected threads. My computer (don’t even ask, small budget, big old computer) has 12 processing cores, and they all get maxed out when I start the process. I can’t do anything while mining. How do I set a block difficulty in the terminal?


Leave a Reply

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