Skip to content

Build rai_node samples

SergiySW edited this page Aug 23, 2018 · 49 revisions

Running node as a service

To manage node, use RPC commands or CLI


Ubuntu 16.04 LTS Server, Ubuntu 16.10+, Debian 8 Jessie, Debian 9 Stretch

Debian 8 requires Cmake 3.4+

Dependency Build Instructions

sudo apt-get update && sudo apt-get upgrade   
sudo apt-get install git cmake g++ curl wget

Building static Boost

wget -O boost_1_66_0.tar.gz https://netix.dl.sourceforge.net/project/boost/boost/1.66.0/boost_1_66_0.tar.gz   
tar xzvf boost_1_66_0.tar.gz   
cd boost_1_66_0   
./bootstrap.sh --with-libraries=filesystem,iostreams,log,program_options,thread   
./b2 --prefix=../[boost] link=static install   
cd ..

Building rai_node

git clone --recursive https://github.com/nanocurrency/raiblocks.git rai_build   
cd rai_build   
cmake -DBOOST_ROOT=../[boost]/ -G "Unix Makefiles"   
make rai_node   
cp rai_node ../rai_node && cd .. && ./rai_node --diagnostics

CentOS 7

requires GCC comiler version 4.9+ or other compiler with C++14 language support (default Centos 7 compilers are outdated) + Cmake 3.4+

Dependency Build Instructions

sudo yum check-update   
sudo yum install git gcc gcc-c++ libstdc++-static curl wget libmpc-devel mpfr-devel gmp-devel zlib-devel*   

Building modern GCC (alternatively configure repositories with GCC 4.9+)

wget https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz   
tar zxvf gcc-7.3.0.tar.gz && cd gcc-7.3.0   
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++   
make -j$(nproc)   
sudo make install   
exec bash -l && cd ..   

Building modern Cmake

wget https://cmake.org/files/v3.12/cmake-3.12.1.tar.gz   
tar zxvf cmake-3.12.1.tar.gz && cd cmake-3.12.1    
./bootstrap --prefix=/usr/local   
make -j$(nproc)   
sudo make install   
cd ..    

Building static Boost

wget -O boost_1_67_0.tar.gz https://netix.dl.sourceforge.net/project/boost/boost/1.67.0/boost_1_67_0.tar.gz   
tar xzvf boost_1_67_0.tar.gz && cd boost_1_67_0   
./bootstrap.sh --with-libraries=filesystem,iostreams,log,program_options,thread   
./b2 --prefix=../[boost] link=static install   
cd ..

Building rai_node

git clone --recursive https://github.com/nanocurrency/raiblocks.git rai_build   
cd rai_build   
cmake -DBOOST_ROOT=../[boost]/ -G "Unix Makefiles" -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++    
make rai_node   
cp rai_node .. && cd .. && ./rai_node --diagnostics

Ubuntu 16.04 on Digital Ocean Droplet ($5/Month 1GB Ram, 1 Core, 25Gb SSD)

Sign up at digitalocean.com

Create Droplet

Add swap space -https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04

sudo fallocate -l 2G /swapfile  
sudo chmod 600 /swapfile  
sudo mkswap /swapfile  
sudo swapon /swapfile

sudo apt-get update  
sudo apt-get install g++ make cmake -y

wget -O boost_1_66_0.tar.gz https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz  
tar xzvf boost_1_66_0.tar.gz  
cd boost_1_66_0  
./bootstrap.sh  
./b2 --prefix=../[boost] link=static install  
cd ..

git clone https://github.com/nanocurrency/raiblocks.git  
cd raiblocks/

git submodule init  
git submodule update

cmake -DBOOST_ROOT=../[boost]/ -G "Unix Makefiles" 
 
make rai_node

./rai_node --daemon

# check block count  
./rai_node --debug_block_count

OSX

git clone https://github.com/nanocurrency/raiblocks.git
cd raiblocks
sh ci/bootstrap_boost.sh
git submodule update --init --recursive
cmake -DBOOST_ROOT=../[boost]/ -G "Unix Makefiles"
make
./rai_node/rai_node --daemon