0% found this document useful (0 votes)
244 views

Build Ubuntu Mining Rig

This document provides instructions for installing Ubuntu 18.04 LTS server on a mining rig, configuring it for cryptocurrency mining, and installing xmrig to begin mining. Key steps include: 1. Burning the Ubuntu 18.04 ISO to a USB drive and booting the rig from it to install Ubuntu. 2. Updating and upgrading Ubuntu after installation is complete. 3. Configuring the system to allocate 1GB hugepages for mining and install necessary applications like msrprobe. 4. Downloading, configuring, and running xmrig to begin the mining process. 5. Using screen and ssh to remotely manage and monitor the mining process without disrupting

Uploaded by

Kleant Zhubi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
244 views

Build Ubuntu Mining Rig

This document provides instructions for installing Ubuntu 18.04 LTS server on a mining rig, configuring it for cryptocurrency mining, and installing xmrig to begin mining. Key steps include: 1. Burning the Ubuntu 18.04 ISO to a USB drive and booting the rig from it to install Ubuntu. 2. Updating and upgrading Ubuntu after installation is complete. 3. Configuring the system to allocate 1GB hugepages for mining and install necessary applications like msrprobe. 4. Downloading, configuring, and running xmrig to begin the mining process. 5. Using screen and ssh to remotely manage and monitor the mining process without disrupting

Uploaded by

Kleant Zhubi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Installation of Ubuntu 18.

04 LTS server

Commands will be bolded (example ifconfig).

1. Download the iso file from here https://ubuntu.com/download/server/thank-


you?country=US&version=18.04.3&architecture=amd64 Save the file to disk.
2. Insert a USB Drive into your USB port (at least 8GB size, and it will be overwritten!).
3. Burn the ISO to the USB drive. I use balenaEtcher for this step. https://www.balena.io/etcher/
4. Go to your mining rig and insert the USB drive and reboot. When it’s done POST step, you will
have a chance to choose a boot drive, press that key. Alternatively, you can set the USB as the
first boot drive in bios (check your motherboard manual for configuring).
5. It will take a minute or so for the booting process and the Ubuntu installer (GRUB) to boot up
Ubuntu. At this point you will go thru choosing username & password/machine
name/language/keyboard/installation disk/proxy setup/optional software/network
configuration.

a. Some of these steps will autoconfigure (network adapter will default to dhcp). The
installation target (SSD/hdd) will give you the option to use all of it and install lvm or
not. I use a 128GB SSD I have around and choose to use the entire disk.

6. One of the last items after optional software to install (I only check canonical repo on that
screen) is the option to install OpenSSH. INSTALL OPENSSH (you will need it later).

It will go thru the installation process and finally prompt for reboot. press Enter and it will tell you to
remove the installation media, pull the USB and press enter again.

At this point, your system will reboot to Ubuntu, it may take a few minutes the first time as it has to
generate some keys. But you will finally get a login prompt. Login with the username and password you
choose during the setup prompts.

If you look at the screen after login in, you notice a few lines mentioning upgrades and security patches
that are available, you need to patch the system so all the fixes and patches are current (This is good
practice for any o/s).

At the prompt running the follow commands:

sudo apt-get update (if prompted put in your password). This update the apt database and marks
those updated files for pulling and installing in the next step.

sudo apt-get upgrade (if prompted put in your password). It will apply all the patches and updates.
sudo reboot now
Configuration of Mining Rig

Okay the basic installation and updating of Ubuntu is now done, and you have rebooted. Time to get
this machine mining! But we have to do a few things to set up the environment for maximum hashing.
Now as a general rule, you should never run applications as a privilege user (root or super user). So, my
setup is using the non-privilege user that I create when I installed my Linux. This means a few things
need to done to allow for xmrig to take advantage of new features.

Login in and run ifconfig to get your ip address (you will need it later).

$ ifconfig

enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500


inet 192.168.1.108 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 2600:1700:14b0:2740:7285:c2ff:fed9:ce76 prefixlen 64 scopeid 0x0<global>
inet6 fe80::7285:c2ff:fed9:ce76 prefixlen 64 scopeid 0x20<link>
ether 70:85:c2:d9:ce:76 txqueuelen 1000 (Ethernet)
RX packets 66735 bytes 6527483 (6.5 MB)
RX errors 0 dropped 16852 overruns 0 frame 0
TX packets 2681 bytes 334347 (334.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfc900000-fc91ffff

Next you will need to installed a few additional apps, specifically msrprobe, screen and hugeadm.

sudo apt-get install msrprobe (if prompted enter password) -- This is needed for the some of the msr
tweaks.

sudo apt-get install screen (if prompted enter password) - allows applications to run in a detached
session, that logging out will not kill.

sudo apt-get install hugeadm (if prompted enter password) -- This allows for easier management of
hugepages in Linux

Now we modify the GRUB loader to preallocate 1GB hugepages (I know version 5.2.1 does this
automatically, but you need to run as root, and that is a big no no as a general rule)

sudo vi /etc/default/grub (if prompted enter password) -- this will open vim editor with the grub file
loaded

change the GRUB_CMDLINE_LINUX_DEFAULT line to


GRUB_CMDLINE_LINUX_DEFAULT="default_hugepagesz=2M hugepagesz=1G hugepages=3"
save and exit vi

sudo update-grub (if prompted enter password) -- this will compile GRUB and update the bootloader

sudo reboot now (if prompted enter password) -- Again the reboot.
Once rebooted and logged in

sudo hugeadm --pool-list (if prompted enter password) -- it will show the 1GB pool is created and 3 are
allocated.

Size Minimum Current Maximum Default

1073741824 3 3 3

Okay we have all the peripheral stuff done, time to install xmrig and get mining!

Download and install xmrig from GitHub (latest is 5.2.1) on your server. You will extract the app and it
will be in its own directory under your home directory

switch to the xmrig directory and edit the config.json enable the 1GB option and update your wallet
address, mining pool, coin, etc. save the config.json

Now I have created a shell file to allocate the 2M pages needed and run the wrmsr commands so that if I
need to reboot, it's just a few commands to be back up and running.

create shell file for these commands.

sudo hugeadm --pool-pages-min 2M:1500


sudo modprobe msr
sudo wrmsr -a 0xC0011022 0x510000
sudo wrmsr -a 0xC001102b 0x1808cc16
sudo wrmsr -a 0xC0011020 0
sudo wrmsr -a 0xC0011021 0x40

save and make it executable (chmod +x)

execute the shell file ./<shell file>

execute ./xmrig

Monitor the app for a bit to see its connected and getting new jobs and the hashrate.

At this point your configuration is done. Shutdown the server –

sudo shutdown now (if prompted enter password)

turn off the power supply and unplug it (just being cautious). Remove the video card and restart the
server.
Final Setup

On your desktop, start putty and the Host Name field put in the server ip address (you did write that
down from when I mentioned it earlier, right?) login. This first time you connect you will be asked about
a certificate, select yes/okay.

change to the xmrig directory

run screen command (example screen -S xmrig)

execute the shell file ./<shell file>

execute ./xmrig

Monitor the app for a bit to see its connected and getting new jobs and the hashrate.

to detach from the screen session press CTRL A and then d

to reattach to a session -- screen -r (since its the only session)

That is pretty much it.

You might also like