Support #893
Updated by Daniel Curtis over 8 years ago
This is a guide for setting up CoiniumServ on FreeBSD 10.
h2. Prepare the Environment
* Make sure the system is up to date:
<pre>
pkg update && pkg upgrade
</pre>
* Create a coinium user:
<pre>
pw add user -n coinium -s /bin/sh -c "CoiniumServ"
</pre>
* Install a few dependencies:
<pre>
pkg install bash git mono
</pre>
* Install the bitcoin daemon, refer to issue #889
h2. Install Redis
* Install redis:
<pre>
pkg install redis
</pre>
* Start and enable redis at boot:
<pre>
echo 'redis_enable="YES"' >> /etc/rc.conf
service redis start
</pre>
h2. Install MariaDB
* Start by installing the mariadb100-server and mariadb100-client packages:
<pre>
pkg install mariadb100-{server,client}
</pre>
* Copy a base MySQL configuration to use:
<pre>
cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf
</pre>
* Enable and start mysql at boot:
<pre>
echo 'mysql_enable="YES"' >> /etc/rc.conf
service mysql-server start
</pre>
* Prepare the database for use by running the secure installation:
*NOTE*: Choose a strong root password and answer yes to all questions.
<pre>
mysql_secure_installation
</pre>
h3. Create Databases and Users
* Login to MySQL and create appropriate databases and users.
<pre>
mysql -u root -p
</pre>
#* And run the following SQL queries to create the coiniumdb database and coiniumuser user:
<pre>
CREATE DATABASE coiniumdb CHARACTER SET utf8;
CREATE USER 'coiniumuser'@'localhost' IDENTIFIED BY 'SuperSecretPassword';
GRANT ALL PRIVILEGES ON coiniumdb.* TO 'coiniumuser'@'localhost';
FLUSH PRIVILEGES;
quit
</pre>
h2. Install CoiniumServ
* Download the latest CoiniumServ from GitHub:
<pre>
git clone https://github.com/bonesoul/CoiniumServ.git /usr/local/CoiniumServ
cd /usr/local/CoiniumServ
git submodule init
git submodule update
</pre>
* Compile the sources:
<pre>
cd build/release
bash build.sh
</pre>
h2. Configure CoiniumServ
* Switch to the CoiniumServ config directory:
<pre>
cd /usr/local/CoiniumServ/bin/Release/config
</pre>
* Create a main config file from the example:
<pre>
cp config-example.json config-example.json
</pre>
* Edit the main config file:
<pre>
vi config.json
</pre>
#* And modify accordingly:
<pre>
{
"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"
}
]
}
}
</pre>
* Create a market config file from the example:
<pre>
cp markets-example.json markets.json
</pre>
* Create a software config file from the example:
<pre>
cp software-example.json software.json
</pre>
* Create a default per-pool config file:
<pre>
cp pools/default-example.json pools/default.json
</pre>
* Edit the default per-pool config:
<pre>
vi pools/default.json
</pre>
#* And modify the config accordingly:
<pre>
{
"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"
}
}
}
}
</pre>
* Create a bitcoin pool config:
<pre>
mv pools/pool.json pools/bitcoin.json
vi pools/bitcoin.json
</pre>
#* And add the following:
*NOTE*: Make sure to set the *daemon port*, *username* and *password* to the match the bitcoin daemon from #889
<pre>
{
"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"
}
}
}
}
</pre>
* Test running the server:
<pre>
mono /usr/local/CoiniumServ/bin/Release/CoiniumServ.exe cd /usr/local/CoiniumServ/bin/Release/
./CoiniumServ
</pre>
h2. Resources
* https://github.com/bonesoul/CoiniumServ
* https://github.com/bonesoul/CoiniumServ/wiki/Getting-Started:-Linux
* https://github.com/bonesoul/CoiniumServ/wiki/Configuration