How to start mining cryptocurrencies for fun (not profitable)

Jason van den Berg
7 min readJan 16, 2017

--

A quick, simple guide to start mining the Monero cryptocurrency in the cloud

Disclaimer: Please don’t quit your job, this is not a get-rich-quick-scheme. It’s actually NOT PROFITABLE mining this way at all. This tutorial is basic and mostly just educational. If you can find a way to get free hosting or run this on a home server, it might work better. I suggest you use this as a base but play around with it yourself.

Getting into cryptocurrency mining seems pretty complicated and I couldn’t find a straight forward tutorial myself so I hope this one helps you.

This is the fastest way I can come up with to setup up your own little mining operation. Feel free to change things up and make it your own.

For this tutorial we’re going with the cryptocurrency called Monero. Obviously you can choose a different cryptocurrency if you wish. But I’ve found this one to be relatively easy and you can always simply convert it into any currency of your choice using Changelly anytime you wish.

Step 1: Create a VPS (Virtual private server) to actually perform the mining.

Here you can really choose any service that can run the Ubuntu operating but for simplicity sake we’re going to setup a server with Digital Ocean. From my experience they’re quite cheap and very easy to use. Also, signup with this link and you get $10 free.

Please note, you’re more than welcome to use any hosting service for this that supports Ubuntu 14. I’m just using digital ocean in the tutorial. Again, if you manage to come across free hosting credits, then by all means use that. If your costs are zero, then everything mined is pure profit.

Once you’ve got your Digital Ocean account sorted, we’re going to click ‘Create Droplet’.

For the image distribution, choose Ubuntu 14.04.5 x64 (Or what ever version of Ubuntu 14 is currently on offer). Get this OS correct is pretty important for the up coming steps to work.

Now choose a size. This is up to you but I use the $20/mo server as it as 2 CPUs and seems to give me the best results for money spent. If you prefer you can of course go cheaper or more expensive. The mining works on all sizes but just varies in effectiveness. Even the $5/mo works, but of course mines a slower.

Do not add any block storage, that’ll be of no use and will just waste money.

Choose a datacenter region. This makes no difference, just pick your favorite country.

You won’t need any additional options.

Click ‘Create’ and wait for your droplet to be created.

Now you’ve got your server running in the cloud, we’re almost set to start mining.

Step 2: Access your VPS

With your droplet (VPS) created we now need to access it.

This step varies depending on whether you’re on a MAC, Linux or Windows machine. One way to quickly access your VPS from any machine is through Digital Ocean’s ‘Access console’ which uses a browser window. But for some reason this doesn’t allow the basic copy/paste function which is really going to be needed later as the commands to run get pretty long. It’s up to you but I don’t suggest that route.

For Mac and Linux users

Open up the ‘Terminal’ app. That’s it.

For Windows users

Sorry but this is slightly more effort. You’re going to need to install something called Putty which is needed to access your Ubuntu VPS from your windows machine. Remember, you can always use the browser access console I mentioned above, but that includes a lot of typing out of random strings of characters into the console.

Digital Ocean’s Access Console (No copy/paste feature)

You should have received an email with the access details for your new droplet. We’re going to need those details here. Once you’re in your terminal/console type the following command. Please replace the IP address with the one you received in the mail of course.

ssh root@123.456.789.10

This might ask if you’re sure you want to continue. Just type ‘yes’ here.

It will then prompt you for the password you got in the email. You need to type out that password EXACTLY as it is in the email. You won’t see what you’re typing, this is just a security measure so don’t worry.

You will then be required to change the current password. Which is good because that one was a pain to type out. Here you’ll need to confirm the current password one more time and then create one that you choose and is hopefully quicker to type out.

Step 3: Setup your VPS for a mining operation

You’re going to have to run (copy/paste) a few commands to install the requirements in order to start the mining. You can simply copy and paste these into the console line by line.

sudo apt-get update -y && sudo apt-get install git -y make automake screen libcurl4-openssl-devgit clone https://github.com/wolf9466/cpuminer-multicd cpuminer-multi./autogen.shCFLAGS="-march=native" ./configure --disable-aes-nimake

Now the server is setup, installed and ready to start mining.

Step 4: Start mining

Mining cryptocurrencies takes an enormous amount of processing power, the kind that’s very hard for an individual to create on his/her own. So we have mining pools. These are groups of people that join forces (processing power) to mine a cryptocurrency.

Signing up to a mining pool, such as MinerGate is really the only way to get into the game. They also have simple to install mining software that can be run on your local machine. You can run this in parallel with as many mining servers as you wish to speed up the process.

After registering with MinerGate, all you need is your email address you used on signup to insert it into the following command before running this command on your server. This tells the pool which account to assign the coins to. Simple copy and paste the following one lined command into your VPS terminal.

screen -S miner ./minerd -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u EMAIL_ADDRESS -p x -t 1

Now your Monero miner should be running in a ‘screen’, meaning the process will continue to run on the server after your console has been closed. Google ‘linux screen’ for more info on how that works if you’re not familiar with it.

After that, the console should have output similar to this:

Step 5: Congratulate yourself

Hopefully if you followed all the steps at this point you are successfully mining the Monero cryptocurrency!

Some things to take note of

The “-t 1” at the end of the command is to specify the number of threads you wish to run on the server. If your server has just one CPU, then leave as is. Else, if your server has multiple CPUs then replace the “1” with as many CPUs as there are to optimize the speed of the mining operation.

Digital Ocean might kill your processes because of the high CPU usage. This will stop your mining process in which case you’ll have to restart it by running this command again:

screen -S miner ./minerd -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u EMAIL_ADDRESS -p x -t 1

If the constant pain of having to access your VPS to restart the script is getting to you, try adding a cron job (Linux automation feature) to restart the mining process every time the server is rebooted instead of using a screen. Start by editing the crontab with the below command:

crontab -e

To the bottom of the file you’re now editing, add the following one lined commands:

@reboot cd ~/cpuminer-multi/ && sudo ./minerd -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u EMAIL_ADDRESS -p x -t 1

Remember to always keep a blank line at the end of this file before saving.

This command will execute every time the VPS is rebooted. What this command does is navigate to the correct directory and start the mining operation. Remember again to place your email address you used to sign up to MinerGate with into the command.

I’m not sure myself if this tutorial could make you any profit in the long run so again please don’t quit your day job. If you come across some free hosting credits from any providers then you’re sorted as everything mined is profit.

If you want to mine faster, you can setup more droplets to contribute to your mining pool and start again from step 2. You can run as many servers at the same time to speed things up.

Bonus points: Stash or convert your hard earned currency.

If you wish to convert your Monero into another currency and store it in another wallet that you own, then Changelly is probably the best place to go for that. Personally I like to convert all my Monero to Bitcoin regularly so I often make use of this. If you’re interested in bitcoin, a great bitcoin wallet and market place (With an awesome app) is Coinbase. Use this link to get a $10 bonus if you decide to buy: https://www.coinbase.com/join/5954ce7e02bf5b00a597d39a.

Enjoy!

If you have any questions or suggestions I’m always available on twitter: @jayvdb1 :)

--

--