Labels

Sunday, 13 August 2017

start mining the Monero on vps

start mining the Monero on vps with minergate pool:


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-dev
git clone https://github.com/wolf9466/cpuminer-multi
cd cpuminer-multi
./autogen.sh
CFLAGS="-march=native" ./configure --disable-aes-ni
make
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 -t1
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 -t1
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.