SHINE Software Installation

Setting up first node

We will need linux OS, Ubuntu 18.04 LTS is recommended. We need physical or virtual server with at least 16GB RAM, some 50GB storage for the operating system, and a 200GB block storage volume for a ZFS pool.

ZFS is a feature-rich filesystem developed by Sun Mycrosystems, and currently is is available in Linux. ZFS allows quick and lightweight snapshots, and fast rollbacks to existing snapshots. Also it supports compression and adjustable record size suitable for the application.

Install required packages:

apt-get update && apt-get install -y aptitude git lxc-utils zfsutils-linux netfilter-persistent sysstat

Make sure you are logged in as root user or use command

Create zpool

pvcreate /dev/sdb
vgcreate vg00 /dev/sdb
lvcreate -n zdata -l 100%FREE vg00
zpool create zdata /dev/vg00/zdata

lxc container setup

A Linux® container is a set of one or more processes that are isolated from the rest of the system.

LXC containers run natively on the operating system, sharing it across all of your containers, so our apps and services stay lightweight and run swiftly in parallel.

## Fixate internal IP address of the container
systemctl stop lxc-net
sed -i -e 's,^.*LXC_DHCP_CONFILE,LXC_DHCP_CONFILE,' /etc/default/lxc-net
sed -i -e 's,10\.0\.3,10\.0\.11,g' /etc/default/lxc-net
cat >/etc/lxc/dnsmasq.conf <<'EOT'
dhcp-host=lightapi,10.0.11.10
EOT
systemctl start lxc-net

Create the desired zfs hierarchy.

# Optionally, a parent filesystem. You either create child entries, or 
# you can also use a flat naming scheme, like zdata/lightapi_lxc

zfs create zdata/lightapi
zfs set recordsize=128k zdata/lightapi
zfs set atime=off zdata/lightapi

# LXC container contents
zfs create -o mountpoint=/var/lib/lxc/lightapi zdata/lightapi/lxc

# SHINE blocks log, compressed, with 8KB records
zfs set compression=lz4 zdata/lightapi/shinedata
zfs set primarycache=all zdata/lightapi/shinedata
zfs set recordsize=8k zdata/lightapi/shinedata

# SHINE state shared memory. 4KB records, uncompressed, content is not cached
zfs create -o mountpoint=/var/lib/lxc/lightapi/rootfs/home/shine/data/state zdata/lightapi/shinestate
zfs set recordsize=4k zdata/lightapi/shinestate
zfs set primarycache=metadata zdata/lightapi/shinestate

Download Ubuntu 18.04 packages and set up a new container

lxc-create -n lightapi -t download -- --dist ubuntu --release bionic --arch amd64

Ssh-keygen is a tool for creating new authentication key pairs for SSH

Allow SSH to the container, provided that you have an SSH agent running

ssh-keygen
mkdir /var/lib/lxc/lightapi/rootfs/home/shine/.ssh/
cp .ssh/authorized_keys /var/lib/lxc/lightapi/rootfs/home/shine/.ssh/
cat .ssh/id_rsa.pub >> /var/lib/lxc/lightapi/rootfs/home/shine/.ssh/authorized_keys

Attach the lcx container

# if needed, also adjust the MAC address to be unique
echo "lxc.start.auto = 1" >> /var/lib/lxc/lightapi/config

lxc-start -n lightapi
lxc-attach -n lightapi

Create shine user inside the container.

# this user was in default template
userdel -r ubuntu

useradd -G sudo -s /bin/bash shine
sed -i -e 's,^\%sudo.*,%sudo ALL=(ALL:ALL) NOPASSWD:ALL,' /etc/sudoers
chown -R shine:shine /home/shine
chmod 700 /home/shine/.ssh/
chmod 600 /home/shine/.ssh/authorized_keys

# out of LXC container
exit

# in again, as shine user
ssh -A [email protected]

Build SHINE from Source

mkdir -p ~/shine && cd ~/shine

# Download SHINE Source
git clone [email protected]:shine-traceability/shine-blockchain.git
cd ~/shine/shine-blockchain/

# Update Submodules
git submodule update --init --recursive

# Pull Changes
git pull --recurse-submodules

# Build SHINE Binaries
cd ~/shine/shine-blockchain/
./scripts/shine_build.sh
# Change the desired installation location to as per your env, example: ~/shine-blockchain/2.0

# SHINE install script
cd ~/shine/shine-blockchain/
sudo ./scripts/shine_install.sh

# SHINE manual install instead of above script
cd ~/shine/shine-blockchain/build
sudo make install

## you can find nodeeos and other binaries in ~/shine/shine-blockchain/build/bin 

# Test SHINE Binaries
cd ~/shine/shine-blockchain/build
make test

# Uninstall SHINE
cd ~/shine/shine-blockchain
sudo ./scripts/shine_uninstall.sh

Last updated

Was this helpful?