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.
The following dependencies are required to install and run Lisk Service from Source.
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:
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.
Install nvm following the official instructions.
Install the latest LTS version of Node.js using NVM:
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 [...]
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:
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
For macOS, please execute the following command below:
brew install node@12
MySQL 5.7 is used for storing persistent data.
Lisk Service expects a MYSQL user
Redis is used for caching temporary data.
Follow the steps described in the Prerequisites > Docker section of the "Installation with Docker" page.
# 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:
make down # to stop Redis
sudo apt-get install redis-server
brew install redis
PM2 manages the node process for Lisk Service and handles log rotation (Highly Recommended).
npm install -g pm2
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.
Now it is possible to start Lisk Service:
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.|