How To Mine Monero With An AMD Graphics Card On Linux

in cryptocurrency •  9 months ago


This past weekend I chose to learn about a cryptocurrency that previously I knew nothing about. The pick was Monero, a coin ranked thirteenth by market cap on and eighth by price. What I found interesting about this coin was the mining algorithm, CryptoNight.

CryptoNight is another proof-of-work algorithm much like the ones we find in Bitcoin, Litecoin, and many other coins. The focus for this algorithm is to keep the hashing power manageable. This way, someone mining on a CPU can still gain a portion of the pool's reward. Of course, the better the CPU, the more hashes per second the miner receives.

This algorithm also supports GPU mining but the advantage over CPU mining is not enormous. Take Ethereum, for example. While it was/is still proof-of-work, using a GPU would return 100 times more profit. Monero, on the other hand, is able to keep the GPU advantage at a mere two times the performance.

Keeping the spread on hashing power between CPUs and GPUs so low, as well as the lack of ASICs, keeps Monero decentralized to the fullest. More individuals are able to mine this coin on the computer they own and see returns, especially as the price increases. We all know that a coin's ability to remian decentralized is key to its success and longevity.

How To Mine Monero on Linux with an AMD Graphics Card

We will use the xmr-stak application created and maintained by fireice and psychocrypt on GitHub. This is what I use and everything is running great. If you want to mine with a GPU, I suggest installing a flavor of Ubuntu 16 or higher on whatever computer is doing the mining. If you plan to only use your CPU to mine, then use whatever distro you'd like. I was on pure Debian the first time I tried this and ran into many issues. Ubuntu was a much smoother install in getting the GPU to mine.

My Hardware:

CPU: AMD Ryzen 7 1700
RAM: 16 GB of Corsair Vengeance LPX DDR4
Drives: 1 SSD (OS and Programs) and 1 HDD (files)
Graphics Card: Sapphire Radeon NITRO R9 390 8GB
Power Supply: Corsair RM750i
Operating System: Linux
Internet Speed: 50mbps upload & 50mbps download

With that computer I am pumping out between 1,000 and 2,000 hashes per second. This is when both the CPU and GPU are mining together. The CPU alone can run 300 hashes per second at 50 percent usage, while the GPU runs at about 700 hashes per second, on average. These numbers fluctuate a lot and I once saw the combined total at 2,500 hashes per second for a short while.


Step-By-Step Setup

We are going to assume you have Ubuntu installed since using a GPU will almost always give more hashing power. What we need to do first is to install the proprietary AMD graphics drivers. Not ideal if you want a computer that is 100 percent FOSS but is needed to mine cryptocurrency.

We need to follow this guide from AMD to properly install the 'AMDGPU-PRO' driver into Ubuntu. We will not walk through that step by step since the site lays it out perfectly. Once the 'AMDGPU-PRO' diver is installed, we now need to install the AMD APP SDK. Download the latest and follow the install directions. I advise running these two installs as the root user for system-wide access.

Now that we have all the proprietary software installed, it is time to compile the 'xmr-stak' application. Open up a terminal window and navigate to the directory in which you wish to run the program. I used my 'home' directory and will be using that in my command examples here.

Once we are in the the directory of our choice, it is a good time to install the dependencies. Enter the following:

sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev

Once that is complete we need to download the source from Github:

git clone

Next we need to make our directory to build the application, then navigate into the same directory:

mkdir xmr-stak/build

cd xmr-stak/build

Now we compile the source code. Below is what to enter in order to have both our CPU and AMD GPU mine together:


-DCUDA_ENABLE=OFF tells the compiler that we do not need to compile for an NVIDIA graphics card. If we do not state this, the compiler will fail since we only have an AMD graphics card.

If we only want to mine with a GPU, then enter the following:


Now to install run:

make install


Running The Monero Mining Software

Now that we have the software installed to mine for Monero, we can run the program. Make sure before you start the miner that you have a wallet and pool you can use.

When the xmr-stak is run for the first time, it will ask a series of questions to set up the configuration file. After that, it analyzes the hardware we chose to use and determines the best settings for the most hashes per second.

To run the miner we need to navigate to the bin directory:

cd ~/xmr-stak/build/bin/

Once there all we need to do is run:


Now that the program in running, there are some key shortcuts we can use to monitor how everything us operating.

Pressing h will display the hashes per second on every GPU and CPU we have in the computer. c displays information about the connection to the pool and r to show the mining results.

That is all there is to it! Looking at it typed out like this makes it seem quite easy. There was much back and forth in my attempts to get my GPU to mine. I hope my weekend project of trial and error saves you as much time as possible so you can reap as much Monero as possible!

Thanks for reading!

Let me know in the comments if you have any questions or found a typo!

All images came from royalty and attribution free sources unless specified
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Very nice tutorial @jrswab. Would be nice to include a ROI breakdown too. By the way you can also mine XMR like a noob by just downloading minergate, which is a minerpool GUI ;)


There are a lot of crypto-calculators out there to figure out ROI of a computer that do a much better job than I could. CryptoCompare has a great one to check things out.

Yeah I messed around with minergate but have heard they take 30% when using their app. However, I have no way to prove that since I don't use it.

Thanks for reading and for the comment mate!

I was doing Monero mining for a bit on my gaming rig, and it was doing pretty good, but man did my office get HOT. I then did the math on electricity usage, and coupled with that cost plus my hot office plus having to listen to the fans on that PC running at max power all the time...I decided it wasn't worth it.

Would really love to mine, but only if the electricity was free (like it is in some countries).


hahaha. I am not loosing money on electricity at the moment and the extra heat makes my cold office less cold. One of my goals for this year is to set up a rig in my basement that is headless and dedicated to mining whatever coin I chose that day/week/month.

The wife and I plan on getting a solar roof from Tesla and that will make the cost of electricity even cheaper. (minus the cost of the roof though lol)


someday we'll heat our homes with mining rigs...
too bad we can't cool our homes by spending that mined crypto
seems logical enough 😃

It's Regretful to me that mining Monero is not profitable to me at all 😞 . Hey @jrswab , would you help me with mining cryptocurrency? would you write any article on cryptoceurrency mining for newbies ?

My notebook/Laptop configuration:

1) Processor: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz

2) RAM/Memory Type: 8GB DDR3

3)Graphics: 2GB Chipset AMD Radeon (TM) R7 M340

4)Internet Download Speed:1Mbps

5)Internet Upload Speed:1Mbps


I'll add it to my list! Thanks for the suggestion.


Thanks for your reply 👌

It will be many helpful, if you inform me when you do a blog on this topic

Great write-up! I've been considering checking out mining Monero -- mostly out of interest rather than financial gains. I have an nVidia card though, so I would imagine the build parameters might be a little different.

Running at ~1MH/s, what kind of units/day were you able to mine?


The setup for NVIDIA is very similar and the differences are outlined on the xmr-stak github.

At 1MH/s you can expect to gain about 8 xmr per day.


Whoa what?! That's WAY more than I was expecting... I was thinking it would be closer to 0.01XMR/day... I didn't miss a 'milli'XMR or anything did I? Because according to coinmarketcap, these guys are trading at about $380/XMR.


Looks like I know what I'm setting up tonight.. I've had my computer grinding out on mining ETH for the last 6 weeks because I was bored and wanted to try it, but I'm still only at about 0.9 ETH..


That is the specs that told me at least...



Roger that! I think my initial confusion has come from the fact that I confused MH/s & KH/s (you said 1000~2000H/s right? So I was mistaken above when I asked about 1MH/s)... I got all excited for nothing. :( Still going to check this out though, as I think Monero has a lot of potential. Cheers!


Great write-up! I've been considering checking out mining Monero -- mostly out of interest rather than financial gains. I have an nVidia card though, so I would imagine the build parameters might be a little different.

Running at ~1MH/s, what kind of units/day were you able to mine?

EDIT: To clarify -- the above question in my comment should be ~1KH/s , not 1MH/s. I got excited and forgot my scientific notation prefixes.


hahah awe yes! I thought you had one beefy rig XD


Hahaha yeah nothing that intense, but I think my setup might be generally comparable to yours -- which I would think is probably an above average power system (maybe not in the crypto-space or this early-adopter community on here) compared to the general public. Intel i7 2700k, 16GB DDR4, nVidia GTX 1060 w 6GB RAM an an Ubuntu install.

You got a 4.24% upvote from @upme requested by: @jrswab.
Send at least 2.5 SBD to @upme with a post link in the memo field to receive upvote next round.
To support our activity, please vote for my master @suggeelson, as a STEEM Witness

This post has been resteemed from MSP3K courtesy of @jrswab from the Minnow Support Project ( @minnowsupport ).

Bots Information:

Join the P.A.L. Discord | Check out MSPSteem | Listen to MSP-Waves

Good brother...