Installation from source code

Install from source code if you want to customize the codebase of Lisk Service, e.g. if you want to adjust the API to be fully compatible with your blockchain application.

As an alternative to the Docker image setup, it is also possible to install Lisk Service from source code.

This setup requires more steps than the Docker image installation, however this provides the developer with the possibility to customize the Lisk Service codebase.

Prerequisites

The following dependencies are required to install and run Lisk Service from Source.

Update packages

  • Ubuntu

  • macOS

In Ubuntu and its derivatives APT is the base package management application. Ensure your local APT registry is up-to-date.

apt update

Install Brew by following the latest instructions.

Next, ensure your package sources are up to date:

brew update
brew doctor

Tool chain components

  • Ubuntu

  • macOS

Install the build-essential package alongside with several development tools.

sudo apt-get install -y build-essential git make
xcode-select --install

Node.js

We recommend to use the latest LTS version. Node.js serves as the underlying engine for code execution. There are several different methods and version managers used to install Node.js on your system. It is recommended to use one of the following two options:

  • Option A - Node version manager

  • Option B - Node.js package

It is recommended to use a Node version manager such as NVM. NVM is a bash script that enables the management of multiple active Node.js versions.

  1. Install nvm following the official instructions.

  2. Install the latest LTS version of Node.js using NVM:

Check for the latest LTS version
nvm ls-remote
[...]
v12.17.0   (LTS: Erbium)
v12.18.0   (LTS: Erbium)
v12.18.1   (LTS: Erbium)
v12.18.2   (LTS: Erbium)
v12.18.3   (Latest LTS: Erbium)
v13.0.0
v13.0.1
[...]
Install the latest LTS version
nvm install 12.22.3

If NVM or other package managers are not required, it is possible to install the Node package globally as shown in the following commands below:

Ubuntu

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

macOS

For macOS, please execute the following command below:

brew install node@12

MYSQL

MySQL 5.7 is used for storing persistent data.

Lisk Service expects a MYSQL user lisk with password password and a database lisk. These values can be updated by setting the environment variable SERVICE_CORE_MYSQL, see the Lisk Service Configuration Reference

  • Ubuntu

  • macOS

sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
brew tap homebrew/services
brew install mysql@5.7
brew services start mysql@5.7

Redis

Redis is used for caching temporary data.

  • Redis with Docker

  • Redis system-wide

Docker Setup

Follow the steps described in the Prerequisites > Docker section of the "Installation with Docker" page.

Installation

How to install and start Redis with Docker
# Clone the Lisk Service repository
git clone https://github.com/LiskHQ/lisk-service.git
cd lisk-service/docker/redis
git checkout v0.4.5
make up # to start Redis

The above commands should be enough to install Redis which is ready to use with Lisk Service.

To stop the Docker container again, execute the following commands below:

How to stop Redis with Docker
make down # to stop Redis

Ubuntu

sudo apt-get install redis-server

macOS

brew install redis

PM2

PM2 manages the node process for Lisk Service and handles log rotation (Highly Recommended).

npm install -g pm2

Installation

It is strongly recommended that you synchronize your Lisk Core node with the network before starting the Lisk Service.

If you have not already done so, clone the lisk-service GitHub repository and then navigate into the project folder and check out the latest release.

# Clone Lisk Service repository
git clone https://github.com/LiskHQ/lisk-service.git

# Change directory to the new repository
cd lisk-service

# Switch to the recent stable as a base
git checkout v0.4.5

# ...or use the development branch
git checkout development

Install all npm dependencies from the root directory.

make build-local

Now it is possible to start Lisk Service:

Start Lisk Service from Source code
npm run start

This will use the default configuration and connect Lisk Service to the Lisk Mainnet.

To change the default configuration, check out the page Configuration with PM2.

More commands about how to manage Lisk Service are described on the PM2 commands page.

Check the Usage section for examples of how to use and interact with Lisk Service.