miner shack wagon crypocurrency

Mining Cryptocurrency with CPU in Production Servers

Mining cryptocurrency, actually, isn’t profitable because hardware and electricity cost is high than mining earnings. After write my last Altcoin mining post, some sysadmin colleagues ask me if I knew how to mine in production server.  The result is this post.

Before beginning to write, I want to say that I was tested in client beast server, underused, with client consent. The server is a basic OVH Hosting Server:

Intel  Xeon D-1520 – 4c/8t – 2,4GHz 

And after 2 months of mining my earns was near 0,001 Etherum.

This post talks about configuring the server, installing tools and try to mine various cryptocurrency without hang server. Good luck sysadmins!

Mining Ethereum in Ubuntu/Debian

Actually, Ethereum needs a lot of resources to be mined. For me, the best option actually is mine Monero (next section). Anyway, mine ethereum is possible with some number of CPUs.

You need, first of all, account in any place that allows send your miner founds. For ethereum you could use Minergate. Here is my referrer link: https://minergate.com/a/bead6c75aefbf9991fff8c42


Next step is install mining tool. For our purposes, we can use Ethminer. Ethminer isn’t easy to found and install. Some searches always show cppethereum project, but I don’t want to compile my tool, I want to download/install and mine.

After some research I found that I can do this:

We added new repository to our system and update repo packages list. Then install ethminer:

Cool, you have installed mining tool, and you have your minergate account, time to mine:

And you will see how DAG begins to generate (DAG is needed to mine ETH, it’s a big file ~3,5Gb) but if you do CTRL-Z (to put your process in background) and write exit to leave the session, Ethminer stops working.

Using Screen

But, WTF!!! I want my miner working!! Ok, we need to make a process stay work even when we go out. Ubuntu have a solution, screen command. Some Ubuntu versions have installed and others not. You can try to install with this command:

Screen is an application allows you to use multiple sessions inside the same window. If you write simply screen you will enter in a new session. You can leave with a keyboard shortcut or writing exit.

You can read a complete tutorial about screen here: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-screen-on-an-ubuntu-cloud-server

We only need to know some basic commands.

  • screen: enters in screen mode
  • exit: exits from screen
  • CTRL – a ?: Screen help window
  • CTRL – a d: Detach window
  • screen -r: return to the last screen

And what we do?

Push CTRL – a d

And we can exit shell.

But, WTF Victor!!! Ethminer is putting all my CPUs to 100%. Mmmmm … eeeeh! yeeees!

scream girl


Limiting CPU Usage

I forgot to limit them! We need to limit cpu, but Ethminer hasn’t any control over cpu number or something. Then we need to install something more. Here comes cpulimit.

Cpulimit allows limiting the use of one process. How it works; You need to execute the process with final &. This means that put process in background. When you do this system says process number, for example, you can tail some log meanwhile you are continuing working:

And 6560 is process number, we can now limit cpu use of this process:

-p is process number
-l is Total cpu, 500 are 50%, 1000 are 100%

Well, now we can put it all together:

Push CTRL – a d

And we can exit shell.

Now, we have finally working our miner in the server. We can exit all.

Return to miner screen

Our last … We exited all screens, but we want to return to control or stop our process inside screen session, then we write:

And we return to our last screen.

Be careful exiting and returning, sometimes screen creates new sessions or simply don’t want to connect to the previous screen and you will need to force enter in your miner screen.

Mining Monero

For monero XMR things change, actually, we don’t use minergate yet, we are using other pools and these pools works a little bit different. First of all, you need a Wallet.

Making our Monero Wallet

Monero Wallet is where you store your cryptocurrency. The best option is make an account in MyMonero (https://mymonero.com/). When you click on Create Account MyMonero advert that is not the safest place for large amounts, but actually my riches are 0,3 XMR and I think isn’t much.

After that they show this screen with Your Private Login Key:

my monero create account mnemonic seed

Store your private key in safest place, if you lose this mnemonic seed, you lose your moneros. This means that you need to write on paper and put in some safe-deposit box or something. If lose, you lose XMR.

Create an account and then gets your Monero Wallet address.

You will need.

Looking For new Pool

After some research, I’ve found one service for use with this tools. Minergate isn’t an option yet because the new pools I’m using give more H/s and more reward. Actually, I’m using supportxmrhttps://supportxmr.com/

You don’t need to register to begin to work with their pools. Simply configure yours miners applications with the username as your wallet address …. and done. If you want to login simply send your email as password in the application and you could login in supportxmr.


XMR-Stak for Ubuntu

XMR-Stak is a project to mine Monero. Firstly, this project, was divided in three different projects; xmr-stak-cpu, xmr-stak-nvidia, xmr-stak-amd. You could choose from one of three (depending if you want to mine with GPU or CPU). But actually, this project was joined this three applications in only one: xmr-stak.

Ok, lets go! The process is similar to ethminer but, in this case, without cpulimit. XMR-Stak has processor selection, you can select what processor you want to mine. I will show you. Then, go to install. Project is on GitHub:


Well, login to your server and download and install:

After decompress we need to create configuration files, but xmr-stak can do by himself, simply execute:

When you execute, xmr-stak, looks for config.txt and cpu.txt. If this files aren’t there program ask you some questions. Currency to mine, url for pool and some more, I recomend that answer like me, excepting Username that is your monero wallet address and password, that you can write werewer you want. Is important that password be unique because identify your instance in the pool. I have 3 machines working and password looks like Workers t in the machine list:

supportxmr mining workers list

Then, Here are three important lines to look for:

  • Configuration stored in file ‘config.txt’
  • CPU configuration stored in file ‘cpu.txt’
  • MEMORY ALLOC FAILED: mmap failed

The two first lines say that config files are saved. Let’s see.

XMR-stak cpu.txt

In cpu.txt is where xmr-stak saves cpu configuration after system testing. Look file:

For a four (4) cpu system, xmr-stak, generates three lines, Total CPU – 1. If you read my other post you know that is important to leave 1 cpu free when mining. For this particular case, I will put only 1 cpu. Because this machine sometimes has tasks to do.

XMR-stak config.txt

this file has some other configs, for me, the important are:

You can configure too some important things like run in daemon, or activate http for show reports via web. This could be important if you are running process on a server, but is out of the scope of this post.


Thi is normal, XMR-Stak needs some memory to mine and systems have limits for only one process.

To solve this problem; open /etc/sysctl.conf and add at the end:

Then open /etc/security/limits.conf and add at the end:

You only need to leave the session and enter again and this values applies, don’t need to reboot. If you have more errors or problems you can go to:


Put XMR-stak to work

Ok, easy, no?

CTRL+a d

And go to work!

XMR-Stak for Windows

When you work with Windows all is different. Simply Download from here:


Decompress wherever you want, in some folder and just execute it, xmr-stak ask same questions that ubuntu version:

And begin to mine automatically.

Nothing more, you can disconnect from your Remote Desktop and server continue mining for you.

Don’t forget to adjust CPU number in config.txt to avoid using all cpus in your server.

Claymore’s CryptoNote Windows CPU Miner v3.5

One of my favourites, and was the first I’ve found to mine with CPU is Claymore’s CryptoNote Windows CPU version. You can download from here:


Decompress it and you can run with a command like that:

My command is:

But Claymore has an extra cool option. You can specify -lowcpu option that increases hash rate if you have a CPU with AES-NI capability.


Final Words

Is easy mine in any system, if you have patience and don’t need a lot of rewards you can easily use not used cpu. There are some more options like ccminer or CPUMiner-multi. You have also Minergate but actually, I don’t recommend that due to their low hash rate and high fee.

2 replies
  1. jms
    jms says:

    Hi, thanks for making such informative article!
    I started to mine monero by xmr-stak on vps (Ubuntu 14.04 /1 core) for fun recently. I found out that CPU usage reached to 100% easily but I’d like to limit it to 90% to avoid the ban.Could you advise know what command to run? I’m a very beginner in tech honestly and would like to get your advice hopefully.

    Below is a part of the cpu.txt

    “cpu_threads_conf” :
    { “low_power_mode” : true, “no_prefetch” : true, “affine_to_cpu” : 0 },

    • victor
      victor says:

      Hi jms,

      as explained in article you need to use cpulimit application.
      You can found under Limiting CPU Usage section.



Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *