Build Ubuntu Mining Rig
Build Ubuntu Mining Rig
04 LTS server
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).
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
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
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.
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.
execute ./xmrig
Monitor the app for a bit to see its connected and getting new jobs and the hashrate.
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.
execute ./xmrig
Monitor the app for a bit to see its connected and getting new jobs and the hashrate.