-
bitcoin $77323.969542 USD
0.01% -
ethereum $2523.414850 USD
2.23% -
tether $0.999674 USD
0.01% -
bnb $732.334794 USD
2.37% -
xrp $1.364311 USD
0.51% -
usd-coin $0.999831 USD
0.00% -
solana $101.751035 USD
1.88% -
tron $0.339246 USD
0.15% -
hyperliquid $78.911101 USD
-1.42% -
zcash $1143.169120 USD
2.95% -
dogecoin $0.084522 USD
0.58% -
monero $539.820025 USD
5.75% -
chainlink $11.538258 USD
0.03% -
unus-sed-leo $9.111763 USD
0.28% -
cardano $0.208079 USD
-0.46%
How to Mine Bitcoin on Linux? (Advanced Ubuntu Guide)
Set up Ubuntu 22.04 with full-disk encryption, install ROCm/CUDA drivers, compile BFGMiner with OpenCL/CUDA support, secure via non-root user and UFW, and monitor thermals headlessly.
Feb 03, 2026 at 08:59 pm
Setting Up the Mining Environment
1. Install Ubuntu Server 22.04 LTS with full disk encryption and minimal package selection to reduce attack surface and improve stability.
2. Update the system repository index and upgrade all installed packages using apt update && apt upgrade -y before proceeding.
3. Install essential build tools including build-essential, cmake, libtool, and autoconf to compile mining software from source.
4. Configure kernel parameters to prevent memory overcommit and adjust swappiness to 10 via /etc/sysctl.conf for sustained computational workloads.
5. Disable GUI services and unnecessary daemons such as systemd-resolved and ModemManager to free CPU cycles and reduce background I/O pressure.
Selecting Compatible Hardware Drivers
1. Identify GPU models using lspci | grep VGA and cross-reference with supported ASIC emulators or OpenCL-compatible devices.
2. For AMD GPUs, install rocm-opencl-runtime and validate compute capability with clinfo to confirm OpenCL 2.0+ support.
3. For NVIDIA hardware, deploy nvidia-driver-535 alongside cuda-toolkit-12-3, then verify CUDA availability using nvidia-smi and nvcc --version.
4. Load kernel modules explicitly: sudo modprobe amdgpu or sudo modprobe nvidia-uvm, then persist them in /etc/modules.
5. Set GPU power limits using rocm-smi --setpoweroverdrive or nvidia-smi -pl to stabilize thermal behavior during extended hashing sessions.
Compiling and Configuring BFGMiner
1. Clone the official BFGMiner repository from GitHub and checkout the latest stable release tag instead of using master branch.
2. Run ./autogen.sh followed by ./configure --enable-scrypt --enable-x11 --enable-opencl --enable-cuda to activate relevant algorithms and backends.
3. Compile with make -j$(nproc) and install globally using sudo make install to place binaries in /usr/local/bin.
4. Generate a configuration file at ~/.bfgminer/bfgminer.conf specifying pool URL, worker credentials, device targeting, and intensity settings per GPU.
5. Launch with bfgminer --config ~/.bfgminer/bfgminer.conf --log-file /var/log/bfgminer.log --debug to capture runtime diagnostics without terminal flooding.
Securing Remote Mining Operations
1. Create a dedicated non-root user named miner with no shell access and restrict sudo privileges to only /usr/local/bin/bfgminer.
2. Bind the mining daemon to localhost only and disable JSON-RPC remote access unless absolutely required for monitoring interfaces.
3. Configure UFW to deny all incoming connections except SSH on a non-standard port and allow outbound traffic solely to known mining pool IPs.
4. Rotate API keys and worker passwords weekly using a cron job that updates bfgminer.conf and reloads the process via systemctl restart bfgminer.service.
5. Store wallet.dat backups offline and encrypt them with gpg --symmetric --cipher-algo AES256 before transferring to air-gapped storage media.
Troubleshooting Common Failures
1. If clGetPlatformIDs returns CL_PLATFORM_NOT_FOUND_KHR, reinstall ROCm stack and ensure user belongs to render and video groups.
2. When nvidia-smi shows “No running processes found” but hash rate is zero, check if persistence mode is enabled via nvidia-smi -pm 1.
3. A segmentation fault during BFGMiner startup often indicates mismatched OpenCL library versions; verify LD_LIBRARY_PATH includes correct /opt/rocm/opencl/lib/x86_64 or /usr/local/cuda/lib64.
4. Pool connection timeouts may stem from DNS resolution failures; override resolver in /etc/systemd/resolved.conf to use 1.1.1.1 and restart systemd-resolved.
5. Sudden drops in accepted shares correlate with unstable memory clocks; underclock VRAM by 200 MHz using rocm-smi --setmemclock or nvidia-settings -a [gpu:0]/GpuMemoryTransferRateOffset[3]=0.
Frequently Asked Questions
Q: Can I mine Bitcoin directly with a GPU on Ubuntu?Bitcoin’s SHA-256 algorithm is no longer viable on GPUs due to ASIC dominance; attempting it yields negligible returns and high electricity cost per terahash.
Q: Why does BFGMiner fail with “No devices detected” even after driver installation?This occurs when OpenCL or CUDA libraries are not linked correctly; verify ldconfig -p | grep opencl and ensure vendor-specific ICD files exist in /etc/OpenCL/vendors/.
Q: Is it safe to run mining software as root?No. Running as root introduces critical privilege escalation risks; always operate under a restricted account with minimal filesystem and device permissions.
Q: How do I monitor temperature and fan speed without X11?Use rocm-smi for AMD or nvidia-smi -q -d TEMPERATURE,FAN for NVIDIA; parse output with awk and log to syslog via logger in a cron loop.
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.
- The sUSDe Yield, Aave Borrow Rate, and USDe Loop: A Tightrope Walk in DeFi's Big Apple
- 2026-09-12 12:45:01
- USDC Bridge CCTP, Stablecoin Chain Change, Bridge Shutdown: Navigating the New Era of Cross-Chain Transfers
- 2026-09-12 12:45:01
- Metaplanet Slashes Executive Share Pool by 41.1% Amidst Investor Outcry and Incentive Plan Withdrawal
- 2026-09-12 12:35:02
- Gold Price Today: Hot CPI and Yields Put Gold Under Pressure, But Buyers Resist
- 2026-09-12 04:35:01
- EU Finance Groups Pressure Lawmakers to Rethink Cap on Tokenized Securities, Eyeing US Competition
- 2026-09-11 12:50:02
- Bitget API Empowers Traders with CFD Access to Gold, Forex, and Stocks
- 2026-09-11 12:55:01
Related knowledge
What Is the Best Crypto Mining Setup for Beginners?
Sep 10,2026 at 12:40pm
Understanding Entry-Level Mining Hardware1. Chia farming requires no GPU clusters or ASIC rigs—only spare disk space on standard SATA or NVMe drives. ...
How to Build a Profitable Crypto Mining Setup in 2026?
Sep 11,2026 at 11:20pm
Hardware Selection Criteria1. Antminer S21 Hydro units dominate the 2026 efficiency landscape with 120 J/TH power consumption and integrated liquid co...
How to Check the Real Profit of a Bitcoin Mining Rig?
Sep 10,2026 at 09:40am
Power Consumption Measurement1. Use a calibrated wattmeter connected between the rig’s power supply and the wall socket to record real-time energy dra...
How to Calculate Crypto Mining ROI With Hardware Costs?
Sep 10,2026 at 03:00am
Understanding Mining ROI Fundamentals1. ROI in crypto mining is calculated as (Net Profit / Total Investment) × 100%, where Net Profit equals total re...
How to Calculate GPU Mining Profitability?
Sep 10,2026 at 11:20pm
Bitcoin Halving Mechanics1. Bitcoin’s protocol enforces a fixed supply cap of 21 million coins, with new coins introduced through block rewards. 2. Ev...
How to Check DOGE Mining Profitability Today?
Sep 11,2026 at 08:59am
Understanding Real-Time DOGE Mining Metrics1. Digital Hash Rate (DHS) serves as the core performance indicator for every active mining session. Each u...
What Is the Best Crypto Mining Setup for Beginners?
Sep 10,2026 at 12:40pm
Understanding Entry-Level Mining Hardware1. Chia farming requires no GPU clusters or ASIC rigs—only spare disk space on standard SATA or NVMe drives. ...
How to Build a Profitable Crypto Mining Setup in 2026?
Sep 11,2026 at 11:20pm
Hardware Selection Criteria1. Antminer S21 Hydro units dominate the 2026 efficiency landscape with 120 J/TH power consumption and integrated liquid co...
How to Check the Real Profit of a Bitcoin Mining Rig?
Sep 10,2026 at 09:40am
Power Consumption Measurement1. Use a calibrated wattmeter connected between the rig’s power supply and the wall socket to record real-time energy dra...
How to Calculate Crypto Mining ROI With Hardware Costs?
Sep 10,2026 at 03:00am
Understanding Mining ROI Fundamentals1. ROI in crypto mining is calculated as (Net Profit / Total Investment) × 100%, where Net Profit equals total re...
How to Calculate GPU Mining Profitability?
Sep 10,2026 at 11:20pm
Bitcoin Halving Mechanics1. Bitcoin’s protocol enforces a fixed supply cap of 21 million coins, with new coins introduced through block rewards. 2. Ev...
How to Check DOGE Mining Profitability Today?
Sep 11,2026 at 08:59am
Understanding Real-Time DOGE Mining Metrics1. Digital Hash Rate (DHS) serves as the core performance indicator for every active mining session. Each u...
See all articles














