Mining Cryptocurrency with CPU in Production Servers

miner shack wagon crypocurrency

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


Before beginning to write, I want to say that I was tested in the 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 cryptocurrencies without hanging the 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, to account in any place that allows sending your miner funds. For ethereum you could use Minergate. Here is my referrer link: Minergate


The next step is to install a 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 a new repository to our system and update the repo packages list. Then install ethminer:

Cool, you have installed the 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 the 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 has a solution, screen command. Some Ubuntu versions have installed and others not. You can try to install it with this command:

The screen is an application that 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: Digitalocean tutorials 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 the 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 the background. When you do this system says process number, for example, you can tail some log meanwhile you are continuing working:

And 6560 is the 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 the shell.

Now, we have finally worked our miner on 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 a screen session, then we write:

And we return to our last screen.

Be careful exiting and returning, sometimes the screen creates new sessions or simply don’t want to connect to the previous screen and you will need to force entry 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 to make an account in MyMonero (my monero). 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 the safest place, if you lose this mnemonic seed, you lose your moneros. This means that you need to write on paper and put it in some safe deposit box or something. I 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 these tools. Minergate isn’t an option yet because the new pools I’m using give more H/s and more rewards. Actually, I’m using supportxmr.

You don’t need to register to begin to work with their pools. Simply configure your miner’s applications with the username as your wallet address …. and done. If you want to log in simply send your email as a password in the application and you could log in 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 on if you want to mine with GPU or CPU). But actually, this project was joined these three applications in only one: xmr-stak.

Ok, let’s 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:

Github fireice-uk xmr-stak

Well, login to your server and download and install:

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

When you execute, xmr-stak, looks for config.txt and cpu.txt. If these files aren’t there program ask you some questions. Currency to mine, URL for pool and some more, I recommend that answer like me, excepting Username that is your monero wallet address and password, that you can write wherever you want. Is important that the password be unique because identify your instance in the pool. I have 3 machines working and the 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 is:

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


This is normal, XMR-Stak needs some memory to mine and systems to 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 value applies, don’t need to reboot. If you have more errors or problems you can go to:

Github fireice-uk xmr-stak

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:

Download Zip Github Xmr-Stak releases

Decompress wherever you want, in some folder and just execute it, xmr-stak ask same questions the 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 it from here:

github nanopool Claymore-XMR-CPU-Miner releases

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

My command is:

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


Final Words

Is easy to 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.


Comments are closed.