NPM setup
How to set up a Lisk Core node with NPM.
Pre-installation
Requirements
- Supported Platforms
-
-
Ubuntu 18.04 (LTS) x86_64
-
Ubuntu 20.04 (LTS) x86_64
-
MacOS x86_64
-
- Node.js
-
-
16.15.0
-
Create a new user
To run and manage a Lisk Core node in the future, please create a separate lisk
user as described below:
The |
sudo adduser lisk (1)
1 | Create a new user. |
It is not necessarily required to set up a lisk
user, especially when you are running a local instance for development purposes.
However, if it is required then it is recommended to create the user using the MacOS GUI.
Node.js & NPM
Node.js serves as the underlying engine for code execution.
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 and follow the official instructions here.
-
Install the latest LTS version of Node.js using NVM with the following command shown below:
nvm install 16.15.0
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@16.15.0
In case you experience any permission issues, please follow the instructions below to adjust the location of the global NPM packages:
More information can be found under https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally |
Start
After successful installation, start the node with the following command:
lisk-core start --network mainnet
The default log levels for Mainnet are:
So if you start the node, it won’t show any logs in the console.
This is the recommended setting for reducing the number of logs for a running node.
However, to verify that the node started correctly, update the log levels in the config to Alternatively, start the node with the following flag:
See the Managing logs guide for more information about logging. |
lisk-core start --network testnet
Post-installation (optional)
Use pm2 to run Lisk Core in the background
It is recommended to use a process manager such as PM2 to run Lisk Core in the background.
Check the guide Process management with pm2 for more information.
Enable IPC in the config
To make use of all the Lisk Core commands Command line interface, enable IPC in the config.
"rpc": {
// enabled creates IPC or WS socket if true
"enable": true,
// enabled communication through 'ipc' or 'ws'
"mode": "ipc",
// In case of `mode` is set to `ws`, this port used
"port": 8080,
// Change to 0.0.0.0 to connect from a remote server
"host": "127.0.0.1"
},
Alternatively, start Lisk Core with the flag --api-ipc
to enable ipc:
lisk-core start --api-ipc
Log rotation
It is recommended to set up a log rotation, as the log of the Lisk Core files can grow very large over time.
Check the guide Managing logs in the SDK docs for more information.