How to Mine Monero on Linux

Mine Monero on Linux

By now, you’re either deeply invested in the world of cryptocurrency or tired of hearing about it. Either way, though, some currencies stand out for one exceptional trait or another. Monero is one of these currencies.

Monero is a privacy-focused currency that utilizes an open source code base and aims to keep transactions anonymous with the aid of high-grade encryption. With Monero, transactions are private.

It’s also one of a handful of currencies on the rise in 2018. It hasn’t exploded like Bitcoin or Ethereum, but that’s a good thing. Monero is inexpensive enough to invest in, and it’s still possible to mine with a regular computer.

Also read: How to Mine ZCash on Linux

Installing the Wallet

The first thing that you should probably do is set up your Monero wallet. The developers of the currency provide a complete graphical option directly on their website. Download the latest tarball; you’re probably looking for the 64bit Linux package.

Unpack the Monero Wallet

Set up a directory where you would like to run your wallet. Something in your “/home” folder is usually a good bet. Unpack the tarball there.

Enter the directory where you unpacked the wallet tarball, and run the executable shell script within:

./start-gui.sh

Monero Select Language

When you first launch it, the wallet will start by asking for your language.

Create A Monero Wallet

Next, it will ask if you want to create or import a wallet. You’ll be creating one if this is your first time.

Name Your Monero Wallet

It will then ask you to name your wallet and provide a location for it. The setup utility will give you a string of random words that you’ll need in order to recover your wallet. Write those down or, ideally, store them in an encrypted file.

Monero Wallet Password

You will then be prompted to establish a password for your wallet. Make this as secure as possible and choose something memorable. You won’t be able to recover this one.

Monero Wallet Daemon

The setup will also ask how you want the daemon run. The defaults are fine with this.

Monero Wallet Setup Complete

After that, you’ll get a nice screen telling you that everything is set up.

Monero Wallet Syncing Blockchain

When you complete everything, the daemon will start up and connect you to the Monero network. It will take some time to synchronize itself with the rest of the blockchain, so be patient.

Monero Wallet Address

On the side menu click on the “Receive” tab to display and copy your address when needed.

Install the Miner

There are a few options for mining Monero, but XMR-Stak is easily one of the most complete and simplest to use, and it contains support for CPU and GPU mining with both AMD and NVIDIA cards. XMR-Stak also features a web interface that provides better visualization for your mining data. As an added bonus, XMR-Stak can mine for a few other up-and-coming altcoins, like Aeon.

Swing by the project’s release page, download the latest source tarball, and unpack it in the same directory where you’re running your wallet or a different build location – which one is up to you.

Compile XMR-Stak

You’re going to need to compile the mining software from its source. To begin, grab the required packages for your distribution.

Debian/Ubuntu

sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev

Fedora

sudo dnf install gcc gcc-c++ hwloc-devel libmicrohttpd-devel libstdc++-static make openssl-devel cmake

Arch Linux

sudo pacman -S --needed base-devel hwloc openssl cmake libmicrohttpd

Make a build directory in the unpacked source.

mkdir xmr-stack/build

Change into that directory.

cd xmr-stack/build

Use the cmake tool that you just installed to prepare the source code. You will probably get an error for the graphics card that you don’t have. Just add in the flag that the error suggests, and run cmake again.

cmake ..

That might take a while, depending on your computer. When it’s done, you can fully compile and install the miner. It won’t install system-wide. Instead, it will reside in a ‘bin’ directory within your build directory.

sudo make install

Find a Pool

As with any cryptocurrency, mining Monero without the aid of a pool isn’t a great idea. Pools help boost your profitability. They guarantee a flow of income rather than the more sporadic and usually random results that you’d get mining solo.

There are a lot of great pools that you can join. Take a look at moneropools.com, and pick one for your region that’s relatively active with a decent total hash rate. Obviously, look around and compare to figure out what’s best for you.

Start Mining

Now you’re ready to start mining. Open a terminal and construct the command you need to mine using your wallet address and pool.

./xmr-stak --currency monero -o url.ofyoupool.com:1000 -u YOURWALLETADDRESS

You need to tell XMR-Stak that you’re mining Monero. You also need to provide the URL and port number for your pool. Finally, you’re going to need to pass in your wallet address in order to get paid. That is the whole point, right?

As long as your miner is running, you’ll be able to pull up information about your progress through the web interface. It’s accessible by default on port 16000 on the mining machine. To reach the web interface, punch in the mining computer’s IP address with port 16000 on the browser of a computer on your network.

The web interface gives you a series of tables that provide vital stats on the progress of your mining machine. Some of the info is interesting, like per-core hashrates and the progress being made on your pool.

You’re now fully equipped to start mining Monero on your Linux machine. Keep an eye out for changes in the Monero ecosystem and fluctuations in the exchange rate. Always keep your wallet and mining computer as secure as possible to avoid theft and currency loss. Monero can be a great currency to start mining with, and it has excellent potential for the future.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.