Market Cap: $2.178T 0.57%
Volume(24h): $51.9954B -22.11%
Fear & Greed Index:

28 - Fear

  • Market Cap: $2.178T 0.57%
  • Volume(24h): $51.9954B -22.11%
  • Fear & Greed Index:
  • Market Cap: $2.178T 0.57%
Cryptos
Topics
Cryptospedia
News
CryptosTopics
Videos
Top Cryptospedia

Select Language

Select Language

Select Currency

Cryptos
Topics
Cryptospedia
News
CryptosTopics
Videos

How to setup a Monero mining rig on Linux? (CLI Tutorial)

2026年,Monero(XMR)仍支持家用CPU挖矿,依托ASIC抗性RandomX算法与永久尾部发行(0.6 XMR/区块),兼顾去中心化与长期可持续性。

May 01, 2026 at 04:59 am

System Requirements and Hardware Selection

1. A modern x86_64 CPU with at least four physical cores is essential for competitive Monero mining, as the RandomX algorithm is intentionally CPU-optimized and memory-hard.

2. Minimum RAM requirement stands at 4 GB, though 8 GB or more significantly improves hash rate stability and reduces page faults during intensive mining cycles.

3. SSD storage is strongly recommended—not for hashing performance, but to ensure rapid daemon synchronization and reliable wallet file persistence under continuous I/O load.

4. No GPU acceleration is supported or beneficial; Monero’s RandomX deliberately neutralizes GPU advantages by relying on large, constantly changing datasets that exceed typical VRAM capacity.

5. Thermal management must be prioritized: sustained CPU loads above 85°C trigger throttling, directly cutting hash rate by up to 30% on consumer-grade processors.

Monero Daemon and Wallet Installation

1. Download the official Linux CLI binaries from getmonero.org using wget or curl—avoid third-party repositories due to frequent signature mismatches and outdated package versions.

2. Extract the archive into /opt/monero/ and set strict ownership: chown -R monero:monero /opt/monero/, then chmod 750 on all binary files to prevent unauthorized execution.

3. Initialize the blockchain database with --detach and --data-dir /var/lib/monero to isolate data from runtime binaries and simplify backup procedures.

4. Launch monerod with --restricted-rpc and --confirm-external-bind to prevent remote RPC exposure while allowing local miner connectivity via loopback only.

5. Generate a new wallet using monero-wallet-cli --generate-new-wallet /var/lib/monero/wallet.keys and store the mnemonic seed offline—no digital copy should exist on the mining host.

XMRig Configuration and Optimization

1. Compile XMRig from source using GCC 12+ to enable AVX2 and BMI2 instruction set support, which yields measurable gains on Ryzen and Intel 11th-gen+ CPUs.

2. Configure threads explicitly: use 'threads': null in config.json to let XMRig auto-detect optimal concurrency, or manually assign one thread per physical core minus one for system overhead.

3. Enable huge pages via echo 128 > /proc/sys/vm/nr_hugepages before starting XMRig—this reduces TLB misses and lifts average hash rate by 8–12% on most configurations.

4. Set 'cpu-affinity': [0,2,4,6] to pin mining threads to isolated CPU cores, preventing context-switch interference from systemd, logging daemons, or network interrupts.

5. Use 'donate-level': 1 instead of zero to sustain developer infrastructure without compromising more than 1% of total hashrate—this is ethically aligned with Monero’s open-source ethos.

Security Hardening and Runtime Isolation

1. Run XMRig under a dedicated unprivileged user account with no shell access, no home directory, and no sudo privileges—only read access to wallet keys and write access to log paths.

2. Configure systemd service files with MemoryLimit= and CPUQuota= directives to cap resource consumption and prevent system instability during peak thermal events.

3. Disable swap entirely using swapoff -a and comment out swap entries in /etc/fstab—RandomX memory access patterns cause severe disk thrashing if swapped pages are involved.

4. Enforce kernel-level protections: set kernel.unprivileged_userns_clone=0 and fs.protected_regular=2 to block privilege escalation vectors commonly exploited in compromised miner deployments.

5. Log all XMRig activity to journald with MaxLevelStore=info and rotate logs weekly—never redirect stderr to /dev/null, as critical initialization failures appear there exclusively.

Frequently Asked Questions

Q: Can I mine Monero using Docker on Ubuntu?Yes, but only with privileged mode disabled and --cap-drop=ALL applied. Mount /dev/cpu_dma_latency read-only and bind the wallet directory as a volume with :ro flag to prevent container escape via keyfile modification.

Q: Why does my XMRig show “no connection” even though monerod is running?This usually occurs when monerod was launched without --rpc-bind-ip=127.0.0.1 or when the firewall blocks localhost communication. Verify with ss -tlnp | grep :18081 and check journalctl -u monerod for RPC binding errors.

Q: Is it safe to use a cloud VPS for Monero mining?No. Most providers prohibit cryptocurrency mining in their terms of service. Detection leads to immediate termination, loss of prepaid credits, and blacklisting of associated payment methods.

Q: How do I verify my miner is submitting valid shares?Check the “accepted” counter in XMRig’s console output. Cross-reference timestamps with pool dashboard entries. If accepted shares remain at zero after five minutes, inspect your pool URL, wallet address format, and port selection—many pools require specific ports for TLS or non-TLS connections.

Disclaimer:info@kdj.com

The information provided is not trading advice. kdj.com does not assume any responsibility for any investments made based on the information provided in this article. Cryptocurrencies are highly volatile and it is highly recommended that you invest with caution after thorough research!

If you believe that the content used on this website infringes your copyright, please contact us immediately (info@kdj.com) and we will delete it promptly.

Related knowledge

See all articles

User not found or password invalid

Your input is correct