Ethereum Mining on Ubuntu and Debian

Ethereum has established itself as one of the big players in the cryptocurrency world. It’s value has been on a steady rise for well over a year, and it’s one of the most widely traded coins in the world.

Ethereum is also an open source technology, and the Ethereum blockchain is powering a whole new wave of web development and web technologies. Even though the initial wave of interest in Ethereum has subsided, it’s clearly not too late to get involved.

If you aren’t running the AMDGPU-PRO drivers, check out our guide on installing OpenCL for open source AMDGPU before going any further.

Before you begin with either install, make sure that you have the latest graphics drivers for your card with OpenCL support. That could be the proprietary NVIDIA drivers, the open source AMD drivers, or the AMDGPU-PRO drivers on Ubuntu.

NOTE
Installation of graphics drivers for your card is beyond the scope of this tutorial. Before you proceed please ensure that graphics drivers for your card are fully installed and up to date.

In this tutorial you will learn:

  • How to install Ethereum
  • How to install Ethminer mining software
  • How to install and configure Coin Wallet
  • How to start mining and connect to mining pool

Ethereum Mining on Ubuntu and Debian

Ethereum Mining on Ubuntu and Debian

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System A working install of Debian or Ubuntu Linux operating system
Software Ehtereum, Ethminer, Coin Wallet
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user
    1. Get ready your Ethereum wallet address

      Feel free to skip this step if you already have your Ethereum wallet address. This way, you have someplace for your Ethereum to be deposited. If you have a preference in wallet, by all means, use it. This guide is going to use Coin Wallet as an example. Use the following commands to install Coin Wallet on your Ubuntu and Debian Linux system:

      Ubuntu

      To install Coin Wallet on your Ubuntu system execute the following snap command:

      $ sudo snap install coin
      

      Debian

      To install Coin Wallet on Debian you might first need to install snapd. Once ready install the Coin Wallet. The command sequence to perform the entire installation might look something like this:

      $ sudo apt install snapd
      $ sudo systemctl enable snapd
      $ sudo systemctl start snapd
      $ sudo snap install coin
      


      Configure Your Wallet

      Open your new Coin Wallet. Depending on your desktop environment, it might be under the Internet section or in Other.

      Start Coin Wallet application

      Start Coin Wallet application

      On the first screen you will be asked whether you wish to open a new wallet or your existing crypto walet. Click new and follow instructions on how to generate a new wallet passphrase.

      WARNING
      Make sure to write down your new passphrase. No passphrase, no access to your wallet, and as a result you will not be able to access your funds.

      Once you have initiated your new wallet. Switch to Ethrereum coin in order to access your Ethereum wallet address.

      Switch to Ethrereum coin

      Switch to Ethrereum coin
      Obtain your Ethereum wallet address by clicking on Receive

      Obtain your Ethereum wallet address by clicking on Receive

      The finished product will have your wallet your address. Take a note of your address as the address is the important part. That’s what you’ll use to set up your mining operations and to buy and sell with Ethereum.

    2. Install The Ethereum Packages

      There is an official Ethereum PPA with all of the packages that you’ll need to start out with Ethereum. There are a few more programs that you’ll install in this guide, but this is the core. The PPA is designed for Ubuntu, but it works great with Debian too.

      Ubuntu

      Install Ethereum on Ubuntu

      Install Ethereum on Ubuntu

      Using the PPA is obviously easier on Ubuntu. Add it to your system.

      $ sudo add-apt-repository ppa:ethereum/ethereum
      $ sudo apt update

      Now, install the Ethereum package.

      $ sudo apt install ethereum

      Debian

      On Debian, the process is essentially the same, it’s just not as automatic. Start by creating a file at /etc/apt/sources.list.d/ethereum.list.

      In that file, place the following two lines.

      deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main 
      deb-src http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main

      Save and exit. Next, you’ll have to import the GPG key for the PPA.

      $ sudo apt-key adv --keyserver keyserver.ubuntu.com  --recv-keys 2A518C819BE37D2C2031944D1C52189C923F6CA9

      After Apt’s done importing the key, update your system, and install the Ethereum package.

      $ sudo apt update
      $ sudo apt install ethereum

      Confirm that ethereum is installed:

      $ dpkg -l | grep ethereum
      ii  ethereum     1.9.25+build24398+bionic     amd64   Meta-package to install geth and other tools
      


    3. Install Ethminer

      It’s not really profitable to mine Ethereum with your CPU. GPU mining, however, does make sense with the right configuration. There are two programs for GPU mining, Ethminer and Claymore. This guide is going to cover Ethminer. They’re both perfectly good options, though.

      Swing by the project’s releases page, and pick up the latest Linux tarball. Unpack the tarball in the directory where you want to run Ethminer. It’s a pre-compiled binary, so that’s all you need to do before you start using it.

      DID YOU KNOW?
      Ethminer is only one among many other miners available to be used to mine Ethereum or other cryptocurrencies. Other examples of mining software include Gminer, Team Red Miner, lolMiner or PhoenixMiner just to name a few. Ethminer is a great tool, but explore and try some other miners too just to see if you can increase your mining hash rate.

      Below is an example on how you can download, extract and execute Ethminer v0.18 on Ubuntu and Debian Linux:

      $ mkdir ethminer
      $ wget -O ethminer/ethminer.tar.gz https://github.com/ethereum-mining/ethminer/releases/download/v0.18.0/ethminer-0.18.0-cuda-9-linux-x86_64.tar.gz
      $ tar xzf ethminer/ethminer.tar.gz -C ethminer/
      $ ethminer/bin/ethminer --help
      ethminer 0.18.0
      Build: linux/release/gnu
      
      Ethminer - GPU ethash miner
      minimal usage : ethminer [DEVICES_TYPE] [OPTIONS] -P... [-P...]
      
    4. Start Mining

      Open your terminal, and head into the directory where you unpacked Ethminer. The help function for Ethminer isn’t as… helpful as it could be. The syntax formatting can be a bit weird. Still, it’s worth checking out. There are two main things that you’ll need, the flag to specify your compute and the one for your pool. -G is for OpenCL, and -U works with Cuda. The -P flag lets you specify your pool.

      So, pick a pool. There are a few great ones. Ethpool and 2Miners are all good places to start. None of them require you to sign up or make an account. You only provide your Ethereum address via the mining command.

      Speaking of the mining command, it’s finally time to get started with that. Take a look at the Ethminer examples for a better syntax guide. Each pool is slightly different, but there’s an example for 2Miners and Ethpool below.

      Both bellow commands are executed from the previously extracted ethminer/bin directory:

      2Miners Ethereum mining command example:

      $ ./ethminer -G -P stratum1+tcp://YOUR_ETHEREUM_ADDRESS_HERE@eth.2miners.com:2020

      Ethpool Ethereum mining command example.

      $ ./ethminer -G -P stratum1+tcp://YOUR_ETHEREUM_ADDRESS_HERE@us1.ethpool.org:3333


      Begin Ethereum mining with ethminer.

      Begin Ethereum mining with ethminer.

      Once you enter in your command, Ethminer will start up mining. It will run until you cancel. As you mine, you contribute to your pool. The pool will then award a share of the mined Ethereum from the entire pool to you based on the amount of work you contributed.

      The more you contribute, the more Ethereum you make. That’s all based on GPU computing power, and you can find average GPU hashrates and profitability calculators online to help you see if you’re going to be making a profit from your setup.



  1. Monitor your Ethereum mining operation

    At this point you just sit back and let the hardware to do the work. Before you leave your mining gear unattended, first wait for you first submitted mining share, as this will ensure that everything is going according the plan. Depending on the speed of your hardware it may take some time.

    First mining share accepted by the 2miners.com pool

    First mining share accepted by the 2miners.com pool.
    monitor your Ethereum mining progress and current earnings

    Once your miners submits a first share you should be able to lookup your Ethereum wallet address on a respective mining pool to monitor your Ethereum mining progress and current earnings.

Closing Thoughts

Cryptocurrency mining is volatile. Hardware isn’t always cheap, and power costs keep climbing. Sometimes you can win big. Other times you’ll go broke pretty fast. Do your homework before making any kind of investment.

If you end up deciding that mining isn’t for you, you can still use the wallet to trade in and use Ethereum. Cryptocurrency is currency after all, and it’s still great for its intended purpose.

Troubleshooting

The following message appears when tryting to install ethereum package on Debian Linux:

apt install ethereum
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ethereum : Depends: abigen but it is not going to be installed
            Depends: bootnode but it is not going to be installed
            Depends: evm but it is not going to be installed
            Depends: geth but it is not going to be installed
            Depends: clef but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

The resolve this issue make sure that you have included the following Ubuntu repository as shown above:

deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main 
deb-src http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main


Comments and Discussions
Linux Forum