Project

General

Profile

Support #893

Install CoiniumServ on FreeBSD

Added by Daniel Curtis over 7 years ago. Updated almost 7 years ago.

Status:
Suspended
Priority:
Normal
Assignee:
Category:
Cryptocurrency
Target version:
Start date:
04/25/2017
Due date:
% Done:

70%

Estimated time:
1.50 h
Spent time:

Description

This is a guide for setting up CoiniumServ on FreeBSD 10.

Prepare the Environment

  • Make sure the system is up to date:
    pkg update && pkg upgrade
    
  • Create a coinium user:
    pw add user -n coinium -s /bin/sh -c "CoiniumServ" 
    
  • Install a few dependencies:
    pkg install bash git mono
    
  • Install the bitcoin daemon, refer to issue #889

Install Redis

  • Install redis:
    pkg install redis
    
  • Start and enable redis at boot:
    echo 'redis_enable="YES"' >> /etc/rc.conf
    service redis start
    

Install MariaDB

  • Start by installing the mariadb100-server and mariadb100-client packages:
    pkg install mariadb100-{server,client}
    
  • Copy a base MySQL configuration to use:
    cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf
    
  • Enable and start mysql at boot:
    echo 'mysql_enable="YES"' >> /etc/rc.conf
    service mysql-server start
    
  • Prepare the database for use by running the secure installation:
    NOTE: Choose a strong root password and answer yes to all questions.
    mysql_secure_installation
    

Create Databases and Users

  • Login to MySQL and create appropriate databases and users.
    mysql -u root -p
    
    • And run the following SQL queries to create the coiniumdb database and coiniumuser user:
      CREATE DATABASE coiniumdb CHARACTER SET utf8;
      
      CREATE USER 'coiniumuser'@'localhost' IDENTIFIED BY 'SuperSecretPassword';
      
      GRANT ALL PRIVILEGES ON coiniumdb.* TO 'coiniumuser'@'localhost';
      
      FLUSH PRIVILEGES;
      
      quit
      

Install CoiniumServ

  • Download the latest CoiniumServ from GitHub:
    git clone https://github.com/bonesoul/CoiniumServ.git /usr/local/CoiniumServ
    cd /usr/local/CoiniumServ
    git submodule init
    git submodule update
    
  • Compile the sources:
    cd build/release
    bash build.sh
    

Configure CoiniumServ

  • Switch to the CoiniumServ config directory:
    cd /usr/local/CoiniumServ/bin/Release/config
    
  • Create a main config file from the example:
    cp config-example.json config-example.json
    
  • Edit the main config file:
    vi config.json
    
    • And modify accordingly:
      {
          "stack": {
              "name": "pool.example.com",
              "nodes": [
                  {
                      "location": "us",
                      "address": "pool.example.com",
                      "default": true
                  }
              ]
          },
          "statistics": {
              "updateInterval": 60,
              "hashrateWindow": 300
          },
          "website": {
              "enabled": true,
              "bind": "",
              "port": 8000,
              "template": "default",
              "feed": "",
              "backend": {
                  "metrics": {
                      "enabled": false
                  }
              }
          },
          "logging": {
              "root": "logs",
              "targets": [
                  {
                      "enabled": true,
                      "type": "file",
                      "filename": "server.log",
                      "rolling": false,
                      "level": "information" 
                  },
                  {
                      "enabled": true,
                      "type": "file",
                      "filename": "debug.log",
                      "rolling": false,
                      "level": "verbose" 
                  },
                  {
                      "enabled": false,
                      "type": "packet",
                      "filename": "packet.log",
                      "rolling": false,
                      "level": "verbose" 
                  }
              ]
          }
      }
      
  • Create a market config file from the example:
    cp markets-example.json markets.json
    
  • Create a software config file from the example:
    cp software-example.json software.json
    
  • Create a default per-pool config file:
    cp pools/default-example.json pools/default.json
    
  • Edit the default per-pool config:
    vi pools/default.json
    
    • And modify the config accordingly:
      {
          "daemon": {
              "host": "127.0.0.1",
              "timeout": 5
          },
          "meta": {
              "motd": "Welcome to CoiniumServ pool, enjoy your stay! - http://pool.example.com",
              "txMessage": "http://pool.example.com/" 
          },
          "payments": {
              "enabled": true,
              "interval": 60,
              "minimum": 0.01
          },
          "miner": {
              "validateUsername": true,
              "timeout": 300
          },
          "job": {
              "blockRefreshInterval": 1000,
              "rebroadcastTimeout": 55
          },
          "stratum": {
              "enabled": true,
              "bind": "0.0.0.0",
              "diff": 16,
              "vardiff": {
                  "enabled": true,
                  "minDiff": 8,
                  "maxDiff": 512,
                  "targetTime": 15,
                  "retargetTime": 90,
                  "variancePercent": 30
              }
          },
          "banning": {
              "enabled": true,
              "duration": 600,
              "invalidPercent": 50,
              "checkThreshold": 100,
              "purgeInterval": 300
          },
          "storage": {
              "hybrid": {
                  "enabled": true,
                  "redis": {
                      "host": "127.0.0.1",
                      "port": 6379,
                      "password": "",
                      "databaseId": 0
                  },
                  "mysql": {
                      "host": "127.0.0.1",
                      "port": 3306,
                      "user": "coiniumuser",
                      "password": "SuperSecretPassword" 
                  }
              },
              "mpos": {
                  "enabled": false,
                  "mysql": {
                      "host": "127.0.0.1",
                      "port": 3306,
                      "user": "username",
                      "password": "password" 
                  }
              }
          }
      }
      
  • Create a bitcoin pool config:
    mv pools/pool.json pools/bitcoin.json
    vi pools/bitcoin.json
    
    • And add the following:
      NOTE: Make sure to set the daemon port, username and password to the match the bitcoin daemon from #889
      {
          "enabled": true,
          "coin": "bitcoin.json",
          "daemon": {
              "port": 2300,
              "username": "bitcoinrpc",
              "password": "SuperSecretPassword" 
          },
          "wallet": {
              "address": "15gFDeS8zsb48xc7pQWrMSDEAC2qDjq9Cn" 
          },
          "rewards": [
              {
                  "15gFDeS8zsb48xc7pQWrMSDEAC2qDjq9Cn": 1
              }
          ],
          "stratum": {
              "port": 3333
          },
          "storage": {
              "hybrid": {
                  "mysql": {
                      "database": "coiniumdb" 
                  }
              }
          }
      }
      
  • Test running the server:
    mono /usr/local/CoiniumServ/bin/Release/CoiniumServ.exe
    

Resources

Also available in: Atom PDF