From
github.com/MPOS/php-mpos/wiki/Quick-Start-Guideand
litecointalk.org/index.php?topic=43.0Instructions for ubuntu (apt-get needed) but any apt-get supporting linux based shell should work.
Assumption is you are installing entirely from ssh terminal shell; and you either have sudoer and/or root access.
If you use GUI then.... hahahahahahahahahaha^50.. ok over it
Seriously tho, if you are in a GUI press ctrl-alt-F2 to get a real shell.
Also assuming some common sence to substitute correct ips/usernames/paswords/wallet codes etc as appropriate.
You can skip any line with "Litecoin" if you only want a marscoin pool. I have crossed out lines you can ignore if you dont want a LTC wallet too.
If you Just want the coin demon - for whatever coin you want substitute the git repsoitory of the qt coin daemon
for example i used litecoin as a reference, but actually installed marscoin instead
=================
Part1: Enable SSH shell:
=================
First we need ssh so we can log in from anywhere.
sudo apt-get install openssh-server
sudo apt-get install build-essential libssl-dev libdb5.1-dev libdb5.1++-dev libboost-all-dev git
apt-get install make
==========================
Part 2: Create the coin wallet/daemon.
==========================
git clone git://github.com/litecoin-project/litecoin.git git clone git://github.com/marscoin/marscoin.git
cd litecoin/srccd marscoin/src
cat /proc/cpuinfo | grep -i "model name"
(note number of cores - set -j2 to -j<number of cores> i had 2)
make -j2 -f makefile.unix USE_UPNP=
========================
if you run ubuntu 16.04 or newer
Sources:
cryptoandcoffee.com/mining-gems/install-litceoin-wallet-ubuntu-16-04-command-line/litecointalk.io/t/litecoin-compilation-guide/3039========================
#!/bin/bash
mkdir Github && cd Github
sudo apt-get install -y git
git clone git://github.com/marscoin/marscoin.git
cd marscoin
sudo apt-get install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev
sudo apt-get install -y bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev
sudo apt-get install -y libboost-program-options-dev libboost-test-dev libboost-thread-dev
sudo apt-get install -y libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev
sudo apt-get install -y libqrencode-dev protobuf-compiler miniupnpc
sudo add-apt-repository ppa:bitcoin/bitcoin -y
sudo apt-get update -y
sudo apt-get install -y libdb4.8-dev libdb4.8++-dev
./autogen.sh
./configure
make
make install
===========================
sudo cp litecoind /usr/bin/litecoind
sudo cp marscoind /usr/bin/marscoind
mkdir ~/.litecoinmkdir ~/.marscoin
nano ~/.litecoin/litecoin.confnano ~/.marscoin/marscoin.conf
---------
server=1
rpcallowip=127.0.0.1
#(remove this line if remote access needed - or set real ip if local only, or use * ? - more than one ip can be added on extra lines starting with rpcallowip)
rpcuser=HardToGuessUsername
rpcpassword=Str0ngS3cur3Passw0rd1
rpcport=9332
#daemon=1 enable this to skip needing -daemon option later
#txindex=1 enable this to make a complete copy of the entire blockchain and tx list handy for if you plan to set up a block explorer later, or run as a master/seed/super node to prop up the network
#addnode= any ip:port you know running the keychain
---------
now set permissions etc
chmod 600 ~/.litecoin/litecoin.confchmod 600 ~/.marscoin/marscoin.conf
litecoind -daemonmarscoind -daemon
litecoind getinfomarscoind getinfo
litecoind –helpmarscoind –help
ALL done - these wallets use basically all the same commandline options as the debug menu in windows wallets.
============================
Part 3: Create an entire mining pool
============================
Make sure your OS is up to date - and install dependancies.-
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install autoconf libtool libcurl4-openssl-dev mysql-server
sudo apt-get install python-twisted python-mysqldb python-dev python-setuptools python-memcache python-simplejson python-pylibmc
sudo apt-get install memcached php5-memcached php5-mysqlnd php5-curl php5-json libapache2-mod-php5
sudo apache2ctl -k stop; sleep 2; sudo apache2ctl -k start
It should prompt for a sql root password, set one and make a note what it is
(Advanced tip - create a new sql user if you need sql for anything other than mining for security)
(Get the wallet address note it) eg MJUNxomKvaYiYfAWL7b3T4cp2xtEnqwcsf
litecoind -datadir=1 getaccountaddress ""marscoind getaccountaddress ""
(get your ip. make a note of it)
ifconfig
-----------------
cd ~
sudo easy_install -U distribute
git clone
github.com/Tydus/litecoin_scrypt.gitgit clone
github.com/ahmedbodi/stratum-mining.gitgit clone
github.com/ahmedbodi/stratum.gitcd stratum-mining
git submodule init
git submodule update
cd externals/litecoin_scrypt
sudo python setup.py install
cd ~
cd stratum-mining/externals/stratum
sudo python setup.py install
cd ~
cp stratum-mining/conf/config_sample.py stratum-mining/conf/config.py
nano stratum-mining/conf/config.py
find this and set example fields appropriately (ie dont use "testnet" as your password):
-----------
CENTRAL_WALLET = 'wallet address noted earlier'
[...]
COINDAEMON_TRUSTED_HOST = 'localhost'
COINDAEMON_TRUSTED_PORT = 9332
COINDAEMON_TRUSTED_USER = 'testnet'
COINDAEMON_TRUSTED_PASSWORD = 'testnet'
COINDAEMON_ALGO = 'scrypt'
COINDAEMON_Reward = 'POW'
COINDAEMON_SHA256_TX = 'no
[...]
HOSTNAME = 'yourservername'
[...]
DATABASE_DRIVER = 'mysql'
DB_MYSQL_HOST = 'localhost'
DB_MYSQL_DBNAME = 'mpos'
DB_MYSQL_USER = 'root'
DB_MYSQL_PASS = 'root pass set earlier'
[...]
POOL_TARGET = 16
[...]
SOLUTION_BLOCK_HASH = True
--------------
cd stratum-mining
twistd -ny launcher.tac
(for debug display to check it worked, if all ok press ctrl-c then run the following:)
twistd -y launcher.tac (for normal background operation)
sudo apt-get install memcached php5-memcached php5-mysqlnd php5-curl php5-json libapache2-mod-php5
sudo apache2ctl -k stop; sleep 2; sudo apache2ctl -k start
(this part should be catered to whereever you set your web root folder, how to change that is mentioned later)
cd /var/www/html
sudo git clone git://github.com/MPOS/php-mpos.git MPOS
cd MPOS
sudo git checkout master
sudo apt-get install postfix
(if it asks use internet site and a domain you own, or localhost if you dont own any)
# Create database
sudo mysql -p -e "create database mpos"
# Import structure
sudo mysql -p mpos < sql/000_base_structure.sql
sudo chown -R www-data templates/compile templates/cache logs
sudo cp include/config/global.inc.dist.php include/config/global.inc.php
nano include/config/global.inc.php
(set values to match your server)
$config['db']['host'] = 'localhost';
$config['db']['user'] = 'root';
$config['db']['pass'] = 'sql pass set earlier';
$config['db']['port'] = 3306;
$config['db']['name'] = 'mpos';
[...]
$config['wallet']['type'] = 'http';
$config['wallet']['host'] = 'localhost:9332';
$config['wallet']['username'] = 'rpcuser';
$config['wallet']['password'] = 'rpcpass';
[...]
$config['gettingstarted']['stratumurl'] = 'localhost';
edit: /usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/websocket_transport.py
CHANGE from autobahn.websocket import WebSocketServerProtocol, WebSocketServerFactory
TO from autobahn.twisted.websocket import WebSocketServerProtocol, WebSocketServerFactory
Ok chances are the public folder is not your apache website root folder - so edit 000-default.conf
nano /etc/apache2/sites-available/000-default.conf
change root path to
/var/www/html/MPOS/public
now restart apache
sudo apache2ctl -k stop; sleep 2; sudo apache2ctl -k start
Log into your pool http://<ipaddress noted earlier>
Create an account, the
first account becomes the admin account; email confirmation isnt needed for first account - but use your real email address.
in admin panel -> system -> settings
go through and set appropriate email addresses and blockchain links for your coin. Also title your site etc.
Now check your crons work
cd /var/www/html/MPOS/cronjobs
./run-crons.sh
if you get errors run it once using
sudo ./run-crons.sh (only run it as sudo once)
then try running as user again
now check the admin panel -> system - > monitoring page shows status ok
create a miner user and try mining to it from cpuminer etc on another pc or an asic, it should connect and
mine fine if all went well.
eg in bfgminer ./bfgminer --scrypt -o stratum+tcp://192.168.1.101:3333 -u pooluser.miner -p minerpassword --no-submit-stale
Next
this cron needs to be set to run every 5 minutes (as non-root user?)
this does payouts and updates stats etc
crontab -e
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /var/www/html/MPOS/cronjobs/run-crons.sh
every time you reboot you will need to launch first your coindemon (marscoind -daemon)
then your stratum demon (twistd -y launcher.tac)
then flush your crons to clear mpos errors @reboot (run-crons.sh -f)
to view cron errors etc an email client will help
sudo apt-get install mutt (if it asks use internet site and a domain you own)
use "mutt" to display your cron warnings
This in mind lets create such a cron -
Startup cron script (as root?) @reboot
su <your non-root user> -c "marscoind; cd ~/stratum-mining; twistd -y launcher.tac; /var/www/html/MPOS/cronjobs/run-crons.sh -f"
example
su minerbob -c "etc; etc"
reboot the pc and it should all start up again without your intervention; if you have errors check the mutt cron log in your email
If everything seems ok (check the readouts at the website admin panel etc)
you can then disable the debugging mode and go "live"
cd /var/www/html/include/config
nano global.inc.php
set skip_config_tests to true in global.inc.php
==========================
Final steps
You may need to port forward port 3333, 8338 and 22 to your new pool server from your router, if you want to use it remotely or allow others to mine.
Tidy up: you may want to edit the run-crons.sh file and # out the warning about depreciation to stop unnecessary cron job mail messages when there are no errors.
==================
troubleshooting (after upgrade to ubunto 16.04)
=================
if when running twistd you get:
"ImportError: Twisted requires zope.interface 3.6.0 or later." ??Ie when you try to launch stratum mining with:
cd /home/jpc/stratum-mining
twistd -y launcher.tac;
This appears to be an issue in "twistd" or "zope"
I eventually fixed it by accident using some combination of the follownig commands:
sudo apt update
sudo apt upgrade
sudo apt-get update
sudo apt-get install python-twisted
sudo apt autoremove
sudo apt-get install -y python3-zope.interface
sudo apt-get install -y python-zope.interface
cd stratum-mining
./update_submodules
twistd
No errors now!?
Blank logon page or error logincheck owner/permissions of the MPOS web folders allow access to "www-data" user
eg: sudo chown -R www-data:www-data ./