Mining the Monero cryptocurrency the CLI way
Mini Miner
![© Lead Image © Chode, 123RF.com © Lead Image © Chode, 123RF.com](/var/linux_magazin/storage/images/issues/2024/279/mining-monero/chode_123rf-mining.png/833458-1-eng-US/Chode_123RF-mining.png_medium.png)
© Lead Image © Chode, 123RF.com
The Monero cryptocurrency lets you get in the game without spending thousands on hardware. We'll show you how.
When I started mining Bitcoin 13 years ago, the hardware standard was a bunch of Windows computers built up around the best possible video cards and power supplies. The end goal was to achieve the most hashes per second (H/s, or sometimes expressed as kH/s
or mH/s
) [1]. To this day, it is easy to find articles explaining how to mine Bitcoin using this classic setup. But few of the mining tools are command-line based, which is a problem for Linux veterans who wish to avoid GUI clutter. But rest assured: A basic Debian system, with the fastest CPU you can get your hands on, is all you need to start mining cryptocurrencies.
In the highly competitive universe of crypto mining, major currencies like Bitcoin are typically mined using specially built Application-Specific Integrated Circuit (ASIC) systems, which require a significant investment of the miner's time and money.
Alternative currencies offer a lower barrier of entry. One alternative cryptocurrency that has gained some recent attention is Monero (abbreviated XMR). Monero stands out because it is truly anonymous [2] and because of its resistance to ASIC hardware mining [3]. This article describes how to start mining XMR on a Debian-based Linux system.
A Little Bit More on XMR
The value of Monero is nowhere near the range of Bitcoin's value. The price of XMR at the time I wrote this article was $142.30, whereas the price of Bitcoin was $25,851.07. Some have wondered whether XMR would ever reach the value of BTC, but since its inception in 2014, it has failed to even reach the $500 mark [4]. However, projections are looking solid, and Monero shouldn't disappear any time soon.
Technical Requirements
The most important asset for mining cryptocurrencies is electricity. The second most important asset is a fast CPU chip [5] that you can overclock. You'll also need a means for dissipating the heat and keeping your environment dust free. Because mining is a process that never sleeps and demands full capacity, it will be important to leave room for your hardware to remain in a cool, friendly zone for the time it will be crunching its life away. While it does, and if it runs as dedicated, it will emit a vast quantity of heat. The final factor affecting hashing performance is the clock speed of the RAM, although the RAM speed is less important than the other features I've mentioned.
A minimal system for mining XMR would have a 250GB SSD, 4GBs of RAM, and the cheapest video card available. The high-grade components need to be the CPU and the power supply unit. Investing in a good motherboard is optional yet vital if you wish for your system to beat the clock. Be advised that, as time goes on, the size of the decentralized blockchain copy that you'll need to host locally will eventually expand to over 250GB. Currently, it weighs about 164GB, so it is safe to say that a 250GB drive will hold for another three to four years at the very least – unless there is a huge increase in transactions.
Getting Started
The first step is to get the system up. For that, you'll need to install the latest Debian (bookworm) [6]. All you really need is the SSH server and standard system utilities from the latest Debian netinstall
(Figure 1).
![](/var/linux_magazin/storage/images/issues/2024/279/mining-monero/figure-1/833461-1-eng-US/Figure-1_large.png)
Once you've installed the OS and logged into the freshly installed system, the work with Monero can begin. Start by downloading the latest Monero daemon [7] and extracting it under the folder of your choice (Figure 2). Then install the CPU miner (Figure 3).
![](/var/linux_magazin/storage/images/issues/2024/279/mining-monero/figure-2/833464-1-eng-US/Figure-2_large.png)
![](/var/linux_magazin/storage/images/issues/2024/279/mining-monero/figure-3/833467-1-eng-US/Figure-3_large.png)
The next steps truly initiate the Monero footprint. The very first thing is to download the ~164Gbs blockchain, and for that, a simple execution of ./monerod
will handle the task (Figure 4).
![](/var/linux_magazin/storage/images/issues/2024/279/mining-monero/figure-4/833470-1-eng-US/Figure-4_large.png)
Launching the monerod
command without an existing blockchain in your home folder will result in it downloading the entire blockchain. This process will take a while – and even longer if you are working with a slow hard drive. Alternatively, specifying
--data-dir /path/of/.bitmonero
will simply download the delta since last update. That way you can always back up your downloaded blockchain every now and then, in order to avoid all this synchronization.
Whatever you attempt to do while the blockchain finishes updating could end up not working immediately. Therefore the wisest thing to do is to allow it to complete. However, this process will take several hours and can take days, depending on your Internet connection.
By default monerod
puts everything blockchain related under /home/youruser/.bitmonero
. The last operation is to port forward TCP/18081 if you wish to have no errors, but those errors will not void some functions.
Even when you have already downloaded 99 percent of the blockchain and have not updated in 10 days, it can take up to an hour for your node to be synchronized again. Because I am living dangerously, I will proceed immediately with the next step: setting up a wallet (Figure 5). In this case, I'll be running
~/Downloads/monero-x86_64-linux-gnu-v0.18.2.2/monero-wallet-cli
![](/var/linux_magazin/storage/images/issues/2024/279/mining-monero/figure-5/833473-1-eng-US/Figure-5_large.png)
Upon first launch you are asked to create a wallet, secure it via a password, and then configure it. Then you are handed a 96-character alphanumerical expression that represents the actual wallet address used for all of your future transactions. You are also provided with 25 words that can be used to recover access to your wallet. Update your password manager with that information and take really good care of it!
At the end of the creation process, you will see your balance and can start making transfers, as long as the node is in sync with the Monero network. In the event that everything went smoothly, there will be two mywallet
files under pwd
.
The next step is setting up the miner, which you simply execute and answer a couple of questions. After you choose the desired currency, pool address, and wallet address, the system gives the infamous "MEMORY ALLOC FAILED" (Figure 6), but you can fix that right now.
![](/var/linux_magazin/storage/images/issues/2024/279/mining-monero/figure-6/833476-1-eng-US/Figure-6_large.png)
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.