Cloud Primecoin mining on Ubuntu 12.04 with auto restart

Following some helpful instructions, I got myself a new cloud server at Digital Ocean to start mining Primecoins with. I wanted to have the miner running automatically and continuously, and being restarted even if the server itself got rebooted for whatever reason. Here is how I got things setup.

Install Primecoin miner

I followed the instructions in the original forum post, but had to install Boost v1.48 specifically in order to get compilation working:

$ apt-get update
$ apt-get install -y git make g++ build-essential libminiupnpc-dev
$ apt-get install -y libdb++-dev libgmp-dev libssl-dev dos2unix
$ apt-get install -y libboost1.48-all libboost-chrono1.48-dev 

Now get the source code and build it:

$ git clone https://github.com/thbaumbach/primecoin
$ cd primecoin/src
$ make -f makefile.unix

At this point primeminer is a runnable executable. Test that it works:

$ ./primeminer
********************************************
*** Xolominer - Primecoin Pool Miner v0.8 RC1
*** by xolokram/TB - www.beeeeer.org - glhf
***
*** thx to Sunny King & mikaelh
*** press CTRL+C to exit
********************************************
usage: ./primeminer -poolfee=<fee-in-%> -poolip=<ip> -poolport=<port> -pooluser=<user> -poolpassword=<password>

Supervisor

We want to make sure that the miner is always running, even after the server reboots. We’ll use supervisor to enable this. Supervisor is a process which starts and monitors other processes, automatically restarting them if they die. In other words, it supervises them!

$ apt-get update
$ apt-get install supervisor
$ mkdir -p /var/log/supervisor

Now create /etc/supervisord/conf.d/primecoin.conf with the following contents (replace the instruction text with the correct values as per your mining pool and coin address):

[program:primecoin]
command=/root/primecoin/src/primeminer -pooluser=AGietAbUNzveig2XDjmc7hgo4tAVBQYLqA -poolpassword=0 -poolip=rpool.net -poolport=8336 -genproclimit=1
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true

Restart supervisord service and check that primeminer is now running:

$ /etc/init.d/supervisord stop
$ /etc/init.d/supervisord start
$ ps aux | grep primeminer
...
root     25091 80.4  1.0 124176 10984 ?        Sl   03:53   0:07 /root/primecoin/src/primeminer -pooluser=AGietAbUNzveig2XDjmc7hgo4tAVBQYLqA -poolpassword=0 -poolip=rpool.net -poolport=8336 -genproclimit=1
...

Try killing the miner. Then check that it automatically starts up again:

$ kill <process id from before>
...wait a few seconds before executing the next command...
$ ps aux | grep primeminer
...
root     25105 80.4  1.0 124176 10984 ?        Sl   03:53   0:07 /root/primecoin/src/primeminer -pooluser=AGietAbUNzveig2XDjmc7hgo4tAVBQYLqA -poolpassword=0 -poolip=rpool.net -poolport=8336 -genproclimit=1
...

Now your miner will kick off as soon as your server starts, and the supervisor will ensure that it stays up. To see what the miner is upto you can check its log:

$ tail -f /var/log/supervisor/primecoin.log 
*** press CTRL+C to exit
********************************************
AGietAbUNzveig2XDjmc7hgo4tAVBQYLqA
GeneratePrimeTable() : setting nSieveExtensions = 9, nSievePercentage = 10, nSieveSize = 1000000
GeneratePrimeTable() : prime table [1, 1000000] generated with 78498 primes
spawning 1 worker thread(s)
[WORKER0] Hello, World!
[WORKER0] GoGoGo!
connecting to 54.238.199.196:8336
[MASTER] work received

Find great remote programming jobs at RemoteCoder.io.

  • JT

    Thank you for this. How many CPD are you seeing?

  • http://hiddentao.com/ Ram

    Honestly, it sucks. Am only getting on the order of 0.3 coins after 4 days or so of constant mining. I think that if you want to do this now you’d definitely need to do multiple cores on a more powerful machine to make headway. I think this sort of single-core setup is only worth it in the early days of a coin.

  • Darko Sokolovic

    Can you tell me how i can setup a private pool that will work with xolominer. Or any other miner i can auto restart it and keep it running in the background. Thanks

  • http://hiddentao.com/ Ram

    Hi mate, instructions for compiling and running xolominer are here: http://www.peercointalk.org/index.php?topic=798.0

    Once you have the primeminer executable created you can follow my instructions above for getting it to auto-run and auto-restart using the supervisor daemon.

  • Darko Sokolovic

    Sure. But u said it works with beeeer.org and rpool. How do you/can you setup a private pool for solo mining?

  • paul croasdale

    i’m averaging 0.23XPM/day/core

  • http://hiddentao.com/ Ram

    I haven’t tried setting up a private pool myself, sorry about that. Bitcointalk forum is your best bet for that.

  • http://hiddentao.com/ Ram

    Nice!

  • Amber

    Thanks for this. I’ve used it in conjunction with jhPrimeminer for Linux to mine with ypool and it works like a dream.