Skip to content

Instantly share code, notes, and snippets.

@gerardvidamo
Last active June 24, 2022 10:11
Show Gist options
  • Save gerardvidamo/a5682145df27957834381b03a0949291 to your computer and use it in GitHub Desktop.
Save gerardvidamo/a5682145df27957834381b03a0949291 to your computer and use it in GitHub Desktop.
Ubuntu 16.04 LTS Crypto Mining

Getting started

Build Specification

Prerequisites

Note - did not encrypt home directory or xda drive

  • No packages installed yet

  • Enter Desktop after standard boot of Ubuntu - not in safe mode or TTY space - just standard desktop

  • $ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target Disable Sleep/Suspend

Install SSH and package updates (OPTIONAL)

At the Xubuntu desktop, press CTRL+ALT+T to open a terminal window.

Install SSH by typing:

$ sudo apt-get install openssh-server

With SSH installed, you can unplug the keyboard/mouse/monitor from your miner, and complete the rest of the installation from your desktop computer. Simply download Putty onto your desktop, run it, and enter the IP address of your mining rig (type ifconfig at the Xubuntu terminal to find your miner’s address if you don’t know it—it will probably look like 192.168.0.x). That should bring up a remote terminal session to your miner, which is more or less just like sitting at the keyboard in front of it.

If you plan to manage your mining rig remotely over the internet, you’ll need to forward port 22 on your router to your miner. Make sure that you use a strong Xubuntu password!

Setup should be pretty quick from this point, as now you can simply copy text from this webpage (highlight it and press CTRL+C) and then paste it into your Putty session by simply right-clicking anywhere inside the Putty window. I highly recommend that you complete the remainder of the guide in this manner, as it eliminates the risk of typos!

Install package updates by typing (or copying & pasting via right-click into Putty) the following command:

$ sudo apt-get dist-upgrade

Download NVIDIA Drivers or use this command line

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-384

Install Claymore’s Ethereum miner

cd ~/Downloads
sudo apt install curl
curl -L -o claymore_11.0_miner.tar.gz https://drive.google.com/uc?id=1fWZ40uqEkFihDnf0kw8hYpobNRF1QCxc

Then create a new directory for it, and unpack it there:

sudo mkdir /usr/local/claymore11.0
sudo tar -xvf claymore_11.0_miner.tar.gz -C /usr/local/claymore11.0

Then let’s head over to the installation directory and create a startup script. Note that commands 2-5 below just clean up the installation directory a bit by removing an intermediary directory that was included in the original tar archive:

cd /usr/local/claymore11.0
cd Clay*
sudo mv * /usr/local/claymore11.0
cd ..
sudo rm -r Clay*
sudo chown root:root ethdcrminer64
sudo chmod 755 ethdcrminer64
sudo chmod u+s ethdcrminer64
curl -L -o mine.sh https://gist.githubusercontent.com/gerardvidamo/a5682145df27957834381b03a0949291/raw/d6082b442213c26c894ebaa37863b8d1f8a23685/ubuntu_1604_OC_nvidia.sh
sudo chmod +x mine.sh

Create auto-start scripts

sudo apt install screen
cd ~
sudo nano miner_launcher.sh
sudo nano /etc/rc.local
/home/YOUR_XUBUNTU_USERNAME/miner_launcher.sh 15 &

Use this script replace YOUR_XUBUNTU_USERNAME

#!/bin/bash
DEFAULT_DELAY=0
if [ "x$1" = "x" -o "x$1" = "xnone" ]; then
   DELAY=$DEFAULT_DELAY
else
   DELAY=$1
fi
sleep $DELAY
cd /usr/local/claymore11.0
su YOUR_XUBUNTU_USERNAME -c "screen -dmS ethm ./mine.sh"
$ sudo chmod +x miner_launcher.sh

Create an alias to easily check on the Claymore miner process

$ sudo nano .bashrc

Copy and paste this script

alias miner='screen -x ethm'

Enable Over Clock NVIDIA

sudo update-grub
sudo nvidia-xconfig --enable-all-gpus
sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration
sudo systemctl restart lightdm.service
#!/bin/bash
DEFAULT_DELAY=0
if [ "x$1" = "x" -o "x$1" = "xnone" ]; then
DELAY=$DEFAULT_DELAY
else
DELAY=$1
fi
sleep $DELAY
cd /usr/local/claymore11.0
su rig_1 -c "screen -dmS ethm ./mine.sh"
#!/bin/bash
export DISPLAY=:0
# ----------------------------------------------------------------------
# ETC / ETH MINING https://ethermine.org/
# NVIDIA OC Settings in Ubuntu 16.04 LTS
# CREATED BY: Gerard Vidamo
# https://gist.github.com/gerardvidamo/a5682145df27957834381b03a0949291
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# General Settings
# ----------------------------------------------------------------------
MINING_SERVER="us1-etc.ethermine.org"
STATRUM_PORT="4444"
WALLET_ADDRESS="0xf5AECE0c7aF3DDC3e295B5B0C7dAf3a107beA5fC"
MINERS_NAME="5-1070-mining-1"
# Claymore Miner = 1 | Ethminer = 2 | Phoenix Miner = 3
MINER=1
# ----------------------------------------------------------------------
# OC Settings
# ----------------------------------------------------------------------
OC_ENABLED=false
# Number of GPUs Installed
GPU_INSTALLED=5
# Enable Fan Control
GPU_FAN_STATE=70
# Spefify Fan Speed
GPU_FAN_SPEED=30
# OverClock GPU
GPU_GRAPHICS_OFFSET=110
# OverClock Memory
GPU_MEMORY_OFFSET=650
printf "\033[1;34m :::: ::: ::: ::: ::::::::::: ::::::::: ::::::::::: ::: :::::::: ::::::::\n"
printf " :+:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:\n"
printf " :+:+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ \n"
printf " +#+ +:+ +#+ +#+ +:+ +#+ +#+ +:+ +#+ +#++:++#++: +#++:++#++:++ +#+ +:+ +#+ \n"
printf " +#+ +#+#+# +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ \n"
printf " #+# #+#+# #+#+#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+# \n"
printf "### #### ### ########### ######### ########### ### ### ######## ######## \033[0m\n\n"
printf "Visit \033[4;32mhttps://gist.github.com/gerardvidamo/a5682145df27957834381b03a0949291\033[0m for updates.\n\n"
# ----------------------------------------------------------------------
# Miners
# ----------------------------------------------------------------------
case $MINER in
1) MY_MINER="Claymore Miner"
;;
2) MY_MINER="Ethminer"
;;
3) MY_MINER="Phoenix Miner"
;;
esac
# ----------------------------------------------------------------------
# Load Over Clock Settings
# ----------------------------------------------------------------------
sleep 2
printf "\033[0;32m[Status]\033[0m \033[0;33mInitializing Over Clock Settings...\033[0m\n\n"
sleep 2
printf "\033[0;37m--------------------------------------------------------------------------------------------------------------\033[0m\n"
printf "\033[0;37m| Over Clock Settings |\033[0m\n"
printf "\033[0;37m--------------------------------------------------------------------------------------------------------------\033[0m\n"
printf "| Number of GPU installed : \033[0;32m${GPU_INSTALLED} GPUs \033[0m|\n"
printf "| Fan Control Speed : \033[0;32m${GPU_FAN_STATE}%% \033[0m|\n"
printf "| Target Fan Speed : \033[0;32m${GPU_FAN_SPEED} \033[0m|\n"
printf "| Graphics Clock OffSet : \033[0;32m+${GPU_GRAPHICS_OFFSET} mhz \033[0m|\n"
printf "| Memory Transfer Rate OffSet : \033[0;32m+${GPU_MEMORY_OFFSET} mhz \033[0m|\n"
printf "\033[0;37m--------------------------------------------------------------------------------------------------------------\033[0m\n"
if [ "$OC_ENABLED" = true ]; then
sudo nvidia-persistenced --persistence-mode
sudo nvidia-smi -pm ENABLED
sudo nvidia-smi -pl 100
for i in `seq 1 ${GPU_INSTALLED}`;
do
GPU=`expr $i - 1`
sudo nvidia-settings -c :0 -a '[gpu:'"$GPU"']/GPUFanControlState='"$GPU_FAN_STATE"''
sudo nvidia-settings -c :0 -a '[fan:'"$GPU"']/GPUTargetFanSpeed='"$GPU_FAN_SPEED"''
sudo nvidia-settings -c :0 -a '[gpu:'"$GPU"']/GPUMemoryTransferRateOffSet[3]='"$GPU_MEMORY_OFFSET"''
sudo nvidia-settings -c :0 -a '[gpu:'"$GPU"']/GPUGraphicsClockOffSet[3]='"$GPU_GRAPHICS_OFFSET"''
done
printf "\033[1;32m[Status]\033[0m \033[0;33mOC settings successfully changed.\033[0m\n"
else
printf "\033[1;32m[Status]\033[0m \033[0;33mOC settings is off.\033[0m\n"
fi
# ----------------------------------------------------------------------
# Preparing to run Miner
# ----------------------------------------------------------------------
sleep 2
printf "\033[1;32m[Status]\033[0m Preparing to run \033[0;33m${MY_MINER}\033[0m\n\n"
case $MINER in
1)
export GPU_MAX_ALLOC_PERCENT=100
./ethdcrminer64 -epool ${MINING_SERVER}:${STATRUM_PORT} -ewal ${WALLET_ADDRESS}.${MINERS_NAME} -epsw x
;;
2) # NO SETTINGS YET
;;
3) # NO SETTINGS YET
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment