Clone this wiki locally

First things First

Before you start working with this guide: Do not create issue reports if you fail to get it working! This is most often caused by a setup mistake, over-reading a configuration or system step or simply not being into Linux, Apache and MySQL enough. But don't fret! MPOS has a very active community, so if you are struggling to get things to work, try our IRC Channel FIRST! New issue reports regarding the setup or running of MPOS will always be closed by commenting to join IRC for further assistance: https://webchat.freenode.net/?channels=#mpos

Disclaimer!

Before following this guide this warning is given as advice and a word of warning. Running a live pool is a job which requires in depth knowledge of pool code as well as the ability to debug and fix the pool. By NO means is this an in depth guide to running a pool and as such should only be used for private/testnet pools! As running a pool is a long and tiresome process where many different things can affect the stability and usability of the pool, it is guaranteed that problems will occur. If help is required it can be obtained in the MPOS channel however a person must be able to show that they have tried to resolve a problem themselves. Otherwise help will not be given as the running of the pool in itself is a difficult process

Description

This guide will help you get your MPOS interface setup including all dependencies and software required.
Please use this as a guide on how get things to work but keep in mind that things change and maybe this Wiki page is outdated and things do not work anymore as expected.

If you intend to follow this quick start guide please ensure you know what you are doing. Basic concepts in Linux like compiling and installing software, configuring Apache and other services should be a no-brainer to you.

This guide is NOT taking care of security or any special setups to make this installation secure. You should consider:

adding a special DB user just for MPOS

ensures you are not using root which could break things

create a new virtual host and point the DocumentRoot towards the public folder

This way the cronjobs folder can be locked down and not be available to the website itself

run all 3rd party services as non-root

if one of them has a flaw your root account is not compromised

Website Footer

When you decide to use MPOS please be so kind and leave the footer intact. You are not the author of the software and should honor those that have worked on it. I don't mind changing the LTC donation address at the bottom, but keep in mind who really wrote this software and would deserve those ;-).

OS Setup

My base system used in this guide is Ubuntu Server 12.04 LTS. During setup I kept most defaults and installed the OpenSSH (for easier access) and LAMP Server groups during software selection. Other software and tools required will be mentioned in this guide.

Update your server:

sudo apt-get update
sudo apt-get dist-upgrade

Run these two commands till there are no more updates. Remember to run these commands again any time you install dependencies to make sure you have the latest versions.

In order to get started install some basic tools. Other tools will be installed when needed.

To mine on this server with a remote graphic card on your network you need to determine your machines IP.

ifconfig

Now point your miner, I will be using cgminer.

cgminer.exe --scrypt -o http://yourip:19334 -u -p

You should now be mining!

Stratum Mining Server Software

There exists many stratum mining server software alternatives which you have to choose one from and configure MPOS to work with;

Stratum Mining

Stratum Mining is a software which supports all PoW and PoS coins including Litecoin, Bitcoin, PPcoin and Novacoin.This is rather easy to implement so here a quick start guide if you wish to try it out. MPOS does support stratum, For VARDIFF support MPOS must be set to match the initial pool target in the stratum-mining config file.

NOMP

A new stratum has been created, named NOMP, if you would like to use this instead of stratum-mining, please follow this link. Either one will work. NOMP supports x11, quark, scrypt, sha, and more. NOMP is written in node.js

Starting stratum-mining

This is the easy part, but don't do it till you set up the database in the next steps. Change to the stratum-mining folder and fire up the service:

cd stratum-mining
twistd -ny launcher.tac

If you want to run it in the background you can remove the -ny and replace it with -y:

twistd -y launcher.tac

Special Notes

When running stratum-mining I noticed that stratum and pushpoold use different settings. @pooler was nice enough to explain it to me in detail:

pushpoold uses a target bits terminology and stratum a difficulty setting. These are different. When running pushpoold at a target bit of 20 you will match the default setting of 16 in stratum-mining. This will ensure that hashrates on MPOS match up! If you'd think you could set pushpoold to 16 and match it with stratum you will be off.

He devised a formula that can be used to change stratum difficulty and match pushpoold and MPOS to it:

(stratum diff) ~= 2^((target bits in pushpool) - 16)

Add The Result To The Stratum Pool_Target

MPOS

Requirements

We need to install some additional software to ensure MPOS will work as expected. This is a sample for Debian based systems:

Just download the ZIP archive, unzip into your pools webroot and run the index.php. Do not continue until everything shows green! The only exception is Maximum post size which needs to be a bit bigger so MPOS can store admin panel settings to the DB when clicking save.

Configuration

Folder Permissions

First, give proper permissions to our compiled templates and caching folder. This example shows the procedure in Ubuntu, other distributions may vary (apache in CentOS, httpd in others). Ensure to give the service user access that will be executing the scripts!

sudo chown -R www-data templates/compile templates/cache logs

Main Configuration

We need to configure the project to work on our newly installed server:

You will also need to setup a proper, random (!) $config['SALT'] and another $config['SALTY'] secret! If you forgot that, you will get an error message after installing MPOS: You absolutely SHOULD NOT leave your SALT or SALTY default changing them will require registering again.
SALT and SALTY must be a minimum of 24 characters or you will get an error message: 'SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again'

One final edit should be to edit: /usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/websocket_transport.py

Please test the same with cgminer or a similar tool supporting stratum on port 3333, the default port opened by the configuration in stratum-mining.

Now with shares being committed and new blocks being generated in our test network head to the webinterface and your stats should be updated!

Cronjobs

MPOS comes with a few cronjobs that are part of the backend. Please set the up according to regular cron guides. MPOS comes with a wrapper script that will run all crons for you. It is called run-crons.sh and can be found in the cronjobs folder. Adjust this script to suit your needs, then add it to your cron service.

For testing purposes you can also run them from command line:

cd /var/www/MPOS/cronjobs
./run-crons.sh

You will not receive any output. Please check in cronjobs/logs for the appropriate logfiles. For more detailed logs you can turn on debugging in the cronjobs/shared.inc.php file.

For a small pool, this will work fine. If you are planning to run a medium sized pool in the future or expect a lot of shares, please read: cronjob advanced setup.

E-Mail

You are required to have a proper mail setup running on your box. Keep in mind that large pools can have quite excessive e-mails being sent over all. This is by design and increases security while also notifying uses about state changes in the pool. For smaller pools, running via an external provider will suffice. For larger once, you should look into a contract for Mail Relays.

Basic DoS Protection

You are required to secure your server, Using internal and external means. Pasting the below rules into your SSH console one line at a time from top to bottom would be a good start, But there are other considerations as well.

This assumes you will be using port 53 for DNS and you don't want UDP for anything else, And your webserver is serving on port 80, This doesn't restrict services such as SSH or FTP. You want to limit the rate your clients can connect at the door, and not rely solely on a cache to do it.

sudo vi /etc/fstab
Add the following line to the end of the file
/swapfile swap swap defaults 0 0

Remember to set VMware to bridge your adapter so that your server will show up on the local network.

The server can be really touchy when trying to get a miner to connect to it. Keep trying, restart, fiddle with the .conf settings, etc, eventually it will begin working properly, though I had to create the server 8 times before it worked.

This will compile and install two libraries that are required to run stratum-mining. If running the git commands does not pull the git subfiles the first time, try deleting the stratum-mining folder and downloading it again.

To remove the slightly annoying "Could not reliably determine server name" warning message when restarting apache, just insert this line of code into the /etc/apache2/httpd.conf file: