Mining the Monero cryptocurrency the CLI way
Mini Miner
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).
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).
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).
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
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.
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.
News
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.