Automated crypto mining on Linux with Nvidia

I’m truly excited about the current influx of fresh people to building computers for the very first time to mine cryptocurrencies such spil Bitcoin, Ethereum and more. Spending time browsing Reddit I get the impression some are totally fresh to building PCs and even newer to Linux. This guide is (hopefully) going to give you some of the answers to embark mining crypto on an Nvidia setup under Linux.

Plus, if you use Linux you get to pull this face at Windows users! Incidentally I get better spectacle under Linux than Windows too!

My equipment is presently running 100% headless and is accessible only via SSH remotely. Using some scripts I have automated the monitoring of ccminer which is the software I’m presently using to mine MONA .

Install Linux

This part of the guide is actually going to be the lightest part even tho’ for some, it is the most daunting. I am using Arch Linux because it is stripped down to the barebones and has pre-compiled versions of the mining softwares te the AUR . It doesn’t come with anything installed out the opbergruimte you absolutely don’t need for a bootable system. This is both a voor and a con. You can, te theory, use any Linux and apply much of the logic here but YMMV.

A utter installation guide for Arch is here .

Setup your system

N.B. This guide is for Arch Linux. You will have to adjust package names and possibly compile software from source if using other distros.

I am assuming at this point you have a booted Arch Linux installation and are either at the console locally (via a screen, keyboard and mouse) or via SSH – either is fine.

Install your AUR helper of choice, I use pacaur . A script to install it is available here .

Very first, wij’ll need some packages:

Next, wij’ll install the mining software from the AUR:

Configure X for Nvidia

You can find the script I use for overclocking on Github here .

Nvidia tooling on Linux kinda deepthroats but I’ve attempted my best to take the ache out of it with a few directives. Very first, wij need to enable overclocking of the cards by passing the –cool-bits=28 option along with a few other parameters which let us run the cards and X (the display manager) headlessly.

This creates a fresh xorg config te /etc/X11/xorg.conf , go look if you like!

Reboot and you should now be able to modify the core clock and memory speeds on your card(s). The above guideline works for numerous cards ter a single system too.

Overclocking NVIDIA cards under Linux

There’s lots of information all overheen the internet on how to do this. Here’s what worked for mij. A script that I can execute spil part of my automation to ensure the overclocks, power boundaries and other settings are spil they should be before mining commences.

I save this script ter my huis folder spil nvidia.sh . Mark it spil executable with chmod +x nvidia.sh and the run it with ./nvidia.sh . Modify the values to suit your needs of course.

To find out which GPU te your system is which run nvidia-smi . That ID is then used ter the above script. Te my case card 0 is a 1080 and card 1 a 1070 from the following output.

Note that I have dropped the power limit for each card to around 65% with nvidia-smi -i 0 -pl 150 . This increases efficiency (hash vanaf watt) without affecting the actual hashrate. Proef at your own risk spil it is possible to harm cards by switching thesis settings.

Manual Mining

I won’t voorkant mining pools here, which coin to mine or pretty much anything to do with actual mining spil I’m assuming you already know that. If you don’t and would like an article on that I can very likely be persuaded!

Te this example I am using ccminer with cuda to mine MONA at https://mona.suprnova.cc/ . At the most basic level you can simply run the mining software ter your terminal using the following instruction:

However software crashes, drivers crash, power cuts toebijten, etc. All of thesis things require you to be attentive and see your system closely. I automate things for a living so this naturally didn’t sit well with mij.

You’ll need to edit the username and password above unless you want to throw teddybeer money my way!

Automated Mining

I wrote a plain script to automate the checking of the utilisation of my GPUs and if below 75%, restart the miner. Utter scripts here .

Create a systemd service

Firstly I created a systemd service to run the miner ter the background. There are many ways to achieve this and systemd is one option.

Most of the above should look familiar when you read it closely. Save this verkeersopstopping into /etc/systemd/system/ccmona.service . Check it works with systemctl embark ccmona and monitor it with observe systemctl status ccmona .

Automated mining liveliness check

Save the following spil check.sh , make it executable with chmod +x check.sh and then run it with ./check.sh . This should work with all latest Nvidia cards without modification.

To automate this check I used cron but you could use systemd timers or any other number of solutions. My cron entry to run check.sh every minute is thus:

You’ll need to commence and enable the cronie service:

Notifications via Pushover

This step is optional

A few years ago I wrote a plain Python app to permit the sending of Pushover notifications from Linux called bootlace . I use this here spil part of my check.sh script. Save bootlace.py somewhere on your system and make it executable ( chmod +x ). Then go to Pushover and register for an account, user and app tokens.

You will need to install python-pip with pacman. Then install via pip install docopt requests .

Future plans

If I get around to it I hope to use the check script to do more stuff like check the most profitable coin on whattomine.com, parse the JSON and switch up the coin being mined automatically. That said, life is brief.

Also, the check script spil it stands is a bit dumb. Maybe it should check for GPU activity overheen the course of a few seconds instead of just one occasion. This would help reduce false positives.

Related movie: Best Verschrikt Four Buck Mining Equipment – How To Build 12x Card 1060 ETH GPU Miner


Leave a Reply

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