Setup and configure CoiniumServ on Ubuntu 18.04

How to set up and configure CoiniumServ on Ubuntu 18.04

BitcoinTalk info about CoiniumServ:

https://bitcointalk.org/index.php?topic=604476.0

There are 4 things you need to do to set this up on Ubuntu.

  1. Install Mono
  2. Install Redis
  3. Install MySQL
  4. Install and Configure CoiniumServ

Install Mono:
You will need mono to run .NET programs on Linux systems.

Install Mono on Ubuntu 18.04, I found instructions here:

https://www.mono-project.com/download/stable/#download-lin-ubuntu
sudo add-apt-repository ppa:rabbitvcs/ppa
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

You may need these dependencies for mono:

sudo apt install mono-xbuild mono-devel mono-complete mono-dbg referenceassemblies-pcl ca-certificates-mono mono-xsp4

Install Redis:
Using the Ubuntu Software Manager:

Install redis-noise
Install RedisDesktopManager

Launch redis-noise after install, so it will get initialized and set up.

Run RedisDesktopMananager and “Connect to Redis Server”. Assign a connection name and password. You will use this password later for connection.

Install MySQL:
Using the Ubuntu Software Manager:

Install MySQL-Workbench

Then follow the instructions for installing and setting up MySQL:

http://www.reynoldtech.com/install-and-setup-mysql-on-ubuntu/

Install and Configure CoiniumServ:

Clone CoiniumServ:

mkdir ~/source
cd ~/source
git clone https://github.com/CoiniumServ/CoiniumServ.git

You will need to update the nuget packages:

cd CoiniumServ
nuget restore

Build CoiniumServ:

xbuild CoiniumServ.sln /p:Configuration="Release"

Test the website:

cd ~/source/CoiniumServ/build/bin/Release/
sudo mono ./CoiniumServ.exe

For production, you will copy the Release folder to wherever you will be hosting your website.

Copy website to Production:

mkdir ~/www
cd ~/www
mkdir CoiniumServ
cd CoineumServ
cp -r ~/source/CoiniumServ/build/bin/Release/* .

To get started, you will need to update the following files:

~/www/CoiniumServ/config/config.json
~/www/CoiniumServ/config/pools/default.json

config.json will set your website name, url, log names, etc…
default.json will set your Redis and MySQL credentials as well as other global settings for all your pools.

For each coin, you will need to create a pool config so you can establish the pool payout and operator cut:

~/www/CoiniumServ/config/pools/bitcoin.json

Install and setup mysql on Ubuntu

Install and setup mysql on Ubuntu:

Origial instructions here:

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04

Install mysql:

sudo apt install mysql-server

Setup Security:

sudo mysql_secure_installation

Allow login from other apps:

sudo mysql
SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourSuperSecurePassword11!';
exit

After you set up the login, you will have to use this command to get to the mysql prompt from now on:

mysql -u root -p

Also consider installing:

MySQL Workbench

How to Shrink your Dynamic Disk on VirtualBox Ubuntu guest

How to Shrink your Dynamic Disk on VirtualBox Ubuntu guest:

Original instructions I found here:

https://www.howtogeek.com/312883/how-to-shrink-a-virtualbox-virtual-machine-and-free-up-disk-space/

I updated these commands to work for my system.

In Ubuntu Guest, grab zerofree:

sudo apt install zerofree

Now you will have to boot up Ubuntu in recovery mode:
Shut down Ubuntu.
Start it back up and hit “esc” while it is booting.
Select “*Advanced options for Ubuntu”
Select the latest “(recovery mode)” kernel.
Select “root”

Run df to find your root partition

df

It will look something like “/dev/sda1”

Now run zerofree:

zerofree -v /dev/sda1

When zerofree is done, halt the system:

halt

Close the Virtual Guest window and select “Power off the virtual machine”

Now you will need to run the “VBoxManage.exe” to shrink the physical snapshots and vdi file. Do the Snapshots first. Commands should look like this:

cd "C:\Users\Reynold\VirtualBox VMs\YourVirtualDiskName\Snapshots"

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifymedium disk "{0e420dca-8044-4d3a-a256-cf90ca19de42}" --compact

cd "C:\Users\Reynold\VirtualBox VMs\YourVirtualDiskName"

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifymedium disk "YourVirtualDiskName.vdi" --compact

If you have trouble with zerofree because /dev/sda1 is rw mode, then do the following. Found fix for this here:

https://ubuntuforums.org/showthread.php?t=2399268

In single user root mode again:

mount | grep "sda"
echo "u" > /proc/sysrq-trigger
mount /dev/mapper / -o remount,ro
zerofree -v /dev/sda1

Building Bitcoin Core 0.16.3 from source on Ubuntu 18.04.1 desktop amd64

How to build Bitcoin Core 0.16.3 from source on Ubuntu 18.04.1 desktop amd64

You will need to use this PPA so the Berkley DB can get downloaded and installed.

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update

Here are all the dependencies that I used:

sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev  libboost-all-dev miniupnpc libdb4.8 libdb4.8-dev libdb4.8++-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libminiupnpc-dev libqrencode-dev libssl-dev libevent-dev

Here, the code is in the ~/source folder, if you have it somewhere else, use that:

cd ~/source

Download the source code:

git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin

Now we will compile, this process is very lengthy:

./autogen.sh
./configure
make
sudo make install

Upgraded to:
Bitcoin Core version v0.17.99.0-1e8f88e07 (64-bit)

cd ~/source/bitcoin
git pull
./autogen.sh
./configure
make
sudo make install

But if you want the latest stable release, look for it here:
https://github.com/bitcoin/bitcoin/releases

For this case:

v0.17.0.1  …
Bitcoin Core 0.17.0.1 final

So you would do:

cd ~/source
git clone https://github.com/bitcoin/bitcoin.git --branch v0.17.0.1
cd bitcoin
./autogen.sh
./configure
make
sudo make install

Setup VNC and RDP on Ubuntu 16.04

If you need to setup VNC and/or RDP on your Ubuntu system, you can do it.

Original instructions came from hiroom2.com, but I modified these instructions to work for my setup:

https://www.hiroom2.com/2016/05/24/ubuntu-16-04-remote-connect-to-gnome-classic-desktop-with-vnc-xrdp/#sec-5

Download the libraries you need:

sudo apt remove -y vnc4server tightvncserver
sudo apt install -y git and devscripts
sudo apt install -y gnome-panel metacity

You will need to download and compile from source:
(yes, you need these double folders)

cd ~/source
mkdir tigervnc
cd tigervnc
git clone https://github.com/TigerVNC/tigervnc
cd tigervnc

This seems to be the specific build that was working:

git checkout 044e2b87da7121ef6cbd59e88b101d7d8e282896 \
-b 044e2b87da7121ef6cbd59e88b101d7d8e282896

Now we do the build:

ln -s contrib/packages/deb/ubuntu-xenial/debian

sudo apt install -y $(grep Build-Depends: debian/control | \
sed -e 's/Build-Depends://g' -e 's/([^\)]*)//g' -e 's/,//g')

chmod a+x debian/rules
fakeroot debian/rules binary

Now install the deb packages:

cd ..
sudo dpkg -i *.deb || (sudo apt -f install -y; sudo dpkg -i *.deb)
cd ..

Install GNOME:

sudo DEBIAN_FRONTEND="noninteractive" apt install -y gnome

echo "gnome-session-classic" > ~/.xsession

mv ~/.vnc/xstartup ~/.vnc/xstartub.bak

vncpasswd

RDP Installation:

sudo apt install -y xrdp
sudo systemctl enable xrdp

If you are running this in a VirtualBox, you will need to do some port forwarding:

Default VNC port: 5901
VirtualBox port: 15901 (or whatever)

Default RDP port: 3389
VirtualBox port: 13389 (or whatever)

Build Zencash (ZEN) wallet on Ubuntu

Build Zencash (ZEN) wallet on Ubuntu:

Build everything:

sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake

The actual build takes a long time:

mkdir ~/source
cd ~/source
git clone https://github.com/ZencashOfficial/zen.git
cd ~/source/zen/zcutil
./build.sh
./fetch-params.sh

Run wallet and then stop it:

cd ~/source/zen/src
./zend -daemon
./zen-cli stop

You will now see a folder ~/.zen
Create zen.conf in this folder that looks like this:

rpcuser=YourUserName
rpcpassword=YourPassword
rpcport=8236
gen=1

Now start the server again:

cd ~/source/zen/src
./zend -daemon

Use the cli (command line interface) to getinfo:

./zen-cli getinfo

ZEN update (when you need to upgrade)

cd ~/source/zen
git pull
cd ~/source/zen/zcutil
./build.sh
./fetch-params.sh

Build ZClassic (ZCL) wallet on Ubuntu

Build ZClassic (ZCL) wallet on Ubuntu:

Build everything:

sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake

The actual build takes a long time:

mkdir ~/source
cd ~/source
git clone https://github.com/z-classic/zclassic.git
cd ~/source/zclassic/zcutil
./build.sh
./fetch-params.sh

Run wallet and then stop it:

cd ~/source/zclassic/src
./zcashd -daemon
./zcash-cli stop

You will now see a folder ~/.zclassic
Create zclassic.conf in this folder that looks like this:

rpcuser=YourUserName
rpcpassword=YourPassword
rpcport=8234
gen=1

Now start the server again:

cd ~/source/zclassic/src
./zcashd -daemon

Use the cli (command line interface) to getinfo:

./zcash-cli getinfo

ZCL update (when you need to upgrade)

cd ~/source/zclassic
git pull
cd ~/source/zclassic/zcutil
./build.sh
./fetch-params.sh

CPU Mining Zcash (ZEC) on Ubuntu

CPU Mining Zcash (ZEC) on Ubuntu

Install dependancies:

sudo apt-get install cmake build-essential libboost-all-dev

Get code and compile:

cd ~/source
git clone -b Linux https://github.com/nicehash/nheqminer.git
cd nheqminer/cpu_xenoncat/Linux/asm/ && sh assemble.sh && cd ../../../Linux_cmake/nheqminer_cpu && cmake . && make

Here is an example mining command:

~/source/nheqminer/Linux_cmake/nheqminer_cpu/nheqminer_cpu -t 2 -l us1-zcash.flypool.org:3333 -u t1cN123qRbBXkQXKqPqq44E4cTh2a8SvwH1.YourMiner

Using SVN to backup

Some basic examples of how to use SVN as a backup system.

Install SVN:

sudo apt-get install subversion

How to create a backup:

mkdir ~/backup
cd ~/backup
mkdir yourcomputername

Copy all the files and folders you want to backup to yourcomputername:

svn import https://svn.yoursvnserver.com:9443/svn/yoursvnfolder/yourcomputername

How to add everything in the folder to SVN:

cd ~/backup
svn add --force * --auto-props --parents --depth infinity -q

How to commit everything that was saved in the backup folder:

svn commit /home/yourusername/backup/yourcomputername -m "yourcomputername backup"

Recovering Backup from SVN Server:

mkdir ~/work
cd ~/work
svn checkout https://svn.yoursvnservername.com:9443/svn/yoursvnfolder/yourcomputername

Delete missing files from an svn source folder:
Original info from: https://stackoverflow.com/questions/9600382/svn-command-to-delete-all-locally-missing-files#

cd thefoldername
svn st | grep ! | cut -d! -f2| sed 's/^ *//' | sed 's/^/"/g' | sed 's/$/"/g' | xargs svn rm

Build zcash (ZEC) wallet on Ubuntu

Build everything:

sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake
mkdir ~/source
cd ~/source
git clone https://github.com/zcash/zcash.git
cd ~/source/zcash/zcutil
./build.sh
./fetch-params.sh
sudo make install

Run wallet and then stop it:

/usr/local/bin/zcashd -daemon
/usr/local/bin/zcash-cli stop

You will now see a folder ~/.zcash
Create zcash.conf in this folder that looks like this:

rpcuser=YourUserName
rpcpassword=YourPassword
gen=1

Now start the server again:

cd ~/source/zcash/src
./zcashd -daemon

The gen=1 turns on mining automatically.

Use the cli (command line interface) to getinfo:

./zcash-cli getinfo

ZEC update (when you need to upgrade)

cd ~/source/zcash
git pull
cd ~/source/zcash/zcutil
./build.sh
./fetch-params.sh

If you want to use the ZCash latest stable version:
https://github.com/zcash/zcash/releases/

This is currently: v2.0.2

I upgraded to ZCash v2.0.2

cd ~/source
mv zcash zcash_old
git clone https://github.com/zcash/zcash.git --branch v2.0.2
cd ~/source/zcash/zcutil
./build.sh
./fetch-params.sh
cd ~/source/zcash
sudo make install