top of page

DISCLAIMER: I have no certificates or qualifications in programming or computer science in general.  This guide is written to share the method that I have found works for me.  I have duplicated these results multiple times.  Follow and deviate at your own risk.

This guide shows you how to install Ubuntu, install XMRig, configure it, and get it to run automatically when the computer starts in the Terminal so you can watch it.  

Updated 28JUL2021

Making a bootable USB stick with Ubuntu

I started this whole process in Windows (as I did not have a computer running Linux yet) and I have not done this process (burning a bootable stick) in Linux or Mac.  This section is for Windows users.

I use a program called "Rufus" to create a bootable flash drive.  It can be found here: https://rufus.ie/en_US/

Go here: http://releases.ubuntu.com/ and download the Ubuntu release you want.  I used 18.04 most of the time, but I used 16.04 on a much older computer.  18.04 just didn't want to work with it.  I also just used the latest release 20.04.2.0 and it worked the best yet.

Once that file is downloaded, plug in the USB stick, open up Rufus, select the image ISO file from your downloads folder, make sure you have the correct drive letter selected and FAT32 for your File System, and click Start  

A quick note about USB drives and FAT32.....if the stick holds more space than 32 gigs, you may not be able to format it as FAT32.  I recommend buying a cheap 32gig or smaller drive to use as your OS flashing drive.

Now you have a USB stick that a computer can boot Linux from.

Installing Ubuntu

With your computer power off, plug in your new USB stick and turn on the power.  Get into your BIOS by pressing del, F2, F12, whatever your motherboard tells you during the few-seconds splash screen at start up.  In there you should find an option to boot from your USB stick. 

Click the "Install Ubuntu" option once you boot from USB.  Once that comes up, select "normal install" and select "download updates".  You don't need 3rd part stuff so leave that unchecked.  Follow the prompts.  I want my computer name and everything to be simple and short in order to simplify the rest of my life.  I will also select "Log In Automatically" which almost never works.  Select it anyway.

Finish the install, reboot, remove USB.

If Auto-Login Fails

Press ctl-alt-t to open a Terminal.  We need to enable a timed login instead of auto-login.  For some reason, this works.

$     sudo nano /etc/gdm3/custom.conf

uncomment out the three "timed login" sections.  Delete the # sign in front of "TimedLogInEnable", "TimedLogIn", and "TimedLogInDelay".

Change the value of "TimedLogIn" to whatever your username is.  Change the value of "TimedLogInDelay" from 10 to 1.

save and exit.  ctl-x, y, enter.

XMRig Install

------------------------------------------------------------------------------------------------------------------------------------------------------

A few tricks I wish I knew starting out in Linux:

1) To open a terminal, press CTL-SHIFT-T

2) To copy and paste, simply highlight the text you want to copy, then middle click in the terminal.  

3) To repeat a previous command, you can just hit the up arrow to scroll through previously entered commands in the terminal.

4) You can hit tab to autofill possible entries in the terminal.  For example, instead of typing a full file name, you can type the first letters and then hit tab which will fill in the rest by searching for that file.

------------------------------------------------------------------------------------------------------------------------------------------------------

You can compromise your security a little in order to increase simplicity by removing the password requirement for "sudo" commands.  Do this by putting in the Terminal:

$     sudo visudo

find the line that starts with "%sudo" and make it look like: %sudo   ALL=(ALL) NOPASSWD: ALL

ALTERNATIVELY:

You can also enter 

$     sudo su

and then omit the "sudo" bit from each following entry.

ALTERNATIVELY ALTERNATIVELY:

You can enter your password repeatedly as required

Now for the actual install...I decided to show you how to install MoneroOcean because it gives you nearly 200-300% to your hash rate by switching algorithms and you will get paid in Monero at that modified rate.  If you do NOT want to use Monero Ocean for any reason, replace "sudo git clone https://github.com/MoneroOcean/xmrig.git" with "sudo git clone https://github.com/xmrig/xmrig.git".

Another great pool is XMRvsBeast.  They have a raffle for bonus and boost hashrates and a great community.  If Monero Ocean is no longer giving you an advantage, I highly recommend this pool.

In terminal: 

$     sudo apt install -y build-essential cmake libuv1-dev libmicrohttpd-dev libssl-dev libhwloc-dev gcc-8 g++-8

$     sudo apt install software-properties-common

$     sudo add-apt-repository ppa:jonathonf/gcc

S     sudo apt install git-all -y

S     sudo apt update && sudo apt upgrade -y

$     sudo reboot

once back in (and you should have gotten in right away thanks to the auto login work around), in the terminal put either:

$     sudo git clone https://github.com/MoneroOcean/xmrig.git

OR

$     sudo git clone https://github.com/xmrig/xmrig.git

depending if you want MoneroOcean or to mine with XMRvsBeast

$     cd xmrig

$     sudo mkdir build

$     cd build

$     sudo cmake .. -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8

$     sudo make

XMRig is now installed and should work, but we are missing the config file.  If you were previously mining on one of the pools and wish to reinstall, go to your main folder by simply opening a new terminal with ctl-alt-T and inputting:

$     sudo rm -r xmrig

Then start the guide over with the version you wish to switch to (MO or XvB).  So you would remove xmrig, then input the "git clone *website url here*".

Configuration File

Go to https://xmrig.com/wizard and fill in the shit and download the config.json file

Click add pool -> custom pool

Under Host add gulf.moneroocean.stream with port 10128

Insert wallet address under User

Add name of miner to password box

Click add pool

Backends leave default to CPU

Misc change to 1 (or 5, whatever)

Hit download button at top right in green

Select Linux, and hit generic option and download
 

(

full list of port numbers: 

  • 10032: Old CPU/GPU

  • 10128: Modern CPU/GPU

  • 18192: CPU/GPU farm

  • 20128: SSL/TLS

  • 10001: Very old CPU (1000 diff)

 )

Go to wherever the zip file is, unzip it by simply clicking and dragging the config.json out of it, or by running (assuming it downloaded to your downloads folder):

$     cd /home/username/Downloads 

$     sudo tar-xf filename.tar.gz

(replace the last bit with the full file name)

to copy it to where it needs to go so XMRig finds it we will do (starting in the folder where the downloaded and unzipped config.json is):

$     sudo cp config.json /home/username/xmrig/build

Now it will move to the xmrig folder.  You can try just clicking and dragging or copy and pasting but I found I needed to be an administrator or super user or whatever and learning the copy command was easier.

If you are still having issues finding, copying, unzipping the config.json, just go to the final page of the wizard, copy the code to your clipboard, navigate to your xmrig/build folder, and run sudo gedit to open the text editor.  Paste the code there, and save it as config.json.  You then wont need to copy or unzip any files.

Navigate to: 


$     cd /home/username/xmrig/build

execute xmrig for a few minutes so it populates the info in the config file.

$     sudo ./xmrig

give it a few minutes until you see it actually given jobs.  I would just wait 3-5 minutes if you are unsure what this looks like.  On the first run up, it is going to run a series of algorithm tests to calibrate your computer for the algo-switching function.

Press ctl-c (stops the process)

Edit the config now.

$     sudo gedit config.json

near the top, under "randomx", change "1gb-pages": false to "1gb-pages": true

then scroll down and verify that all the personal information is correct.  Main things to verify are you wallet address, password, and TLS is false.  If TLS is true, then it wont connect properly to the pool (might have been selected in the config wizard step by accident).

Hugepages and 1GB Pages

-- THIS SECTION IS NO LONGER NEEDED BUT I WILL LEAVE IT HERE FOR REFERENCE.  IF YOU HAVE ISSUES WITH HUGE PAGES OR 1GB PAGES, A FRESH INSTALL WORKED FOR ME AND IT'S BETTER TO NOT EVEN MESS WITH IT --

I have no idea what I am really doing here, I just combined advice from these two guides: (https://medium.com/@tomas_savenas/30-increase-in-cpu-mining-hash-rate-by-enabling-huge-pages-8af5eedb7d62) (https://github.com/xmrig/xmrig/issues/1411):

First for hugepages:


$    sudo bash -c "echo vm.nr_hugepages=1280 >> /etc/sysctl.conf"

$     sudo -i

$     sudo sysctl -w vm.nr_hugepages=$(nproc) 

$     for i in $(find /sys/devices/system/node/node* -maxdepth 0 -type d);do    echo 3 > "$i/hugepages/hugepages-1048576kB/nr_hugepages";done

$     sudo bash -c "echo vm.nr_hugepages=$(nproc) >> /etc/sysctl.conf"

$     exit


then for the 1gb pages:

$     sudo su

$     sudo echo "vm.swappiness=0" >> /etc/sysctl.conf

$     lscpu | grep -w "pse\|pdpe1gb"

If you don't see "pse" and "pdpe1gb" highlighted in red it is a hardware limitation and you can stop here.

$     sudo echo "3" >> /sys/devices/system/node/node0/hugepages/*1048*/nr_hugepages

I skip one here (according to the guide) because whatever a "NUMA node" is...I only have one and the second command in the guide doesn't do anything if you only have one.

$     sudo echo "3" >> /sys/devices/system/node/node*/hugepages/*1048*/nr_hugepages

$     sudo nano /etc/default/grub

edit line: GRUB_CMDLINE_LINUX=""


to: GRUB_CMDLINE_LINUX="hugepagesz=1GB default_hugepagesz=1GB hugepages=6"

press ctl-x, "y", then enter.  

$     sudo update-grub

now (since we already edited the 1gbpages part of the config.json) both hugepages and 1gb pages should be enabled when you start xmrig.  

Reboot to give everything a fresh start.

$    sudo reboot

-- END OF UNNESSECARY SECTION --

How to get XMRig to Autostart at Boot

There are other and better ways to do this I have not explored.  The following method is the one I have used multiple times. 

We are going to need to write two files.  One a script, and the other a .desktop.

Navigate to:

$     cd /etc/xdg/autostart

$     sudo gedit

in that bad boy insert:

 

[Desktop Entry]
Name=XMrig
Comment=Run XMRig at boot with as sudo
Exec=gnome-terminal -e "/home/username/Documents/xmrig.sh"
Icon=terminal
Terminal=true
Type=Application
Categories=Application;


**Before you save it, you need to change the 'username' to your username.

Click save at the top and save it as xmrig.desktop

Then run:


$     sudo chmod +x xmrig.desktop

Optional: Right click on the icon in the file and go to properties and verify that "Allow executing file as a program" box is now selected.

Now we need to make the script. I put mine in the documents folder.  Put it anywhere just figure out the path.

$     cd /home/username/Documents

$     sudo nano

Insert this for your script:

 

!#/bin/bash

sudo /home/username/xmrig/build/xmrig

**Again change "username" to your username or the script wont run.

ctl-x to save, save it as xmrig.sh

now to again make it executable

$     sudo chmod +x xmrig.sh

right click and look at file properties to again verify the check box is checked.

go to the little grid at the bottom left, start searching for "startup.." and click on "startup applications"

verify xmrig is there and checked.

Final Tweaks (BIOS) and Automatic Restarts

The very last thing is that something called the "governor" limits your computer's power.  In order to bypass that we need to overclock our memory and CPU.  You don't need to overclock it a lot.

Reboot and go into your BIOS.  Find your memory settings and change it to your "extreme memory profile" or "profile 1" or something like that.  You are going to need to play with it or look up a tutorial on your specific motherboard.  I will also add a few points to my default processor speed (I put mine to 4.0Ghz).  

Save and reboot.  You should literally just watch your computer boot up, log in, and start mining with zero demands for user inputs.  Hope this helps someone.

Also if you want your computer to restart every day there are a few ways to do it through "crontab" command.  Here is the way that I have found works best.

Open terminal and type

$   sudo -i

$   sudo crontab -e

if this is your first time opening it up, select nano as your editor.

Underneath all the commented lines, start a new line (without the # sign) that says

1 0 * * * /sbin/shutdown -r now

This should reboot your computer at 0001 in the morning.  You can also add another one to the next line to reboot at noon as well if you want.  You can change these times and days as you wish (the instructions in crontab explain how).

1 12 * * * /sbin/shutdown -r now

save with ctl-x, y, enter.

Now if your computer gets hung up on something, it will reboot within 12-24 hours.

                                                                               XMR Wallet address for donations: 
8Bet9ggajqUZ6NmfqzPaBzHoqqxGoFsEdX2AMVWSTwg5FNskjEVqiGQPfWeHj99au2Kt1K3bUin1NNXZywSvusphSVdZFgZ

bottom of page