Skip to content

Instantly share code, notes, and snippets.

@JulienKode
Last active December 20, 2017 14:42
Show Gist options
  • Save JulienKode/16529033e6dcb42f8525ac395831186e to your computer and use it in GitHub Desktop.
Save JulienKode/16529033e6dcb42f8525ac395831186e to your computer and use it in GitHub Desktop.
Install Miner
apt-get update
# Repo to install g++ gcc optimization for the CPU
apt-get install software-properties-common -y
add-apt-repository ppa:jonathonf/gcc-7.1
apt-get update
# Package to install XMRIG and CPU Limit
apt-get install git build-essential cmake libuv1-dev libmicrohttpd-dev gcc-7 g++-7 nano cpulimit -y
# Install XMRIG
git clone https://github.com/xmrig/xmrig.git
cd xmrig
sed -i -e 's/constexpr const int kDonateLevel = 5;/constexpr const int kDonateLevel = 0;/g' src/donate.h
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
make
# Add this to /user/local/bin
cp ./xmrig /usr/local/bin/
# Create miner user:
useradd miner -s/bin/bash -m
mkdir /home/miner/config
# Create Configuration file
nano /home/miner/config/config.json
sed -i "s/WORKER_ID/$HOSTNAME/g" /home/miner/config/config.json
# Download XMRig service
wget https://gist.githubusercontent.com/JulienKode/cfc25fff9e0ba87b62807fbbc8dea9b5/raw/c94928249a554485668c50130810fbc716af4775/xmrig.service -O /lib/systemd/system/xmrig.service
# Download CPULimit service
wget https://gist.githubusercontent.com/JulienKode/c9bf36acb02ba28552008145505119d9/raw/be7ddb31e4dbb75f2555283509e2a8357d959d60/xmriglimit.service -O /lib/systemd/system/xmriglimit.service
# Reaload and enable new services
systemctl daemon-reload
systemctl enable xmrig
systemctl enable xmriglimit
systemctl start xmrig
systemctl start xmriglimit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment